@@ -70,64 +70,72 @@ if (-not $script:accessTokenConfigured)
7070# Backup the user's configuration before we begin, and ensure we're at a pure state before running
7171# the tests. We'll restore it at the end.
7272$configFile = New-TemporaryFile
73- Backup-GitHubConfiguration - Path $configFile
74- Reset-GitHubConfiguration
7573
76- Describe ' Getting the referrer list' {
77- $repo = New-GitHubRepository - RepositoryName ([Guid ]::NewGuid().Guid) - AutoInit
74+ try
75+ {
76+ Backup-GitHubConfiguration - Path $configFile
77+ Reset-GitHubConfiguration
78+ Set-GitHubConfiguration - DisableTelemetry # We don't want UT's to impact telemetry
79+ Set-GitHubConfiguration - LogRequestBody # Make it easier to debug UT failures
7880
79- Context ' When initially created, there are no referrers ' {
80- $referrerList = Get-GitHubReferrerTraffic - Uri $repo .svn_url
81+ Describe ' Getting the referrer list ' {
82+ $repo = New-GitHubRepository - RepositoryName ([ Guid ]::NewGuid().Guid) - AutoInit
8183
82- It ' Should return expected number of referrers' {
83- @ ($referrerList ).Count | Should be 0
84- }
84+ Context ' When initially created, there are no referrers' {
85+ $referrerList = Get-GitHubReferrerTraffic - Uri $repo.svn_url
8586
86- Remove-GitHubRepository - Uri $repo.svn_url
87+ It ' Should return expected number of referrers' {
88+ @ ($referrerList ).Count | Should be 0
89+ }
90+
91+ Remove-GitHubRepository - Uri $repo.svn_url
92+ }
8793 }
88- }
8994
90- Describe ' Getting the popular content over the last 14 days' {
91- $repo = New-GitHubRepository - RepositoryName ([Guid ]::NewGuid().Guid) - AutoInit
95+ Describe ' Getting the popular content over the last 14 days' {
96+ $repo = New-GitHubRepository - RepositoryName ([Guid ]::NewGuid().Guid) - AutoInit
9297
93- Context ' When initially created, there are is no popular content' {
94- $pathList = Get-GitHubPathTraffic - Uri $repo.svn_url
98+ Context ' When initially created, there are is no popular content' {
99+ $pathList = Get-GitHubPathTraffic - Uri $repo.svn_url
95100
96- It ' Should return expected number of popular content' {
97- @ ($pathList ).Count | Should be 0
98- }
101+ It ' Should return expected number of popular content' {
102+ @ ($pathList ).Count | Should be 0
103+ }
99104
100- Remove-GitHubRepository - Uri $repo.svn_url
105+ Remove-GitHubRepository - Uri $repo.svn_url
106+ }
101107 }
102- }
103108
104- Describe ' Getting the views over the last 14 days' {
105- $repo = New-GitHubRepository - RepositoryName ([Guid ]::NewGuid().Guid) - AutoInit
109+ Describe ' Getting the views over the last 14 days' {
110+ $repo = New-GitHubRepository - RepositoryName ([Guid ]::NewGuid().Guid) - AutoInit
106111
107- Context ' When initially created, there are no views' {
108- $viewList = Get-GitHubViewTraffic - Uri $repo.svn_url
112+ Context ' When initially created, there are no views' {
113+ $viewList = Get-GitHubViewTraffic - Uri $repo.svn_url
109114
110- It ' Should return 0 in the count property' {
111- $viewList.Count | Should be 0
112- }
115+ It ' Should return 0 in the count property' {
116+ $viewList.Count | Should be 0
117+ }
113118
114- Remove-GitHubRepository - Uri $repo.svn_url
119+ Remove-GitHubRepository - Uri $repo.svn_url
120+ }
115121 }
116- }
117122
118- Describe ' Getting the clones over the last 14 days' {
119- $repo = New-GitHubRepository - RepositoryName ([Guid ]::NewGuid().Guid) - AutoInit
123+ Describe ' Getting the clones over the last 14 days' {
124+ $repo = New-GitHubRepository - RepositoryName ([Guid ]::NewGuid().Guid) - AutoInit
120125
121- Context ' When initially created, there is 0 clones' {
122- $cloneList = Get-GitHubCloneTraffic - Uri $repo.svn_url
126+ Context ' When initially created, there is 0 clones' {
127+ $cloneList = Get-GitHubCloneTraffic - Uri $repo.svn_url
123128
124- It ' Should return expected number of clones' {
125- $cloneList.Count | Should be 0
126- }
129+ It ' Should return expected number of clones' {
130+ $cloneList.Count | Should be 0
131+ }
127132
128- Remove-GitHubRepository - Uri $repo.svn_url
133+ Remove-GitHubRepository - Uri $repo.svn_url
134+ }
129135 }
130136}
131-
132- # Restore the user's configuration to its pre-test state
133- Restore-GitHubConfiguration - Path $configFile
137+ finally
138+ {
139+ # Restore the user's configuration to its pre-test state
140+ Restore-GitHubConfiguration - Path $configFile
141+ }
0 commit comments