This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5bd8cd0
commit 3a9446e
Showing
11 changed files
with
989 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
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,54 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Management.Automation.Runspaces; | ||
|
||
namespace OfficeDevPnP.PowerShell.Tests | ||
{ | ||
[TestClass] | ||
public class GetTenantSiteTests | ||
{ | ||
[TestMethod] | ||
public void GetTenantSiteTest() | ||
{ | ||
using (var scope = new PSTestScope(true)) | ||
{ | ||
var results = scope.ExecuteCommand("Get-SPOTenantSite"); | ||
|
||
Assert.IsTrue(results.Count > 0); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void GetTimeZoneIdTest1() | ||
{ | ||
using (var scope = new PSTestScope(false)) | ||
{ | ||
var results = scope.ExecuteCommand("Get-SPOTimeZoneId"); | ||
Assert.IsTrue(results.Count > 0); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void GetTimeZoneIdTest2() | ||
{ | ||
using (var scope = new PSTestScope(false)) | ||
{ | ||
var results = scope.ExecuteCommand("Get-SPOTimeZoneId", new CommandParameter("Match", "Stockholm")); | ||
|
||
Assert.IsTrue(results.Count == 1); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void GetWebTemplatesTest() | ||
{ | ||
using (var scope = new PSTestScope(true)) | ||
{ | ||
var results = scope.ExecuteCommand("Get-SPOWebTemplates"); | ||
|
||
Assert.IsTrue(results.Count > 0); | ||
Assert.IsTrue(results[0].BaseObject.GetType().Equals(typeof(Microsoft.Online.SharePoint.TenantAdministration.SPOTenantWebTemplate))); | ||
} | ||
} | ||
} | ||
} |
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,82 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<configSections> | ||
<sectionGroup name="pnp"> | ||
<section | ||
name="tracing" | ||
type="OfficeDevPnP.Core.Diagnostics.LogConfigurationTracingSection, OfficeDevPnP.Core" | ||
allowLocation="true" | ||
allowDefinition="Everywhere" | ||
/> | ||
</sectionGroup> | ||
<!-- Other <section> and <sectionGroup> elements. --> | ||
</configSections> | ||
<pnp> | ||
<tracing logLevel="Debug"> | ||
<logger type="OfficeDevPnP.Core.Diagnostics.TraceLogger, OfficeDevPnP.Core, Culture=neutral, PublicKeyToken=null" /> | ||
</tracing> | ||
</pnp> | ||
<appSettings> | ||
<!-- For Office 365 MT sites are https://[tenant]-admin.sharepoint.com and https://[tenant].sharepoint.com/sites/dev, for on-premises | ||
you can any Developer site collection (e.g https://sp.contoso.com/sites.dev). For tenant adminstration you'll need to specify the | ||
site collection you've marked as tenant administrator. This site collection must be in the same web app as the Developer site. See | ||
http://blogs.msdn.com/b/vesku/archive/2014/06/09/provisioning-site-collections-using-sp-app-model-in-on-premises-with-just-csom.aspx | ||
for more details on how to setup a tenant administration site in on-premises. | ||
--> | ||
<add key="SPOTenantUrl" value="https://[tenant]-admin.sharepoint.com" /> | ||
<add key="SPODevSiteUrl" value="https://[tenant].sharepoint.com/sites/dev" /> | ||
|
||
<add key="SPOCredentialManagerLabel" value=""/> | ||
<!-- If the above value is specified, a lookup will be done to the Windows Credential | ||
manager for a -Windows- Credential that maps to the label. If not specified, it assumes you want to specify on | ||
of the below options. Value will be taken based on the what's entered in this order: | ||
1. O365 username/pwd | ||
2. On-premises username/pwd | ||
3. App only (O365 & On-premises) | ||
--> | ||
|
||
<!-- Priority 1: For testing against Office 365 provide a username and password --> | ||
<add key="SPOUserName" value="user@[tenant].onmicrosoft.com" /> | ||
<add key="SPOPassword" value="" /> | ||
|
||
<!-- Priority 2: For testing against on-premises provide a username, domain and password --> | ||
<add key="OnPremUserName" value="user" /> | ||
<add key="OnPremDomain" value="domain" /> | ||
<add key="OnPremPassword" value="" /> | ||
|
||
<!-- Priority 3: For app only testing provide a realm, app id and app secret --> | ||
<add key="Realm" value="a6623c9e-30c7-493b-87bc-d907df44a26e" /> | ||
<add key="AppId" value="b5bdf20c-2917-5178-3309-5deb57ee6c89" /> | ||
<add key="AppSecret" value="" /> | ||
|
||
<!-- Permission XML for app only test | ||
<AppPermissionRequests AllowAppOnlyPolicy="true" > | ||
<AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" /> | ||
<AppPermissionRequest Scope="http://sharepoint/taxonomy" Right="Write" /> | ||
<AppPermissionRequest Scope="http://sharepoint/search" Right="QueryAsUserIgnoreAppPrincipal" /> | ||
<AppPermissionRequest Scope="http://sharepoint/social/tenant" Right="FullControl" /> | ||
</AppPermissionRequests> | ||
--> | ||
|
||
<!-- Support for Azure based testing --> | ||
<add key="AzureStorageKey" value="" /> | ||
|
||
</appSettings> | ||
<system.diagnostics> | ||
<sharedListeners> | ||
<add name="console" type="System.Diagnostics.ConsoleTraceListener" /> | ||
</sharedListeners> | ||
<sources> | ||
<source name="OfficeDevPnP.Core" switchValue="Verbose" > | ||
<listeners> | ||
<add name="console" /> | ||
</listeners> | ||
</source> | ||
</sources> | ||
<trace indentsize="0" autoflush="true"> | ||
<listeners> | ||
<add name="console" /> | ||
</listeners> | ||
</trace> | ||
</system.diagnostics> | ||
</configuration> |
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,40 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System.Management.Automation.Runspaces; | ||
using System.Management.Automation; | ||
using System.Collections.ObjectModel; | ||
using OfficeDevPnP.PowerShell.Commands.Base; | ||
using OfficeDevPnP.PowerShell.Tests; | ||
using System.Configuration; | ||
|
||
namespace OfficeDevPnP.PowerShell.Tests | ||
{ | ||
[TestClass] | ||
public class BaseTests | ||
{ | ||
[TestMethod] | ||
public void ConnectSPOnlineTest1() | ||
{ | ||
using (var scope = new PSTestScope(false)) | ||
{ | ||
var results = scope.ExecuteCommand("Connect-SPOnline", new CommandParameter("Url", ConfigurationManager.AppSettings["SPODevSiteUrl"])); | ||
Assert.IsTrue(results.Count == 0); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void ConnectSPOnlineTest2() | ||
{ | ||
using (var scope = new PSTestScope(true)) | ||
{ | ||
var results = scope.ExecuteCommand("Get-SPOContext"); | ||
|
||
Assert.IsTrue(results.Count == 1); | ||
Assert.IsTrue(results[0].BaseObject.GetType() == typeof(Microsoft.SharePoint.Client.ClientContext)); | ||
|
||
} | ||
} | ||
|
||
|
||
} | ||
} |
Oops, something went wrong.