Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #16

Merged
merged 79 commits into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
9e33168
Merge pull request #11 from Microsoft/Dev
NikCharlebois Nov 23, 2018
8bbd16f
Added O365Group Resource
NikCharlebois Nov 26, 2018
86f9233
Tests Added
NikCharlebois Nov 26, 2018
65bc14b
Fixed return type
NikCharlebois Nov 26, 2018
2b3a68f
Updated required params in O365Group schema
NikCharlebois Nov 26, 2018
21d4318
Renamed Tests
NikCharlebois Nov 26, 2018
7daa365
Fixes
NikCharlebois Nov 26, 2018
7523366
Fixed UnitHelper
NikCharlebois Nov 26, 2018
5090b03
Removed CurrentStubBuildNumber
NikCharlebois Nov 26, 2018
e1f2b7c
Testing
NikCharlebois Nov 26, 2018
1beeff7
Fixed Stub
NikCharlebois Nov 26, 2018
8c83b83
Forcing Troubleshoot
NikCharlebois Nov 26, 2018
ab30b7c
Troubleshooting Verbose
NikCharlebois Nov 26, 2018
9a6a17e
Fixed Global Helper variable
NikCharlebois Nov 26, 2018
1f671f9
Fixing Tests
NikCharlebois Nov 26, 2018
cdbab2b
Modified Stub for New-MSOlUser
NikCharlebois Nov 26, 2018
f405ca7
Testing
NikCharlebois Nov 26, 2018
7c81a91
fix
NikCharlebois Nov 26, 2018
65d765a
Mocked Connect-MsolService
NikCharlebois Nov 26, 2018
baae84c
Trigger
NikCharlebois Nov 26, 2018
ea37845
Changed Mock Scope
NikCharlebois Nov 26, 2018
80ac340
Mocking Util method
NikCharlebois Nov 26, 2018
693054d
Added the Ensure param
NikCharlebois Nov 26, 2018
fc6c7f8
Mocked Test-SPOServiceConnection
NikCharlebois Nov 26, 2018
7fbbe07
Fixing Tests
NikCharlebois Nov 26, 2018
c3779b4
Added code Coverage for SPOSite
NikCharlebois Nov 26, 2018
46e17ef
Improved SPOSite Code Coverage
NikCharlebois Nov 26, 2018
2f224f9
Improved code coverage for O365User
NikCharlebois Nov 27, 2018
07bffcb
Fixed MSOLUser
NikCharlebois Nov 27, 2018
e92e5ef
Updated tests
NikCharlebois Nov 27, 2018
2692301
Fix
NikCharlebois Nov 27, 2018
e6fd4ac
Fixed Structure of Get-MSOLUser Mock
NikCharlebois Nov 27, 2018
f69f7e9
Fixes
NikCharlebois Nov 27, 2018
71c4dd9
Added code coverage for O365Group
NikCharlebois Nov 27, 2018
e413637
Fixed Set-Target on O365Group
NikCharlebois Nov 27, 2018
980d39d
Fixes
NikCharlebois Nov 27, 2018
2fef44e
Fix
NikCharlebois Nov 27, 2018
73a7dd6
Fix
NikCharlebois Nov 27, 2018
3408c60
Added second fake user
NikCharlebois Nov 27, 2018
d48fe5f
Merge pull request #12 from NikCharlebois/master
NikCharlebois Nov 27, 2018
2a74550
Multiple changes for ExO
NikCharlebois Nov 27, 2018
acbdd37
Updated Tests
NikCharlebois Nov 27, 2018
d7b9b3a
Updated Tests
NikCharlebois Nov 27, 2018
bf215f5
Updated Stub
NikCharlebois Nov 27, 2018
61fc5e0
Fix
NikCharlebois Nov 27, 2018
7b11dfe
Fix
NikCharlebois Nov 27, 2018
5b63121
New Mock
NikCharlebois Nov 27, 2018
224357b
Fix
NikCharlebois Nov 27, 2018
57c57ee
Fix Test
NikCharlebois Nov 27, 2018
5080108
Get-Group Mock
NikCharlebois Nov 27, 2018
38053db
Fix
NikCharlebois Nov 27, 2018
4e562ff
Added Notes to Return Type
NikCharlebois Nov 27, 2018
46df2bd
Increased Code Coverage
NikCharlebois Nov 27, 2018
db5e297
Increased code coverage part 2
NikCharlebois Nov 27, 2018
3e135f3
Fix
NikCharlebois Nov 27, 2018
ee234fe
Fixes
NikCharlebois Nov 27, 2018
f964930
Merge pull request #13 from NikCharlebois/master
NikCharlebois Nov 27, 2018
1573ac5
Syntax Fixes
NikCharlebois Nov 28, 2018
afbc814
Updated the SPOUser Resource to include additional Information Proper…
NikCharlebois Nov 28, 2018
881ea59
Multiple fixes for the O365Resource
NikCharlebois Nov 28, 2018
b90bed9
Fixes
NikCharlebois Nov 28, 2018
c40f001
Updated Test
NikCharlebois Nov 28, 2018
98e0beb
Fixes to O365User tests
NikCharlebois Nov 28, 2018
52cc1e7
Increase code coverage
NikCharlebois Nov 28, 2018
bfeb429
Improved Code Coverage
NikCharlebois Nov 28, 2018
63a9adf
Updated Stubs
NikCharlebois Nov 28, 2018
2aae24e
Trigger for AppVeyor
NikCharlebois Nov 28, 2018
43d9803
Fixing Stubs
NikCharlebois Nov 28, 2018
11bc0f9
Fixes
NikCharlebois Nov 28, 2018
c6e56d3
Testing fix
NikCharlebois Nov 29, 2018
d21c1fc
Fixes
NikCharlebois Nov 29, 2018
fa1fc70
Merge pull request #14 from NikCharlebois/master
NikCharlebois Nov 29, 2018
f03f600
Added the Export-TargetResource function to O365User
NikCharlebois Nov 29, 2018
70a97b8
Added Export-TargetResource to other Resources
NikCharlebois Nov 29, 2018
942e849
Forcing AppVeyor to install ReverseDSC
NikCharlebois Nov 29, 2018
f6c4ead
Added tests for Export-TargetResource
NikCharlebois Nov 29, 2018
5ab6d6a
Fixes
NikCharlebois Nov 29, 2018
44bee32
Fix
NikCharlebois Nov 29, 2018
b062de2
Merge pull request #15 from NikCharlebois/master
NikCharlebois Nov 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tests Added
  • Loading branch information
