Skip to content

Commit

Permalink
qrg: Check content in gateway qrcode test
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Vitan committed Sep 9, 2024
1 parent a546ae6 commit 2f3bbd8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion pkg/qrcodegenerator/grpc_gateways_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"go.thethings.network/lorawan-stack/v3/pkg/errors"
"go.thethings.network/lorawan-stack/v3/pkg/log"
"go.thethings.network/lorawan-stack/v3/pkg/qrcodegenerator"

"go.thethings.network/lorawan-stack/v3/pkg/qrcodegenerator/qrcode/gateways"
"go.thethings.network/lorawan-stack/v3/pkg/ttnpb"
"go.thethings.network/lorawan-stack/v3/pkg/util/test"
Expand Down
13 changes: 8 additions & 5 deletions pkg/qrcodegenerator/qrcode/gateways/gateways_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/smarty/assertions"
"go.thethings.network/lorawan-stack/v3/pkg/qrcodegenerator/qrcode/gateways"
"go.thethings.network/lorawan-stack/v3/pkg/types"
"go.thethings.network/lorawan-stack/v3/pkg/util/test"
"go.thethings.network/lorawan-stack/v3/pkg/util/test/assertions/should"
)
Expand All @@ -29,15 +30,15 @@ func TestParseGatewaysAuthenticationCodes(t *testing.T) {
t.Parallel()

for i, tc := range []struct {
FormatID string
Data []byte
ExpectedEUI,
FormatID string
Data []byte
ExpectedEUI types.EUI64
ExpectedOwnerToken string
}{
{
FormatID: "ttigpro1",
Data: []byte("https://ttig.pro/c/ec656efffe000128/abcdef123456"),
ExpectedEUI: "ec656efffe000128",
ExpectedEUI: types.EUI64{0xec, 0x65, 0x6e, 0xff, 0xfe, 0x00, 0x01, 0x28},
ExpectedOwnerToken: "abcdef123456",
},
} {
Expand All @@ -52,7 +53,9 @@ func TestParseGatewaysAuthenticationCodes(t *testing.T) {
d, err := qrCode.Parse(tc.FormatID, tc.Data)
data := test.Must(d, err)

a.So(data, should.NotBeNil)
a.So(data.FormatID(), should.Equal, tc.FormatID)
a.So(data.GatewayEUI(), should.Resemble, tc.ExpectedEUI)
a.So(data.OwnerToken(), should.Equal, tc.ExpectedOwnerToken)
})
}
}

0 comments on commit 2f3bbd8

Please sign in to comment.