Skip to content

Commit 3c8b545

Browse files
committed
fix(test): append suffix to usernames and group names in manual creation and signup tests
1 parent 5d42111 commit 3c8b545

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

infra/test_script/user-registration/manual_creation_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@ import (
1616
func TestManualUserCreation(t *testing.T) {
1717
client := &http.Client{}
1818
accessToken := helpers.LoginAsRoot(t, client, helpers.GetHost())
19+
suffix := "3424"
1920
group := helpers.CreateGroup(
2021
t,
2122
client,
2223
helpers.GetHost(),
2324
accessToken,
24-
"engineering-user",
25+
"engineering-user-"+suffix,
2526
"Engineering Team for manual creation test",
2627
)
2728

2829
// Step 2: Create a user with a generated password
29-
username := "bob"
30+
username := "bob-" + suffix
3031
name := "Bob Marley"
3132
initialPassword := "bobpass"
3233
role := "member"

infra/test_script/user-registration/signup_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,21 @@ import (
1616
func TestSignupAndViewApplication(t *testing.T) {
1717
client := &http.Client{}
1818
accessToken := helpers.LoginAsRoot(t, client, helpers.GetHost())
19+
suffix := "8687"
1920
group := helpers.CreateGroup(
2021
t,
2122
client,
2223
helpers.GetHost(),
2324
accessToken,
24-
"engineering-signup",
25+
"engineering-signup-"+suffix,
2526
"Engineering Team for signup test",
2627
)
2728

2829
var applicationID string
2930

3031
t.Run("signup", func(t *testing.T) {
3132
signupReq := map[string]interface{}{
32-
"username": "alice",
33+
"username": "alice-" + suffix,
3334
"name": "Alice Smith",
3435
"password": "alicepass",
3536
"confirm_password": "alicepass",
@@ -83,7 +84,7 @@ func TestSignupAndViewApplication(t *testing.T) {
8384
err = json.Unmarshal(bodyBytes, &appDetail)
8485
require.NoError(t, err, "failed to decode signup app detail: %s", string(bodyBytes))
8586
require.Equal(t, applicationID, appDetail.Data.Application.ID)
86-
require.Equal(t, "alice", appDetail.Data.User.Username)
87+
require.Equal(t, "alice-"+suffix, appDetail.Data.User.Username)
8788
require.Equal(t, "Alice Smith", appDetail.Data.User.Name)
8889
aliceID = appDetail.Data.User.ID
8990
})
@@ -139,7 +140,7 @@ func TestSignupAndViewApplication(t *testing.T) {
139140
err = json.Unmarshal(body, &detailResp)
140141
require.NoError(t, err, "failed to decode ticket detail: %s", string(body))
141142
require.Equal(t, applicationID, detailResp.Data.Ticket.ID)
142-
require.Equal(t, "alice", detailResp.Data.Applicant.Username)
143+
require.Equal(t, "alice-"+suffix, detailResp.Data.Applicant.Username)
143144
require.Equal(t, "Alice Smith", detailResp.Data.Applicant.Name)
144145
})
145146

@@ -168,7 +169,7 @@ func TestSignupAndViewApplication(t *testing.T) {
168169
})
169170

170171
t.Run("user can login after approval", func(t *testing.T) {
171-
loginResp, _ := helpers.LoginUser(t, client, "alice", "alicepass")
172+
loginResp, _ := helpers.LoginUser(t, client, "alice-"+suffix, "alicepass")
172173
defer loginResp.Body.Close()
173174
if !assert.Equal(t, http.StatusOK, loginResp.StatusCode) {
174175
body, _ := io.ReadAll(loginResp.Body)

0 commit comments

Comments
 (0)