-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancements(app): added and fixes methods related to project app cre…
…ation and updating
- Loading branch information
1 parent
55a52e3
commit ca69d0c
Showing
6 changed files
with
93 additions
and
18 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
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
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package dev.shiperist.app; | ||
|
||
import dev.shiperist.exception.ErrorMessage; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.security.TestSecurity; | ||
import io.quarkus.test.security.jwt.Claim; | ||
|
@@ -24,13 +25,45 @@ public void testCreateApp() { | |
given() | ||
.contentType(ContentType.JSON) | ||
.body(app) | ||
.when().put("/projects/{projectId}/apps", projectId) | ||
.when().put("/projects/{projectId}/apps", project.getId()) | ||
.then().statusCode(201) | ||
.body("name", equalTo(app.getName()), | ||
.body("name", equalTo(project.getName() + "/" + app.getName()), | ||
"displayName", equalTo(app.getDisplayName()), | ||
"description", equalTo(app.getDescription()), | ||
"image", equalTo(app.getImage()), | ||
"os", equalTo(app.getOs().name()), | ||
"releaseType", equalTo(app.getReleaseType().name())); | ||
} | ||
|
||
@Test | ||
@DisplayName("PUT /projects/{projectId}/apps - create app - unauthorized") | ||
public void testCreateAppUnauthorized() { | ||
given() | ||
.contentType(ContentType.JSON) | ||
.body(app) | ||
.when().put("/projects/{projectId}/apps", project.getId()) | ||
.then().statusCode(401); | ||
} | ||
|
||
@Test | ||
@DisplayName("PUT /projects/{projectId}/apps - create app - already exists") | ||
@TestSecurity(user = "[email protected]") | ||
@JwtSecurity(claims = { | ||
@Claim(key = "sub", value = "1") | ||
}) | ||
public void testCreateAppAlreadyExists() { | ||
given() | ||
.contentType(ContentType.JSON) | ||
.body(app) | ||
.when().put("/projects/{projectId}/apps", project.getId()) | ||
.then().statusCode(201); | ||
|
||
given() | ||
.contentType(ContentType.JSON) | ||
.body(app) | ||
.when().put("/projects/{projectId}/apps", project.getId()) | ||
.then().statusCode(400) | ||
.body("error", equalTo(ErrorMessage.PROJECT_APP_ALREADY_EXISTS.getError()), | ||
"description", equalTo(ErrorMessage.PROJECT_APP_ALREADY_EXISTS.getDescription())); | ||
} | ||
} |