-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes ubb and uci fakes, adds test to check this in the future, tldr …
…do not create circular fake loops
- Loading branch information
1 parent
88aa20c
commit 37e35f3
Showing
7 changed files
with
295 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package unifi_test | ||
|
||
import ( | ||
"github.com/brianvoe/gofakeit/v6" | ||
"github.com/stretchr/testify/require" | ||
"github.com/unpoller/unifi/v5" | ||
"testing" | ||
) | ||
|
||
func TestDevices(test *testing.T) { | ||
d := unifi.Devices{} | ||
err := gofakeit.Struct(&d) | ||
require.NoError(test, err) | ||
require.NotEmpty(test, d.UBBs) | ||
require.NotEmpty(test, d.UCIs) | ||
require.NotEmpty(test, d.PDUs) | ||
require.NotEmpty(test, d.UAPs) | ||
require.NotEmpty(test, d.USGs) | ||
require.NotEmpty(test, d.UDMs) | ||
require.NotEmpty(test, d.UXGs) | ||
require.NotEmpty(test, d.USWs) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package mocks_test | ||
|
||
import ( | ||
"github.com/stretchr/testify/require" | ||
"github.com/unpoller/unifi/v5/mocks" | ||
"testing" | ||
) | ||
|
||
func TestMockUnifiClient(t *testing.T) { | ||
m := mocks.NewMockUnifi() | ||
devices, err := m.GetDevices(nil) | ||
require.NoError(t, err) | ||
require.NotEmpty(t, devices.UAPs) | ||
require.NotEmpty(t, devices.USGs) | ||
require.NotEmpty(t, devices.UDMs) | ||
require.NotEmpty(t, devices.USWs) | ||
require.NotEmpty(t, devices.PDUs) | ||
require.NotEmpty(t, devices.UCIs) | ||
require.NotEmpty(t, devices.UXGs) | ||
require.NotEmpty(t, devices.UBBs) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package unifi_test | ||
|
||
import ( | ||
"github.com/brianvoe/gofakeit/v6" | ||
"github.com/stretchr/testify/require" | ||
"github.com/unpoller/unifi/v5" | ||
"testing" | ||
) | ||
|
||
func TestUBB(test *testing.T) { | ||
ubb := unifi.UBB{} | ||
err := gofakeit.Struct(&ubb) | ||
require.NoError(test, err) | ||
require.NotEmpty(test, ubb.Name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package unifi_test | ||
|
||
import ( | ||
"github.com/brianvoe/gofakeit/v6" | ||
"github.com/stretchr/testify/require" | ||
"github.com/unpoller/unifi/v5" | ||
"testing" | ||
) | ||
|
||
func TestUCI(test *testing.T) { | ||
uci := unifi.UCI{} | ||
err := gofakeit.Struct(&uci) | ||
require.NoError(test, err) | ||
require.NotEmpty(test, uci.Name) | ||
} |