Skip to content

Commit

Permalink
Merge bc2387a into 847c716
Browse files Browse the repository at this point in the history
  • Loading branch information
grundleborg committed Mar 6, 2017
2 parents 847c716 + bc2387a commit f9123d8
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions app/import_test.go
Expand Up @@ -294,7 +294,21 @@ func TestImportValidateUserImportData(t *testing.T) {

data.Email = ptrStr("bob@example.com")

// TODO: Auth Service and Auth Data.
data.AuthService = ptrStr("")
if err := validateUserImportData(&data); err == nil {
t.Fatal("Validation should have failed due to 0-length auth service.")
}

data.AuthService = ptrStr("saml")
data.AuthData = ptrStr(strings.Repeat("abcdefghij", 15))
if err := validateUserImportData(&data); err == nil {
t.Fatal("Validation should have failed due to too long auth data.")
}

data.AuthData = ptrStr("bobbytables")
if err := validateUserImportData(&data); err != nil {
t.Fatal("Validation should have succeeded with valid auth service and auth data.")
}

// Test a valid User with all fields populated.
data = UserImportData{
Expand Down Expand Up @@ -571,7 +585,7 @@ func TestImportImportTeam(t *testing.T) {
data := TeamImportData{
Name: ptrStr(model.NewId()),
DisplayName: ptrStr("Display Name"),
Type: ptrStr("XXX"),
Type: ptrStr("XYZ"),
Description: ptrStr("The team description."),
AllowOpenInvite: ptrBool(true),
}
Expand All @@ -597,7 +611,7 @@ func TestImportImportTeam(t *testing.T) {
}

// Do an invalid team in apply mode, check db changes.
data.Type = ptrStr("XXX")
data.Type = ptrStr("XYZ")
if err := ImportTeam(&data, false); err == nil {
t.Fatalf("Import should have failed on invalid team.")
}
Expand Down

0 comments on commit f9123d8

Please sign in to comment.