forked from appsmithorg/appsmith
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete application created during git import for empty repo (appsmith…
- Loading branch information
1 parent
c75e330
commit ab3d1d9
Showing
2 changed files
with
29 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2491,6 +2491,29 @@ public void importApplicationFromGit_validRequestWithDuplicateDatasourceOfDiffer | |
.verify(); | ||
} | ||
|
||
@Test | ||
@WithUserDetails(value = "api_user") | ||
public void importApplicationFromGit_validRequestWithEmptyRepo_ThrowError() { | ||
GitConnectDTO gitConnectDTO = getConnectRequest("[email protected]:test/emptyRepo.git", testUserProfile); | ||
GitAuth gitAuth = gitService.generateSSHKey().block(); | ||
|
||
ApplicationJson applicationJson =new ApplicationJson(); | ||
|
||
Mockito.when(gitExecutor.cloneApplication(Mockito.any(Path.class), Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) | ||
.thenReturn(Mono.just("defaultBranch")); | ||
Mockito.when(gitFileUtils.reconstructApplicationJsonFromGitRepo(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) | ||
.thenReturn(Mono.just(applicationJson)); | ||
Mockito.when(gitFileUtils.detachRemote(Mockito.any(Path.class))).thenReturn(Mono.just(true)); | ||
|
||
Mono<ApplicationImportDTO> applicationMono = gitService.importApplicationFromGit(orgId, gitConnectDTO); | ||
|
||
StepVerifier | ||
.create(applicationMono) | ||
.expectErrorMatches(throwable -> throwable instanceof AppsmithException | ||
&& throwable.getMessage().contains("Cannot import app from an empty repo")) | ||
.verify(); | ||
} | ||
|
||
// TODO TCs for merge is pending | ||
|
||
@Test | ||
|