Skip to content

Commit ff05f65

Browse files
committed
Fix changed function signature in integration tests
1 parent 93ce765 commit ff05f65

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ dev-adminui:
2424
docker:
2525
sudo docker run -u "$(ID):$(GID)" --rm -t -v `pwd`:/wag wag_builder
2626

27+
test:
28+
go test -exec sudo -v ./...
29+
30+
2731
.build_ui:
2832
cd adminui/frontend; npm install; npm run build
2933
cd internal/mfaportal/resources/frontend; npm install; npm run build

test/integration/registration_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func makeRegistrationToken() string {
2323
func TestRegistrationToken(t *testing.T) {
2424
validRegistrationToken := makeRegistrationToken()
2525

26-
result, err := ctrl.NewRegistration(validRegistrationToken, "toaster", "", "", 1, "")
26+
result, err := ctrl.NewRegistration(validRegistrationToken, "toaster", "", "", 1, 0, "")
2727
if err != nil {
2828
t.Fatal("failed to create registration token: ", err)
2929
}
@@ -70,7 +70,7 @@ func TestRegistrationTokenMultipleUses(t *testing.T) {
7070
validRegistrationToken := makeRegistrationToken()
7171
maxUses := 3
7272

73-
_, err := ctrl.NewRegistration(validRegistrationToken, "multiusedevice", "", "", maxUses, "")
73+
_, err := ctrl.NewRegistration(validRegistrationToken, "multiusedevice", "", "", maxUses, 0, "")
7474
if err != nil {
7575
t.Fatalf("failed to create registration token: %v", err)
7676
}
@@ -116,7 +116,7 @@ func TestRegistrationTokenWithGroups(t *testing.T) {
116116
validRegistrationToken := makeRegistrationToken()
117117
groups := []string{"group:nerds"}
118118

119-
result, err := ctrl.NewRegistration(validRegistrationToken, "groupeddevice", "", "", 1, "", groups...)
119+
result, err := ctrl.NewRegistration(validRegistrationToken, "groupeddevice", "", "", 1, 0, "", groups...)
120120
if err != nil {
121121
t.Fatalf("failed to create registration token with groups: %v", err)
122122
}
@@ -134,7 +134,7 @@ func TestRegistrationTokenWithGroups(t *testing.T) {
134134
func TestRegistrationTokenDelete(t *testing.T) {
135135
validRegistrationToken := makeRegistrationToken()
136136

137-
result, err := ctrl.NewRegistration(validRegistrationToken, "toaster2", "", "", 1, "")
137+
result, err := ctrl.NewRegistration(validRegistrationToken, "toaster2", "", "", 1, 0, "")
138138
if err != nil {
139139
t.Fatal("failed to create registration token: ", err)
140140
}
@@ -180,7 +180,7 @@ func TestInvalidTokenLength(t *testing.T) {
180180

181181
for _, tc := range testCases {
182182
t.Run(tc.name, func(t *testing.T) {
183-
resp, err := ctrl.NewRegistration(tc.token, "unnniiuquueee"+tc.name, "", "", 1, "")
183+
resp, err := ctrl.NewRegistration(tc.token, "unnniiuquueee"+tc.name, "", "", 1, 0, "")
184184
if err == nil {
185185
t.Fatal("expected failure to create token with invalid length: ", tc.name, resp)
186186
}
@@ -191,7 +191,7 @@ func TestInvalidTokenLength(t *testing.T) {
191191
func TestRegistrationTokenConcurrency(t *testing.T) {
192192
validRegistrationToken := makeRegistrationToken()
193193

194-
_, err := ctrl.NewRegistration(validRegistrationToken, "concurrentuser", "", "", 1, "")
194+
_, err := ctrl.NewRegistration(validRegistrationToken, "concurrentuser", "", "", 1, 0, "")
195195
if err != nil {
196196
t.Fatalf("failed to create registration token: %v", err)
197197
}
@@ -252,7 +252,7 @@ func TestRegistrationTokenSpecialCharacters(t *testing.T) {
252252
for token, expectError := range specialTokens {
253253
t.Run(fmt.Sprintf("token_%s", token), func(t *testing.T) {
254254
// Try to create token (may or may not be valid depending on your validation)
255-
_, err := ctrl.NewRegistration(token, "specialdevice", "", "", 1, "")
255+
_, err := ctrl.NewRegistration(token, "specialdevice", "", "", 1, 0, "")
256256
if expectError {
257257
if err == nil {
258258
t.Fatal("expected to get error from token creation: ", token, "but didnt")
@@ -282,13 +282,13 @@ func TestRegistrationTokenDuplicates(t *testing.T) {
282282
validRegistrationToken := makeRegistrationToken()
283283

284284
// Create first token
285-
_, err := ctrl.NewRegistration(validRegistrationToken, "device1", "", "", 1, "")
285+
_, err := ctrl.NewRegistration(validRegistrationToken, "device1", "", "", 1, 0, "")
286286
if err != nil {
287287
t.Fatalf("failed to create first registration token: %v", err)
288288
}
289289

290290
// Try to create duplicate token
291-
_, err = ctrl.NewRegistration(validRegistrationToken, "device2", "", "", 1, "")
291+
_, err = ctrl.NewRegistration(validRegistrationToken, "device2", "", "", 1, 0, "")
292292
if err == nil {
293293
t.Fatal("should not be able to create duplicate registration tokens")
294294
}
@@ -297,7 +297,7 @@ func TestRegistrationTokenDuplicates(t *testing.T) {
297297
func TestRegistrationTokenInvalidHTTPMethods(t *testing.T) {
298298
validRegistrationToken := makeRegistrationToken()
299299

300-
_, err := ctrl.NewRegistration(validRegistrationToken, "methodtestdevice", "", "", 1, "")
300+
_, err := ctrl.NewRegistration(validRegistrationToken, "methodtestdevice", "", "", 1, 0, "")
301301
if err != nil {
302302
t.Fatalf("failed to create registration token: %v", err)
303303
}

test/integration/users_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestApiUserCreation(t *testing.T) {
4242

4343
token := makeRegistrationToken()
4444

45-
_, err = ctrl.NewRegistration(token, username, "", "", 1, "")
45+
_, err = ctrl.NewRegistration(token, username, "", "", 1, 0, "")
4646
if err != nil {
4747
t.Fatal(err)
4848
}
@@ -71,7 +71,7 @@ func TestTokenUserCreation(t *testing.T) {
7171
const username = "unique_222222"
7272
token := makeRegistrationToken()
7373

74-
_, err := ctrl.NewRegistration(token, username, "", "", 1, "")
74+
_, err := ctrl.NewRegistration(token, username, "", "", 1, 0, "")
7575
if err != nil {
7676
t.Fatal(err)
7777
}

0 commit comments

Comments
 (0)