Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add create organization invitation via email (#2895)
* Add API request to create org invitation * Add tests for create org invitation * Add IObservable API request to create org invitation * Add tests for IObservable create org invitation
- Loading branch information
1 parent
d27d1f0
commit 41d5d24
Showing
13 changed files
with
464 additions
and
3 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
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
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,15 @@ | ||
using System; | ||
|
||
namespace Octokit.Tests.Helpers | ||
{ | ||
public static class RandomEmailGenerator | ||
{ | ||
public static string GenerateRandomEmail() | ||
{ | ||
var randomUsername = Guid.NewGuid().ToString(); | ||
var randomDomain = Guid.NewGuid().ToString(); | ||
|
||
return $"{randomUsername}@{randomDomain}.com"; | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
Octokit.Tests/Models/OrganizationInvitationRequestTests.cs
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,35 @@ | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace Octokit.Tests.Models | ||
{ | ||
public class OrganizationInvitationRequestTests | ||
{ | ||
public class TheConstructor | ||
{ | ||
[Fact] | ||
public void CreatesOrganizationInvitationRequestByUserId() | ||
{ | ||
const int userId = 1; | ||
var organizationInvitationRequest = new OrganizationInvitationRequest(userId); | ||
|
||
Assert.Equal(userId, organizationInvitationRequest.InviteeId); | ||
Assert.Equal(OrganizationMembershipRole.DirectMember, organizationInvitationRequest.Role); | ||
Assert.Null(organizationInvitationRequest.Email); | ||
Assert.Null(organizationInvitationRequest.TeamIds); | ||
} | ||
|
||
[Fact] | ||
public async Task CreatesOrganizationInvitationRequestByUserEmail() | ||
{ | ||
const string email = "testemail"; | ||
var organizationInvitationRequest = new OrganizationInvitationRequest(email); | ||
|
||
Assert.Equal(email, organizationInvitationRequest.Email); | ||
Assert.Equal(OrganizationMembershipRole.DirectMember, organizationInvitationRequest.Role); | ||
Assert.Null(organizationInvitationRequest.InviteeId); | ||
Assert.Null(organizationInvitationRequest.TeamIds); | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.