@@ -70,64 +70,72 @@ if (-not $script:accessTokenConfigured)
70
70
# Backup the user's configuration before we begin, and ensure we're at a pure state before running
71
71
# the tests. We'll restore it at the end.
72
72
$configFile = New-TemporaryFile
73
- Backup-GitHubConfiguration - Path $configFile
74
- Reset-GitHubConfiguration
75
73
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
78
80
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
81
83
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
85
86
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
+ }
87
93
}
88
- }
89
94
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
92
97
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
95
100
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
+ }
99
104
100
- Remove-GitHubRepository - Uri $repo.svn_url
105
+ Remove-GitHubRepository - Uri $repo.svn_url
106
+ }
101
107
}
102
- }
103
108
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
106
111
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
109
114
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
+ }
113
118
114
- Remove-GitHubRepository - Uri $repo.svn_url
119
+ Remove-GitHubRepository - Uri $repo.svn_url
120
+ }
115
121
}
116
- }
117
122
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
120
125
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
123
128
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
+ }
127
132
128
- Remove-GitHubRepository - Uri $repo.svn_url
133
+ Remove-GitHubRepository - Uri $repo.svn_url
134
+ }
129
135
}
130
136
}
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