-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bring tests from unrelated PR into this project (#2013)
- Loading branch information
Showing
2 changed files
with
97 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
92 changes: 92 additions & 0 deletions
92
Octokit.Tests.Integration/Reactive/Enterprise/ObservableEnterpriseManagementConsoleTests.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,92 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Reactive.Linq; | ||
using System.Threading.Tasks; | ||
using Octokit.Reactive; | ||
using Octokit.Tests.Integration.Helpers; | ||
using Xunit; | ||
|
||
namespace Octokit.Tests.Integration | ||
{ | ||
public class ObservableEnterpriseManagementConsoleTests | ||
{ | ||
readonly IObservableGitHubClient _github; | ||
|
||
public ObservableEnterpriseManagementConsoleTests() | ||
{ | ||
_github = new ObservableGitHubClient(EnterpriseHelper.GetAuthenticatedClient()); | ||
} | ||
|
||
[GitHubEnterpriseManagementConsoleTest] | ||
public async Task CanGetMaintenanceMode() | ||
{ | ||
var maintenance = await _github.Enterprise.ManagementConsole.GetMaintenanceMode(EnterpriseHelper.ManagementConsolePassword); | ||
|
||
Assert.NotNull(maintenance); | ||
} | ||
|
||
[GitHubEnterpriseManagementConsoleTest] | ||
public async Task CanSetMaintenanceModeOff() | ||
{ | ||
using (_github.CreateMaintenanceModeContext(true)) | ||
{ | ||
// Set maintenance mode OFF now | ||
var maintenance = await | ||
_github.Enterprise.ManagementConsole.EditMaintenanceMode( | ||
new UpdateMaintenanceRequest(), | ||
EnterpriseHelper.ManagementConsolePassword); | ||
|
||
Assert.Equal(MaintenanceModeStatus.Off, maintenance.Status); | ||
} | ||
} | ||
|
||
[GitHubEnterpriseManagementConsoleTest] | ||
public async Task CanSetMaintenanceModeOnNow() | ||
{ | ||
using (_github.CreateMaintenanceModeContext(false)) | ||
{ | ||
// Set maintenance mode ON now | ||
var maintenance = await | ||
_github.Enterprise.ManagementConsole.EditMaintenanceMode( | ||
new UpdateMaintenanceRequest( | ||
new UpdateMaintenanceRequestDetails(true)), | ||
EnterpriseHelper.ManagementConsolePassword); | ||
|
||
Assert.Equal(MaintenanceModeStatus.On, maintenance.Status); | ||
} | ||
} | ||
|
||
[GitHubEnterpriseManagementConsoleTest] | ||
public async Task CanScheduleMaintenanceModeOnWithDateTime() | ||
{ | ||
using (_github.CreateMaintenanceModeContext(false)) | ||
{ | ||
// Schedule maintenance mode ON in 5 minutes | ||
var scheduledTime = DateTimeOffset.Now.AddMinutes(5); | ||
var maintenance = await | ||
_github.Enterprise.ManagementConsole.EditMaintenanceMode( | ||
new UpdateMaintenanceRequest( | ||
new UpdateMaintenanceRequestDetails(true, scheduledTime)), | ||
EnterpriseHelper.ManagementConsolePassword); | ||
|
||
Assert.Equal(MaintenanceModeStatus.Scheduled, maintenance.Status); | ||
} | ||
} | ||
|
||
[GitHubEnterpriseManagementConsoleTest] | ||
public async Task CanScheduleMaintenanceModeOnWithPhrase() | ||
{ | ||
using (_github.CreateMaintenanceModeContext(false)) | ||
{ | ||
// Schedule maintenance mode ON with phrase | ||
var maintenance = await | ||
_github.Enterprise.ManagementConsole.EditMaintenanceMode( | ||
new UpdateMaintenanceRequest( | ||
new UpdateMaintenanceRequestDetails(true, "tomorrow at 5pm")), | ||
EnterpriseHelper.ManagementConsolePassword); | ||
|
||
Assert.Equal(MaintenanceModeStatus.Scheduled, maintenance.Status); | ||
} | ||
} | ||
} | ||
} |