@@ -16,6 +16,10 @@ public class MigrateRepoCommandArgsTests
16
16
private const string GITHUB_TARGET_PAT = "github-target-pat" ;
17
17
private const string AWS_BUCKET_NAME = "aws-bucket-name" ;
18
18
private const string GHES_API_URL = "foo-ghes-api.com" ;
19
+ private const string GIT_ARCHIVE_URL = "http://host/git-archive.tar.gz" ;
20
+ private const string METADATA_ARCHIVE_URL = "http://host/metadata-archive.tar.gz" ;
21
+ private const string GIT_ARCHIVE_PATH = "./git-archive.tar.gz" ;
22
+ private const string METADATA_ARCHIVE_PATH = "./metadata-archive.tar.gz" ;
19
23
20
24
[ Fact ]
21
25
public void Defaults_TargetRepo_To_SourceRepo ( )
@@ -124,6 +128,7 @@ public void It_Throws_When_Aws_Bucket_Name_Provided_With_AzureStorageConnectionS
124
128
. ThrowExactly < OctoshiftCliException > ( )
125
129
. WithMessage ( "*--use-github-storage flag*" ) ;
126
130
}
131
+
127
132
[ Fact ]
128
133
public void No_Ssl_Verify_Without_Ghes_Api_Url_Throws ( )
129
134
{
@@ -159,5 +164,79 @@ public void Keep_Archive_Without_Ghes_Api_Url_Throws()
159
164
. ThrowExactly < OctoshiftCliException > ( )
160
165
. WithMessage ( "*--keep-archive*" ) ;
161
166
}
167
+
168
+ [ Fact ]
169
+ public void GitArchivePath_Without_MetadataArchivePath_Throws ( )
170
+ {
171
+ var args = new MigrateRepoCommandArgs
172
+ {
173
+ SourceRepo = SOURCE_REPO ,
174
+ GithubSourceOrg = SOURCE_ORG ,
175
+ GithubTargetOrg = TARGET_ORG ,
176
+ TargetRepo = TARGET_REPO ,
177
+ GitArchivePath = GIT_ARCHIVE_PATH
178
+ } ;
179
+
180
+ FluentActions . Invoking ( ( ) => args . Validate ( _mockOctoLogger . Object ) )
181
+ . Should ( )
182
+ . ThrowExactly < OctoshiftCliException > ( )
183
+ . WithMessage ( "*you must provide both --git-archive-path --metadata-archive-path*" ) ;
184
+ }
185
+
186
+ [ Fact ]
187
+ public void MetadataArchivePath_Without_GitArchivePath_Throws ( )
188
+ {
189
+ var args = new MigrateRepoCommandArgs
190
+ {
191
+ SourceRepo = SOURCE_REPO ,
192
+ GithubSourceOrg = SOURCE_ORG ,
193
+ GithubTargetOrg = TARGET_ORG ,
194
+ TargetRepo = TARGET_REPO ,
195
+ MetadataArchivePath = METADATA_ARCHIVE_PATH
196
+ } ;
197
+
198
+ FluentActions . Invoking ( ( ) => args . Validate ( _mockOctoLogger . Object ) )
199
+ . Should ( )
200
+ . ThrowExactly < OctoshiftCliException > ( )
201
+ . WithMessage ( "*you must provide both --git-archive-path --metadata-archive-path*" ) ;
202
+ }
203
+
204
+ [ Fact ]
205
+ public void GitArchiveUrl_With_GitArchivePath_Throws ( )
206
+ {
207
+ var args = new MigrateRepoCommandArgs
208
+ {
209
+ SourceRepo = SOURCE_REPO ,
210
+ GithubSourceOrg = SOURCE_ORG ,
211
+ GithubTargetOrg = TARGET_ORG ,
212
+ TargetRepo = TARGET_REPO ,
213
+ GitArchiveUrl = GIT_ARCHIVE_URL ,
214
+ GitArchivePath = GIT_ARCHIVE_PATH
215
+ } ;
216
+
217
+ FluentActions . Invoking ( ( ) => args . Validate ( _mockOctoLogger . Object ) )
218
+ . Should ( )
219
+ . ThrowExactly < OctoshiftCliException > ( )
220
+ . WithMessage ( "*--git-archive-url and --git-archive-path may not be used together*" ) ;
221
+ }
222
+
223
+ [ Fact ]
224
+ public void MetadataArchiveUrl_With_MetadataArchivePath_Throws ( )
225
+ {
226
+ var args = new MigrateRepoCommandArgs
227
+ {
228
+ SourceRepo = SOURCE_REPO ,
229
+ GithubSourceOrg = SOURCE_ORG ,
230
+ GithubTargetOrg = TARGET_ORG ,
231
+ TargetRepo = TARGET_REPO ,
232
+ MetadataArchiveUrl = METADATA_ARCHIVE_URL ,
233
+ MetadataArchivePath = METADATA_ARCHIVE_PATH
234
+ } ;
235
+
236
+ FluentActions . Invoking ( ( ) => args . Validate ( _mockOctoLogger . Object ) )
237
+ . Should ( )
238
+ . ThrowExactly < OctoshiftCliException > ( )
239
+ . WithMessage ( "*--metadata-archive-url and --metadata-archive-path may not be used together*" ) ;
240
+ }
162
241
}
163
242
}
0 commit comments