-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #407 from iriusrisk/feature/BLAZ-710
[feature/BLAZ-710] to dev
- Loading branch information
Showing
7 changed files
with
58 additions
and
10 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
47 changes: 47 additions & 0 deletions
47
tests/integration/api/controllers/etm/test_etm_controller_diagram.py
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,47 @@ | ||
import json | ||
|
||
import pytest | ||
from fastapi.testclient import TestClient | ||
|
||
from startleft.startleft.api import fastapi_server | ||
from startleft.startleft.api.controllers.etm import etm_create_otm_controller | ||
|
||
webapp = fastapi_server.webapp | ||
|
||
client = TestClient(webapp) | ||
|
||
|
||
def get_url(): | ||
return etm_create_otm_controller.PREFIX + etm_create_otm_controller.URL | ||
|
||
|
||
octet_stream = 'application/octet-stream' | ||
|
||
|
||
class TestOTMControllerEtm: | ||
|
||
@pytest.mark.parametrize("project_id,project_name,source_file,errors_expected, error_type", [ | ||
(None, 'name', None, 4, 'RequestValidationError'), | ||
('id', None, None, 4, 'RequestValidationError'), | ||
('id', 'name', None, 3, 'RequestValidationError'), | ||
(None, None, None, 5, 'RequestValidationError'), | ||
('', None, None, 5, 'RequestValidationError') | ||
]) | ||
def test_create_project_validation_error(self, project_id: str, project_name: str, source_file, | ||
errors_expected: int, | ||
error_type: str): | ||
# Given a body | ||
body = {'id': project_id, 'name': project_name} | ||
|
||
# When I do post to the endpoint | ||
files = {'source_file': source_file} if source_file else None | ||
response = client.post(get_url(), files=files, data=body) | ||
|
||
# Then | ||
assert response.status_code == 400 | ||
res_body = json.loads(response.text) | ||
assert res_body['status'] == '400' | ||
assert res_body['error_type'] == error_type | ||
assert len(res_body['errors']) == errors_expected | ||
for e in res_body['errors']: | ||
assert len(e['errorMessage']) > 0 |
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