-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add role reponse to profile * remove nullable reference
- Loading branch information
1 parent
1661934
commit 5ae11ef
Showing
3 changed files
with
28 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,16 @@ | ||
namespace WorkOS | ||
{ | ||
using Newtonsoft.Json; | ||
|
||
/// <summary> | ||
/// Represents a user's role. | ||
/// </summary> | ||
public class RoleResponse | ||
{ | ||
/// <summary> | ||
/// The slug identifier for the role. | ||
/// </summary> | ||
[JsonProperty("slug")] | ||
public string Slug { get; set; } | ||
} | ||
} |
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 |
---|---|---|
|
@@ -205,6 +205,7 @@ public async void TestGetProfileAndToken() | |
Email = "[email protected]", | ||
FirstName = "Rick", | ||
LastName = "Sanchez", | ||
Role = new RoleResponse { Slug = "admin" }, | ||
Groups = new List<string>() | ||
{ | ||
"Admins", | ||
|
@@ -243,6 +244,8 @@ public async void TestGetProfileAndToken() | |
Assert.Equal( | ||
JsonConvert.SerializeObject(mockProfile), | ||
JsonConvert.SerializeObject(profile)); | ||
Assert.NotNull(profile.Role); | ||
Assert.Equal("admin", profile.Role.Slug); | ||
} | ||
|
||
[Fact] | ||
|
@@ -258,6 +261,7 @@ public async void TestGetProfile() | |
Email = "[email protected]", | ||
FirstName = "Rick", | ||
LastName = "Sanchez", | ||
Role = new RoleResponse { Slug = "admin" }, | ||
Groups = new List<string>() | ||
{ | ||
"Admins", | ||
|
@@ -287,6 +291,8 @@ public async void TestGetProfile() | |
|
||
this.httpMock.AssertRequestWasMade(HttpMethod.Get, "/sso/profile"); | ||
this.httpMock.AssertAuthorizationBearerHeader("access_token"); | ||
Assert.NotNull(profile.Role); | ||
Assert.Equal("admin", profile.Role.Slug); | ||
} | ||
|
||
[Fact] | ||
|