-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from open-networks/develop
Fixes #18: add unit tests for `User.go`: func `UpdateUser`
- Loading branch information
Showing
4 changed files
with
91 additions
and
0 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,12 @@ | ||
package msgraph | ||
|
||
import "testing" | ||
|
||
func TestGroups_String(t *testing.T) { | ||
testGroup := GetTestGroup(t) | ||
groups := Groups{testGroup} | ||
wanted := "Groups(" + testGroup.String() + ")" | ||
if wanted != groups.String() { | ||
t.Errorf("Groups.String() result: %v, wanted: %v", testGroup, wanted) | ||
} | ||
} |
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,36 @@ | ||
package msgraph | ||
|
||
import ( | ||
"math/rand" | ||
"testing" | ||
) | ||
|
||
func Test_supportedTimeZones_GetTimeZoneByAlias(t *testing.T) { | ||
testuser := GetTestUser(t) | ||
timezones, _ := testuser.getTimeZoneChoices(compileGetQueryOptions(nil)) | ||
|
||
randomTimezone := timezones.Value[rand.Intn(len(timezones.Value))] | ||
_, err := timezones.GetTimeZoneByAlias(randomTimezone.Alias) | ||
if err != nil { | ||
t.Errorf("Cannot get timeZone with Alias %v, err: %v", randomTimezone.Alias, err) | ||
} | ||
_, err = timezones.GetTimeZoneByAlias("This is a non existing timezone") | ||
if err == nil { | ||
t.Errorf("Tried to get a non existing timezone, expected an error, but got nil") | ||
} | ||
} | ||
|
||
func Test_supportedTimeZones_GetTimeZoneByDisplayName(t *testing.T) { | ||
testuser := GetTestUser(t) | ||
timezones, _ := testuser.getTimeZoneChoices(compileGetQueryOptions(nil)) | ||
|
||
randomTimezone := timezones.Value[rand.Intn(len(timezones.Value))] | ||
_, err := timezones.GetTimeZoneByDisplayName(randomTimezone.DisplayName) | ||
if err != nil { | ||
t.Errorf("Cannot get timeZone with DisplayName %v, err: %v", randomTimezone.DisplayName, err) | ||
} | ||
_, err = timezones.GetTimeZoneByDisplayName("This is a non existing timezone") | ||
if err == nil { | ||
t.Errorf("Tried to get a non existing timezone, expected an error, but got nil") | ||
} | ||
} |