NikCharlebois committed Nov 26, 2018
commit 86f92330304de1fde6a1fdcdf972d31843557e62
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Get-TargetResource
Description = $null
ManagedBy = $null
TenantId = $null
GlobalAdminAccount = $null
GlobalAdminAccount = $null
}

try
Expand All @@ -42,7 +42,7 @@ function Get-TargetResource
return $nullReturn
}

$groupMembers = Get-MsolGroupMember -GroupObjectId $group.ObjectId
$groupMembers = Get-MsolGroupMember -GroupObjectId $group.ObjectId
return @{
DisplayName = $group.DisplayName
Description = $group.Description
Expand Down Expand Up @@ -85,13 +85,19 @@ function Set-TargetResource
Write-Verbose -Message "Setting Office 365 Group $DisplayName"
$CurrentParameters = $PSBoundParameters
$CurrentParameters.Remove("GlobalAdminAccount")
$owner = Get-MsolUser -ObjectId $ManagedBy -ErrorAction SilentlyContinue
if(!$owner)
try
{
$owner = Get-MsolUser -UserPrincipalName $ManagedBy
$currentParameters("ManagedBy") = $owner.ObjectId
$owner = Get-MsolUser -ObjectId $ManagedBy -ErrorAction SilentlyContinue
}
catch
{
if(!$owner)
{
$owner = Get-MsolUser -UserPrincipalName $ManagedBy
$CurrentParameters.ManagedBy = $owner.ObjectId
}
}
$group = New-MsolGroup @CurrentParameters
New-MsolGroup @CurrentParameters
}

