-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an API endpoint to support cloning of environment (#203)
* feat(env_clone): Add an api to support environment cloning * fixup! feat(env_clone): Add an api to support environment cloning * docs(env_clone): fix swagger docs * squash! feat(env_clone): Add an api to support environment cloning * test(integration): Create a fixture to return env dict response * test(clone_env): Add integration test to check 200 * test: remove environment_dict fixture * refactor(clone-env): move clonning logic to serializer * fix: Add permission check for env clone action * refactor(clone-env): move permission check to has_permission * fixup! refactor(clone-env): move permission check to has_permission * squash! refactor permission for clone * test(env_clone): Add test to check sourece state env after clone * wip: permission changes * use Q objects to generate filter
- Loading branch information
1 parent
01f8a6e
commit 96f5006
Showing
7 changed files
with
118 additions
and
13 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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from django.urls import reverse | ||
from rest_framework import status | ||
|
||
|
||
def test_clone_environment_returns_200( | ||
admin_client, project, environment, environment_api_key | ||
): | ||
# Given | ||
env_name = "Cloned env" | ||
url = reverse("api-v1:environments:environment-clone", args=[environment_api_key]) | ||
# When | ||
res = admin_client.post(url, {"name": env_name}) | ||
|
||
# Then | ||
assert res.status_code == status.HTTP_200_OK | ||
assert res.json()["name"] == env_name |