-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mehmet Baran Geylani <[email protected]>
- Loading branch information
Showing
10 changed files
with
272 additions
and
16 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
Empty file.
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,59 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"data, code", | ||
[ | ||
pytest.param( | ||
{"username": "mehmet", | ||
"type": "Github", | ||
"desc": "Github Demo", | ||
"name": "My Github"}, | ||
201, | ||
id="SERVICE Endpoint - 201 Created", | ||
), | ||
pytest.param( | ||
{"username": "baran", | ||
"type": "Github", | ||
"desc": "Github Demo", | ||
"name": "My Github"}, | ||
404, | ||
id="SERVICE Endpoint - 404 Not Found", | ||
), | ||
pytest.param( | ||
{"username": "mehmet", | ||
"type": "Github", | ||
"desc": "Github Demo"}, | ||
400, | ||
id="SERVICE Endpoint - 400 Bad Request" | ||
), | ||
pytest.param( | ||
None, | ||
415, | ||
id="SERVICE Endpoint - 415 Unsupported Media Type" | ||
) | ||
] | ||
) | ||
@pytest.mark.usefixtures("create_user") | ||
def test_service_create(client, data, code): | ||
response = client.post("/service/", json=data) | ||
assert response.status_code == code | ||
|
||
@pytest.mark.parametrize( | ||
"data, code", | ||
[ | ||
pytest.param( | ||
{"username": "mehmet", | ||
"type": "Github", | ||
"desc": "Github Demo", | ||
"name": "My Github"}, | ||
409, | ||
id="SERVICE Endpoint - 409 Conflict", | ||
) | ||
] | ||
) | ||
@pytest.mark.usefixtures("create_user") | ||
def test_service_conflict(client, data, code): | ||
response = client.post("/service/", json=data) | ||
response = client.post("/service/", json=data) | ||
assert response.status_code == code |
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,32 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"data, code", | ||
[ | ||
pytest.param( | ||
{"username": "mehmet"}, | ||
200, | ||
id="SERVICE Endpoint - 200 Success", | ||
), | ||
pytest.param( | ||
{"username": "baran"}, | ||
404, | ||
id="SERVICE Endpoint - 404 Not Found", | ||
), | ||
pytest.param( | ||
{"user": "mehmet"}, | ||
400, | ||
id="SERVICE Endpoint - 400 Bad Request" | ||
), | ||
pytest.param( | ||
None, | ||
415, | ||
id="SERVICE Endpoint - 415 Unsupported Media Type" | ||
) | ||
] | ||
) | ||
@pytest.mark.usefixtures("create_user") | ||
def test_service_list(client, data, code): | ||
response = client.get("/service/search", json=data) | ||
assert response.status_code == code |
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,34 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"data, code", | ||
[ | ||
pytest.param( | ||
{'service_uuid': 1}, | ||
200, | ||
id="SERVICE Endpoint - 200 Success", | ||
), | ||
pytest.param( | ||
{"service_uuid": 2039}, | ||
404, | ||
id="SERVICE Endpoint - 404 Not Found", | ||
), | ||
pytest.param( | ||
{"username": "mehmet", | ||
"type": "Github", | ||
"desc": "Github Demo"}, | ||
400, | ||
id="SERVICE Endpoint - 400 Bad Request" | ||
), | ||
pytest.param( | ||
None, | ||
415, | ||
id="SERVICE Endpoint - 415 Unsupported Media Type" | ||
) | ||
] | ||
) | ||
@pytest.mark.usefixtures("create_service") | ||
def test_service_lookup(client, data, code): | ||
response = client.get("/service/", json=data) | ||
assert response.status_code == code |
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,36 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"data, code", | ||
[ | ||
pytest.param( | ||
{'service_uuid': 1, | ||
'username': 'mehmet'}, | ||
200, | ||
id="SERVICE Endpoint - 200 Success", | ||
), | ||
pytest.param( | ||
{"service_uuid": 2039, | ||
'username': "baran"}, | ||
404, | ||
id="SERVICE Endpoint - 404 Not Found", | ||
), | ||
pytest.param( | ||
{"username": "mehmet", | ||
"type": "Github", | ||
"desc": "Github Demo"}, | ||
400, | ||
id="SERVICE Endpoint - 400 Bad Request" | ||
), | ||
pytest.param( | ||
None, | ||
415, | ||
id="SERVICE Endpoint - 415 Unsupported Media Type" | ||
) | ||
] | ||
) | ||
@pytest.mark.usefixtures("create_service") | ||
def test_service_refresh(client, data, code): | ||
response = client.post("/service/token", json=data) | ||
assert response.status_code == code |
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,36 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"data, code", | ||
[ | ||
pytest.param( | ||
{'service_uuid': 1, | ||
'username': 'mehmet'}, | ||
200, | ||
id="SERVICE Endpoint - 200 Success", | ||
), | ||
pytest.param( | ||
{"service_uuid": 2039, | ||
'username': "baran"}, | ||
404, | ||
id="SERVICE Endpoint - 404 Not Found", | ||
), | ||
pytest.param( | ||
{"username": "mehmet", | ||
"type": "Github", | ||
"desc": "Github Demo"}, | ||
400, | ||
id="SERVICE Endpoint - 400 Bad Request" | ||
), | ||
pytest.param( | ||
None, | ||
415, | ||
id="SERVICE Endpoint - 415 Unsupported Media Type" | ||
) | ||
] | ||
) | ||
@pytest.mark.usefixtures("create_service") | ||
def test_service_revoke(client, data, code): | ||
response = client.put("/service/revoke", json=data) | ||
assert response.status_code == code |
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,37 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"data, code", | ||
[ | ||
pytest.param( | ||
{'service_uuid': 1, | ||
'username': 'mehmet', | ||
'name': 'new name'}, | ||
200, | ||
id="SERVICE Endpoint - 200 Success", | ||
), | ||
pytest.param( | ||
{"service_uuid": 2039, | ||
'username': "baran"}, | ||
404, | ||
id="SERVICE Endpoint - 404 Not Found", | ||
), | ||
pytest.param( | ||
{"username": "mehmet", | ||
"type": "Github", | ||
"desc": "Github Demo"}, | ||
400, | ||
id="SERVICE Endpoint - 400 Bad Request" | ||
), | ||
pytest.param( | ||
None, | ||
415, | ||
id="SERVICE Endpoint - 415 Unsupported Media Type" | ||
) | ||
] | ||
) | ||
@pytest.mark.usefixtures("create_service") | ||
def test_service_update(client, data, code): | ||
response = client.put("/service/", json=data) | ||
assert response.status_code == code |
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