-
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.
- Loading branch information
1 parent
ecd1e36
commit f92b17e
Showing
3 changed files
with
19 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,34 @@ | ||
# Standard library | ||
from unittest.mock import patch | ||
|
||
# Third-party | ||
from rest_framework import status | ||
from rest_framework.reverse import reverse | ||
|
||
# First-party/Local | ||
from tests.api.models.test_tool import tool # noqa: F401 | ||
|
||
|
||
def test_get(client): | ||
response = client.get(reverse("tool-deployments", ("rstudio", "deploy"))) | ||
assert response.status_code == status.HTTP_405_METHOD_NOT_ALLOWED | ||
|
||
|
||
def test_post_not_valid_data(client): | ||
data = {"version": "rstudio_v1.0.0"} | ||
data = {"tool": 1000} | ||
response = client.post(reverse("tool-deployments", ("rstudio", "deploy")), data) | ||
assert response.status_code == status.HTTP_400_BAD_REQUEST | ||
|
||
|
||
def test_post_not_supported_action(client): | ||
data = {"version": "rstudio_v1.0.0"} | ||
def test_post_not_supported_action(client, tool): # noqa: F811 | ||
data = {"tool": tool.pk} | ||
response = client.post(reverse("tool-deployments", ("rstudio", "testing")), data) | ||
assert response.status_code == status.HTTP_400_BAD_REQUEST | ||
|
||
|
||
def test_post(client): | ||
data = {"version": "rstudio__v1.0.0__1"} | ||
@patch("controlpanel.api.serializers.ToolDeploymentSerializer.save") | ||
def test_post(save, client, tool): # noqa: F811 | ||
data = {"tool": tool.pk} | ||
response = client.post(reverse("tool-deployments", ("rstudio", "deploy")), data) | ||
assert response.status_code == status.HTTP_200_OK | ||
save.assert_called_once() |