diff --git a/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseClient.cs b/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseClient.cs
index 4a494899ca..72e2d25efe 100644
--- a/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseClient.cs
+++ b/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseClient.cs
@@ -15,5 +15,21 @@ public interface IObservableEnterpriseClient
/// See the Enterprise Admin Stats API documentation for more information.
///
IObservableEnterpriseAdminStatsClient AdminStats { get; }
+
+ ///
+ /// A client for GitHub's Enterprise License API
+ ///
+ ///
+ /// See the Enterprise License API documentation for more information.
+ ///
+ IObservableEnterpriseLicenseClient License { get; }
+
+ ///
+ /// A client for GitHub's Enterprise Organization API
+ ///
+ ///
+ /// See the Enterprise Organization API documentation for more information.
+ ///
+ IObservableEnterpriseOrganizationClient Organization { get; }
}
}
diff --git a/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseLicenseClient.cs b/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseLicenseClient.cs
new file mode 100644
index 0000000000..7ec56f1b11
--- /dev/null
+++ b/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseLicenseClient.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Reactive.Threading.Tasks;
+
+namespace Octokit.Reactive
+{
+ ///
+ /// A client for GitHub's Enterprise License API
+ ///
+ ///
+ /// See the Enterprise License API documentation for more information.
+ ///
+ public interface IObservableEnterpriseLicenseClient
+ {
+ ///
+ /// Gets GitHub Enterprise License Information (must be Site Admin user).
+ ///
+ ///
+ /// https://developer.github.com/v3/enterprise/license/#get-license-information
+ ///
+ /// The statistics.
+ [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get")]
+ IObservable Get();
+ }
+}
diff --git a/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseOrganizationClient.cs b/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseOrganizationClient.cs
new file mode 100644
index 0000000000..38f744f1c5
--- /dev/null
+++ b/Octokit.Reactive/Clients/Enterprise/IObservableEnterpriseOrganizationClient.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Reactive.Threading.Tasks;
+
+namespace Octokit.Reactive
+{
+ ///
+ /// A client for GitHub's Enterprise Organization API
+ ///
+ ///
+ /// See the Enterprise Organization API documentation for more information.
+ ///
+ public interface IObservableEnterpriseOrganizationClient
+ {
+ ///
+ /// Creates an Organization on a GitHub Enterprise appliance (must be Site Admin user).
+ ///
+ ///
+ /// https://developer.github.com/v3/enterprise/orgs/#create-an-organization
+ ///
+ /// A instance describing the organization to be created
+ /// The created.
+ IObservable Create(NewOrganization newOrganization);
+ }
+}
diff --git a/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseClient.cs b/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseClient.cs
index 8466e9b85a..7a52afcd5b 100644
--- a/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseClient.cs
+++ b/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseClient.cs
@@ -13,6 +13,8 @@ public ObservableEnterpriseClient(IGitHubClient client)
Ensure.ArgumentNotNull(client, "client");
AdminStats = new ObservableEnterpriseAdminStatsClient(client);
+ License = new ObservableEnterpriseLicenseClient(client);
+ Organization = new ObservableEnterpriseOrganizationClient(client);
}
///
@@ -22,5 +24,21 @@ public ObservableEnterpriseClient(IGitHubClient client)
/// See the Enterprise Admin Stats API documentation for more information.
///
public IObservableEnterpriseAdminStatsClient AdminStats { get; private set; }
+
+ ///
+ /// A client for GitHub's Enterprise License API
+ ///
+ ///
+ /// See the Enterprise License API documentation for more information.
+ ///
+ public IObservableEnterpriseLicenseClient License { get; private set; }
+
+ ///
+ /// A client for GitHub's Enterprise Organization API
+ ///
+ ///
+ /// See the Enterprise Organization API documentation for more information.
+ ///
+ public IObservableEnterpriseOrganizationClient Organization { get; private set; }
}
}
diff --git a/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseLicenseClient.cs b/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseLicenseClient.cs
new file mode 100644
index 0000000000..bf85248392
--- /dev/null
+++ b/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseLicenseClient.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Reactive.Threading.Tasks;
+using Octokit;
+
+
+namespace Octokit.Reactive
+{
+ ///
+ /// A client for GitHub's Enterprise License API
+ ///
+ ///
+ /// See the Enterprise License API documentation for more information.
+ ///
+ public class ObservableEnterpriseLicenseClient : IObservableEnterpriseLicenseClient
+ {
+ readonly IEnterpriseLicenseClient _client;
+
+ public ObservableEnterpriseLicenseClient(IGitHubClient client)
+ {
+ Ensure.ArgumentNotNull(client, "client");
+
+ _client = client.Enterprise.License;
+ }
+
+ ///
+ /// Gets GitHub Enterprise License Information (must be Site Admin user).
+ ///
+ ///
+ /// https://developer.github.com/v3/enterprise/license/#get-license-information
+ ///
+ /// The statistics.
+ public IObservable Get()
+ {
+ return _client.Get().ToObservable();
+ }
+ }
+}
diff --git a/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseOrganizationClient.cs b/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseOrganizationClient.cs
new file mode 100644
index 0000000000..1f78574c2b
--- /dev/null
+++ b/Octokit.Reactive/Clients/Enterprise/ObservableEnterpriseOrganizationClient.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Reactive.Threading.Tasks;
+using Octokit;
+
+
+namespace Octokit.Reactive
+{
+ ///
+ /// A client for GitHub's Enterprise Organization API
+ ///
+ ///
+ /// See the Enterprise Organization API documentation for more information.
+ ///
+ public class ObservableEnterpriseOrganizationClient : IObservableEnterpriseOrganizationClient
+ {
+ readonly IEnterpriseOrganizationClient _client;
+
+ public ObservableEnterpriseOrganizationClient(IGitHubClient client)
+ {
+ Ensure.ArgumentNotNull(client, "client");
+
+ _client = client.Enterprise.Organization;
+ }
+
+ ///
+ /// Creates an Organization on a GitHub Enterprise appliance (must be Site Admin user).
+ ///
+ ///
+ /// https://developer.github.com/v3/enterprise/orgs/#create-an-organization
+ ///
+ /// A instance describing the organization to be created
+ /// The created.
+ public IObservable Create(NewOrganization newOrganization)
+ {
+ return _client.Create(newOrganization).ToObservable();
+ }
+ }
+}
diff --git a/Octokit.Reactive/Octokit.Reactive-Mono.csproj b/Octokit.Reactive/Octokit.Reactive-Mono.csproj
index 8ca3abddd0..3c0f28aa59 100644
--- a/Octokit.Reactive/Octokit.Reactive-Mono.csproj
+++ b/Octokit.Reactive/Octokit.Reactive-Mono.csproj
@@ -163,6 +163,10 @@
+
+
+
+
diff --git a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj
index ad9522c1c9..a808ba9188 100644
--- a/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj
+++ b/Octokit.Reactive/Octokit.Reactive-MonoAndroid.csproj
@@ -171,6 +171,10 @@
+
+
+
+
diff --git a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj
index 21f480080e..616d3ad0d3 100644
--- a/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj
+++ b/Octokit.Reactive/Octokit.Reactive-Monotouch.csproj
@@ -167,6 +167,10 @@
+
+
+
+
diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj
index 618f9d2610..0841fbb46e 100644
--- a/Octokit.Reactive/Octokit.Reactive.csproj
+++ b/Octokit.Reactive/Octokit.Reactive.csproj
@@ -75,10 +75,14 @@
Properties\SolutionInfo.cs
+
+
+
+
diff --git a/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseAdminStatsClientTests.cs b/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseAdminStatsClientTests.cs
index 12dc638ae9..2c8b1cf6d9 100644
--- a/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseAdminStatsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseAdminStatsClientTests.cs
@@ -9,7 +9,7 @@ public class EnterpriseAdminStatsClientTests
public EnterpriseAdminStatsClientTests()
{
- _github = Helper.GetAuthenticatedClient();
+ _github = EnterpriseHelper.GetAuthenticatedClient();
}
[GitHubEnterpriseTest]
diff --git a/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseLicenseClientTests.cs b/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseLicenseClientTests.cs
new file mode 100644
index 0000000000..81cd97b4f7
--- /dev/null
+++ b/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseLicenseClientTests.cs
@@ -0,0 +1,23 @@
+using System.Threading.Tasks;
+using Octokit;
+using Octokit.Tests.Integration;
+using Xunit;
+
+public class EnterpriseLicenseClientTests
+{
+ readonly IGitHubClient _github;
+
+ public EnterpriseLicenseClientTests()
+ {
+ _github = EnterpriseHelper.GetAuthenticatedClient();
+ }
+
+ [GitHubEnterpriseTest]
+ public async Task CanGetLicense()
+ {
+ var licenseInfo = await
+ _github.Enterprise.License.Get();
+
+ Assert.NotNull(licenseInfo);
+ }
+}
\ No newline at end of file
diff --git a/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseOrganizationClientTests.cs b/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseOrganizationClientTests.cs
new file mode 100644
index 0000000000..ce77ae3b46
--- /dev/null
+++ b/Octokit.Tests.Integration/Clients/Enterprise/EnterpriseOrganizationClientTests.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Linq;
+using System.Threading.Tasks;
+using Octokit;
+using Octokit.Tests.Integration;
+using Xunit;
+
+public class EnterpriseOrganizationClientTests
+{
+ readonly IGitHubClient _github;
+
+ public EnterpriseOrganizationClientTests()
+ {
+ _github = EnterpriseHelper.GetAuthenticatedClient();
+ }
+
+ [GitHubEnterpriseTest]
+ public async Task CanCreateOrganization()
+ {
+ string orgLogin = Helper.MakeNameWithTimestamp("MyOrganization");
+ string orgName = String.Concat(orgLogin, " Display Name");
+
+ var newOrganization = new NewOrganization(orgLogin, EnterpriseHelper.UserName, orgName);
+ var organization = await
+ _github.Enterprise.Organization.Create(newOrganization);
+
+ Assert.NotNull(organization);
+
+ // Get organization and check login/name
+ var checkOrg = await _github.Organization.Get(orgLogin);
+ Assert.Equal(checkOrg.Login, orgLogin);
+ Assert.Equal(checkOrg.Name, orgName);
+ }
+}
diff --git a/Octokit.Tests.Integration/EnterpriseHelper.cs b/Octokit.Tests.Integration/EnterpriseHelper.cs
new file mode 100644
index 0000000000..9a1ab54e06
--- /dev/null
+++ b/Octokit.Tests.Integration/EnterpriseHelper.cs
@@ -0,0 +1,164 @@
+using System;
+using System.Diagnostics;
+using System.IO;
+
+namespace Octokit.Tests.Integration
+{
+ public static class EnterpriseHelper
+ {
+ static readonly Lazy _credentialsThunk = new Lazy(() =>
+ {
+ var githubUsername = Environment.GetEnvironmentVariable("OCTOKIT_GHE_USERNAME");
+ UserName = githubUsername;
+ Organization = Environment.GetEnvironmentVariable("OCTOKIT_GHE_ORGANIZATION");
+
+ var githubToken = Environment.GetEnvironmentVariable("OCTOKIT_GHE_OAUTHTOKEN");
+
+ if (githubToken != null)
+ return new Credentials(githubToken);
+
+ var githubPassword = Environment.GetEnvironmentVariable("OCTOKIT_GHE_PASSWORD");
+
+ if (githubUsername == null || githubPassword == null)
+ return null;
+
+ return new Credentials(githubUsername, githubPassword);
+ });
+
+ static readonly Lazy _oauthApplicationCredentials = new Lazy(() =>
+ {
+ var applicationClientId = ClientId;
+ var applicationClientSecret = ClientSecret;
+
+ if (applicationClientId == null || applicationClientSecret == null)
+ return null;
+
+ return new Credentials(applicationClientId, applicationClientSecret);
+ });
+
+ static readonly Lazy _basicAuthCredentials = new Lazy(() =>
+ {
+ var githubUsername = Environment.GetEnvironmentVariable("OCTOKIT_GHE_USERNAME");
+ UserName = githubUsername;
+ Organization = Environment.GetEnvironmentVariable("OCTOKIT_GHE_ORGANIZATION");
+
+ var githubPassword = Environment.GetEnvironmentVariable("OCTOKIT_GHE_PASSWORD");
+
+ if (githubUsername == null || githubPassword == null)
+ return null;
+
+ return new Credentials(githubUsername, githubPassword);
+ });
+
+ static readonly Lazy _gitHubEnterpriseEnabled = new Lazy(() =>
+ {
+ string enabled = Environment.GetEnvironmentVariable("OCTOKIT_GHE_ENABLED");
+ return !String.IsNullOrWhiteSpace(enabled);
+ });
+
+ static readonly Lazy _gitHubEnterpriseUrl = new Lazy(() =>
+ {
+ string uri = Environment.GetEnvironmentVariable("OCTOKIT_GHE_URL");
+
+ if (uri != null)
+ return new Uri(uri);
+
+ return null;
+ });
+
+ static EnterpriseHelper()
+ {
+ // Force reading of environment variables.
+ // This wasn't happening if UserName/Organization were
+ // retrieved before Credentials.
+ Debug.WriteIf(Credentials == null, "No credentials specified.");
+ }
+
+ public static string UserName { get; private set; }
+ public static string Organization { get; private set; }
+
+ ///
+ /// These credentials should be set to a test GitHub account using the powershell script configure-integration-tests.ps1
+ ///
+ public static Credentials Credentials { get { return _credentialsThunk.Value; } }
+
+ public static Credentials ApplicationCredentials { get { return _oauthApplicationCredentials.Value; } }
+
+ public static Credentials BasicAuthCredentials { get { return _basicAuthCredentials.Value; } }
+
+ public static bool IsGitHubEnterpriseEnabled { get { return _gitHubEnterpriseEnabled.Value; } }
+
+ public static Uri GitHubEnterpriseUrl { get { return _gitHubEnterpriseUrl.Value; } }
+
+ public static bool IsUsingToken
+ {
+ get
+ {
+ return !String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("OCTOKIT_GHE_OAUTHTOKEN"));
+ }
+ }
+
+ public static string ClientId
+ {
+ get { return Environment.GetEnvironmentVariable("OCTOKIT_GHE_CLIENTID"); }
+ }
+
+ public static string ClientSecret
+ {
+ get { return Environment.GetEnvironmentVariable("OCTOKIT_GHE_CLIENTSECRET"); }
+ }
+
+ public static void DeleteRepo(Repository repository)
+ {
+ if (repository != null)
+ DeleteRepo(repository.Owner.Login, repository.Name);
+ }
+
+ public static void DeleteRepo(string owner, string name)
+ {
+ var api = GetAuthenticatedClient();
+ try
+ {
+ api.Repository.Delete(owner, name).Wait(TimeSpan.FromSeconds(15));
+ }
+ catch { }
+ }
+
+ public static IGitHubClient GetAuthenticatedClient()
+ {
+ return new GitHubClient(new ProductHeaderValue("OctokitEnterpriseTests"), GitHubEnterpriseUrl)
+ {
+ Credentials = Credentials
+ };
+ }
+
+ public static IGitHubClient GetBasicAuthClient()
+ {
+ return new GitHubClient(new ProductHeaderValue("OctokitEnterpriseTests"), GitHubEnterpriseUrl)
+ {
+ Credentials = BasicAuthCredentials
+ };
+ }
+
+ public static GitHubClient GetAuthenticatedApplicationClient()
+ {
+ return new GitHubClient(new ProductHeaderValue("OctokitEnterpriseTests"), GitHubEnterpriseUrl)
+ {
+ Credentials = ApplicationCredentials
+ };
+ }
+
+ public static IGitHubClient GetAnonymousClient()
+ {
+ return new GitHubClient(new ProductHeaderValue("OctokitEnterpriseTests"), GitHubEnterpriseUrl);
+ }
+
+ public static IGitHubClient GetBadCredentialsClient()
+ {
+ return new GitHubClient(new ProductHeaderValue("OctokitEnterpriseTests"), GitHubEnterpriseUrl)
+ {
+ Credentials = new Credentials(Guid.NewGuid().ToString(), "bad-password")
+ };
+ }
+ }
+}
diff --git a/Octokit.Tests.Integration/Helper.cs b/Octokit.Tests.Integration/Helper.cs
index a2dd8065cb..efef287f69 100644
--- a/Octokit.Tests.Integration/Helper.cs
+++ b/Octokit.Tests.Integration/Helper.cs
@@ -50,9 +50,9 @@ public static class Helper
return new Credentials(githubUsername, githubPassword);
});
- static readonly Lazy _gitHubEnterpriseUrl = new Lazy(() =>
+ static readonly Lazy _customUrl = new Lazy(() =>
{
- string uri = Environment.GetEnvironmentVariable("OCTOKIT_GITHUBENTERPRISEURL");
+ string uri = Environment.GetEnvironmentVariable("OCTOKIT_CUSTOMURL");
if (uri != null)
return new Uri(uri);
@@ -80,7 +80,9 @@ static Helper()
public static Credentials BasicAuthCredentials { get { return _basicAuthCredentials.Value; } }
- public static Uri GitHubEnterpriseUrl { get { return _gitHubEnterpriseUrl.Value; } }
+ public static Uri CustomUrl { get { return _customUrl.Value; } }
+
+ public static Uri TargetUrl { get { return CustomUrl ?? GitHubClient.GitHubApiUrl; } }
public static bool IsUsingToken
{
@@ -98,14 +100,6 @@ public static bool IsPaidAccount
}
}
- public static bool IsGitHubEnterprise
- {
- get
- {
- return GitHubEnterpriseUrl != null;
- }
- }
-
public static string ClientId
{
get { return Environment.GetEnvironmentVariable("OCTOKIT_CLIENTID"); }
@@ -151,7 +145,7 @@ public static Stream LoadFixture(string fileName)
public static IGitHubClient GetAuthenticatedClient()
{
- return new GitHubClient(new ProductHeaderValue("OctokitTests"), GitHubEnterpriseUrl ?? GitHubClient.GitHubApiUrl)
+ return new GitHubClient(new ProductHeaderValue("OctokitTests"), TargetUrl)
{
Credentials = Credentials
};
@@ -159,7 +153,7 @@ public static IGitHubClient GetAuthenticatedClient()
public static IGitHubClient GetBasicAuthClient()
{
- return new GitHubClient(new ProductHeaderValue("OctokitTests"), GitHubEnterpriseUrl ?? GitHubClient.GitHubApiUrl)
+ return new GitHubClient(new ProductHeaderValue("OctokitTests"), TargetUrl)
{
Credentials = BasicAuthCredentials
};
@@ -167,7 +161,7 @@ public static IGitHubClient GetBasicAuthClient()
public static GitHubClient GetAuthenticatedApplicationClient()
{
- return new GitHubClient(new ProductHeaderValue("OctokitTests"), GitHubEnterpriseUrl ?? GitHubClient.GitHubApiUrl)
+ return new GitHubClient(new ProductHeaderValue("OctokitTests"), TargetUrl)
{
Credentials = ApplicationCredentials
};
@@ -175,12 +169,12 @@ public static GitHubClient GetAuthenticatedApplicationClient()
public static IGitHubClient GetAnonymousClient()
{
- return new GitHubClient(new ProductHeaderValue("OctokitTests"), GitHubEnterpriseUrl ?? GitHubClient.GitHubApiUrl);
+ return new GitHubClient(new ProductHeaderValue("OctokitTests"), TargetUrl);
}
public static IGitHubClient GetBadCredentialsClient()
{
- return new GitHubClient(new ProductHeaderValue("OctokitTests"), GitHubEnterpriseUrl ?? GitHubClient.GitHubApiUrl)
+ return new GitHubClient(new ProductHeaderValue("OctokitTests"), TargetUrl)
{
Credentials = new Credentials(Guid.NewGuid().ToString(), "bad-password")
};
diff --git a/Octokit.Tests.Integration/Helpers/GitHubEnterpriseTestAttribute.cs b/Octokit.Tests.Integration/Helpers/GitHubEnterpriseTestAttribute.cs
index 80c1df66c2..938bfb4641 100644
--- a/Octokit.Tests.Integration/Helpers/GitHubEnterpriseTestAttribute.cs
+++ b/Octokit.Tests.Integration/Helpers/GitHubEnterpriseTestAttribute.cs
@@ -20,7 +20,7 @@ public IEnumerable Discover(ITestFrameworkDiscoveryOptions disco
if (Helper.Credentials == null)
return Enumerable.Empty();
- if (!Helper.IsGitHubEnterprise)
+ if (!EnterpriseHelper.IsGitHubEnterpriseEnabled)
return Enumerable.Empty();
return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod) };
diff --git a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
index 3cbb946201..7781ebbcaf 100644
--- a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
+++ b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
@@ -77,7 +77,9 @@
+
+
@@ -106,6 +108,7 @@
+
@@ -122,6 +125,8 @@
+
+
diff --git a/Octokit.Tests.Integration/Reactive/Enterprise/ObservableEnterpriseAdminStatsClientTests.cs b/Octokit.Tests.Integration/Reactive/Enterprise/ObservableEnterpriseAdminStatsClientTests.cs
index 2cb61234c0..182ad393fd 100644
--- a/Octokit.Tests.Integration/Reactive/Enterprise/ObservableEnterpriseAdminStatsClientTests.cs
+++ b/Octokit.Tests.Integration/Reactive/Enterprise/ObservableEnterpriseAdminStatsClientTests.cs
@@ -11,7 +11,7 @@ public class ObservableEnterpriseAdminStatsClientTests
public ObservableEnterpriseAdminStatsClientTests()
{
- _github = new ObservableGitHubClient(Helper.GetAuthenticatedClient());
+ _github = new ObservableGitHubClient(EnterpriseHelper.GetAuthenticatedClient());
}
[GitHubEnterpriseTest]
diff --git a/Octokit.Tests.Integration/Reactive/Enterprise/ObservableEnterpriseLicenseClientTests.cs b/Octokit.Tests.Integration/Reactive/Enterprise/ObservableEnterpriseLicenseClientTests.cs
new file mode 100644
index 0000000000..0c35fb5df5
--- /dev/null
+++ b/Octokit.Tests.Integration/Reactive/Enterprise/ObservableEnterpriseLicenseClientTests.cs
@@ -0,0 +1,26 @@
+using System.Reactive.Linq;
+using System.Threading.Tasks;
+using Octokit.Reactive;
+using Xunit;
+
+namespace Octokit.Tests.Integration
+{
+ public class ObservableEnterpriseLicenseClientTests
+ {
+ readonly IObservableGitHubClient _github;
+
+ public ObservableEnterpriseLicenseClientTests()
+ {
+ _github = new ObservableGitHubClient(EnterpriseHelper.GetAuthenticatedClient());
+ }
+
+ [GitHubEnterpriseTest]
+ public async Task CanGet()
+ {
+ var observable = _github.Enterprise.License.Get();
+ var licenseInfo = await observable;
+
+ Assert.NotNull(licenseInfo);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Octokit.Tests.Integration/Reactive/Enterprise/ObservableEnterpriseOrganizationClientTests.cs b/Octokit.Tests.Integration/Reactive/Enterprise/ObservableEnterpriseOrganizationClientTests.cs
new file mode 100644
index 0000000000..28997bada0
--- /dev/null
+++ b/Octokit.Tests.Integration/Reactive/Enterprise/ObservableEnterpriseOrganizationClientTests.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Reactive.Linq;
+using System.Threading.Tasks;
+using Octokit.Reactive;
+using Xunit;
+
+namespace Octokit.Tests.Integration
+{
+ public class ObservableEnterpriseOrganizationClientTests
+ {
+ readonly IObservableGitHubClient _github;
+
+ public ObservableEnterpriseOrganizationClientTests()
+ {
+ _github = new ObservableGitHubClient(EnterpriseHelper.GetAuthenticatedClient());
+ }
+
+ [GitHubEnterpriseTest]
+ public async Task CanCreateOrganization()
+ {
+ string orgLogin = Helper.MakeNameWithTimestamp("MyOrganization");
+ string orgName = String.Concat(orgLogin, " Display Name");
+
+ var newOrganization = new NewOrganization(orgLogin, EnterpriseHelper.UserName, orgName);
+ var observable = _github.Enterprise.Organization.Create(newOrganization);
+ var organization = await observable;
+
+ Assert.NotNull(organization);
+
+ // Get organization and check login/name
+ var checkOrg = await _github.Organization.Get(orgLogin);
+ Assert.Equal(checkOrg.Login, orgLogin);
+ Assert.Equal(checkOrg.Name, orgName);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Octokit.Tests/Clients/Enterprise/EnterpriseLicenseClientTests.cs b/Octokit.Tests/Clients/Enterprise/EnterpriseLicenseClientTests.cs
new file mode 100644
index 0000000000..947fa4a23b
--- /dev/null
+++ b/Octokit.Tests/Clients/Enterprise/EnterpriseLicenseClientTests.cs
@@ -0,0 +1,23 @@
+using System;
+using NSubstitute;
+using Xunit;
+
+namespace Octokit.Tests.Clients
+{
+ public class EnterpriseLicenseClientTests
+ {
+ public class TheGetMethod
+ {
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var connection = Substitute.For();
+ var client = new EnterpriseLicenseClient(connection);
+
+ string expectedUri = "enterprise/settings/license";
+ client.Get();
+ connection.Received().Get(Arg.Is(u => u.ToString() == expectedUri));
+ }
+ }
+ }
+}
diff --git a/Octokit.Tests/Clients/Enterprise/EnterpriseOrganizationClientTests.cs b/Octokit.Tests/Clients/Enterprise/EnterpriseOrganizationClientTests.cs
new file mode 100644
index 0000000000..4b078b1290
--- /dev/null
+++ b/Octokit.Tests/Clients/Enterprise/EnterpriseOrganizationClientTests.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Threading.Tasks;
+using NSubstitute;
+using Xunit;
+
+namespace Octokit.Tests.Clients
+{
+ public class EnterpriseOrganizationClientTests
+ {
+ public class TheCreateMethod
+ {
+ [Fact]
+ public void RequestsCorrectUrl()
+ {
+ var connection = Substitute.For();
+ var client = new EnterpriseOrganizationClient(connection);
+
+ string expectedUri = "admin/organizations";
+ client.Create(new NewOrganization("org", "admin", "org name"));
+
+ connection.Received().Post(Arg.Is(u => u.ToString() == expectedUri), Arg.Any