function Test-TargetResource
Expand Down
8 changes: 8 additions & 0 deletions Modules/Office365DSC/Examples/ProofOfConcept.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ Configuration ProofOfConcept
LicenseAssignment = "O365dsc1:ENTERPRISEPREMIUM"
GlobalAdminAccount = $credsGlobalAdmin
}

O365Group MarkTeam
{
DisplayName = "Mark's Team"
Description = "Team for Mark"
ManagedBy = "[email protected]"
GlobalAdminAccount = $credsGlobalAdmin
}
}
}

Expand Down
48 changes: 48 additions & 0 deletions Tests/Unit/Office365DSC/Office365DSC.O365User.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[CmdletBinding()]
param(
[Parameter()]
[string]
$CmdletModule = (Join-Path -Path $PSScriptRoot `
-ChildPath "..\Stubs\Office365DSC.psm1" `
-Resolve)
)

Import-Module -Name (Join-Path -Path $PSScriptRoot `
-ChildPath "..\UnitTestHelper.psm1" `
-Resolve)

$Global:DscHelper = New-O365DscUnitTestHelper -StubModule $CmdletModule `
-DscResource "O365User"

Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock {
Invoke-Command -ScriptBlock $Global:DscHelper.InitializeScript -NoNewScope

$secpasswd = ConvertTo-SecureString "test@password1" -AsPlainText -Force
$GlobalAdminAccount = New-Object System.Management.Automation.PSCredential ("tenantadmin", $secpasswd)

# Test contexts
Context -Name "When the site doesn't already exist" -Fixture {
$testParams = @{
UserPrincipalName = "[email protected]"
DisplayName = "John Smith"
FirstName = "John"
LastName = "Smith"
UsageLocation = "US"
LicenseAssignment = "CONTOSO:ENTERPRISE_PREMIUM"
Password = $GlobalAdminAccount
GlobalAdminAccount = $GlobalAdminAccount
}

Mock -CommandName New-MSOLUser -MockWith {
return @{Url = $null}
}

It "Should return absent from the Get method" {
(Get-TargetResource @testParams).Ensure | Should Be "Absent"
}
}
}
}

Invoke-Command -ScriptBlock $Global:SPDscHelper.CleanupScript -NoNewScope
8 changes: 4 additions & 4 deletions Tests/Unit/Office365DSC/Office365DSC.SPOSite.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Import-Module -Name (Join-Path -Path $PSScriptRoot `
-Resolve)

$Global:DscHelper = New-O365DscUnitTestHelper -StubModule $CmdletModule `
-DscResource "SPAccessServiceApp"
-DscResource "SPOSite"

Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock {
Invoke-Command -ScriptBlock $Global:DscHelper.InitializeScript -NoNewScope

$secpasswd = ConvertTo-SecureString "test@password1" -AsPlainText -Force
$secpasswd = ConvertTo-SecureString "test@password1" -AsPlainText -Force
$GlobalAdminAccount = New-Object System.Management.Automation.PSCredential ("tenantadmin", $secpasswd)

# Test contexts
Expand All @@ -27,8 +27,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
Url = "https://contoso.com/sites/TestSite"
Owner = "[email protected]"
StorageQuota = 1000
CentralAdminUrl = "https://contoso-admin.sharepoint.com"
GlobalAdminAccount = $GlobalAdminAccount
CentralAdminUrl = "https://contoso-admin.sharepoint.com"
GlobalAdminAccount = $GlobalAdminAccount
}

Mock -CommandName New-SPOSite -MockWith {
Expand Down