-
Notifications
You must be signed in to change notification settings - Fork 108
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
Showing
10 changed files
with
73 additions
and
106 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,4 +1,3 @@ | ||
|
||
import requests | ||
from flask_restful import Resource, abort | ||
from flask import request, make_response | ||
|
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 |
---|---|---|
|
@@ -9,54 +9,12 @@ | |
from werkzeug.utils import secure_filename | ||
|
||
|
||
def register_user(client, email, username, password, firstname, lastname): | ||
return client.post( | ||
f"{client.config['REST_URI']}/user", | ||
data=json.dumps(dict( | ||
email=email, | ||
password=password, | ||
username=username, | ||
firstName=firstname, | ||
lastName=lastname | ||
)), | ||
content_type='application/json', | ||
) | ||
|
||
|
||
def login_user(client, username, password): | ||
return client.post( | ||
f"{client.config['REST_URI']}/session", | ||
data=json.dumps(dict( | ||
username=username, | ||
password=password | ||
)), | ||
content_type='application/json', | ||
) | ||
|
||
@pytest.fixture | ||
def mocked_responses(): | ||
with responses.RequestsMock() as rsps: | ||
yield rsps | ||
|
||
|
||
class TestRegistration: | ||
@staticmethod | ||
def test_user_registration(client): | ||
response = register_user(client, username='user', firstname="firstname", lastname="lastName", email='[email protected]', password='12345') | ||
data = json.loads(response.data.decode()) | ||
assert data["status"] == "success" | ||
|
||
@staticmethod | ||
def test_user_login(client, pytestconfig, caplog): | ||
response = register_user(client, username='user', firstname="firstname", lastname="lastName", | ||
email='[email protected]', password='12345') | ||
data = json.loads(response.data.decode()) | ||
assert data["status"] == "success" | ||
response = login_user(client, "user", "12345") | ||
data = json.loads(response.data.decode()) | ||
assert data["status"] == "success" | ||
|
||
|
||
class TestHostInfo: | ||
@staticmethod | ||
def test_host_info(client, pytestconfig, caplog): | ||
|
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