1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 06:24:19 +00:00
pds-2021-g2-nest/nest_backend/test/test_6_tweet.py
2021-05-28 19:01:55 +02:00

25 lines
1.1 KiB
Python

from flask.testing import Client
'''A file that contains tests classes and methods for all the requests concerning Tweets.'''
# TODO capire come passare i Tweet nell'URL
class TestTweetGet:
def test_for_success(self, flask_client: Client, user_headers):
r = flask_client.get(f'/api/v1/repositories/1/tweets/', headers=user_headers)
assert r.status_code == 200
assert r.json["result"] == "success"
def test_repository_not_found(self, flask_client: Client, user_headers):
r = flask_client.get(f'/api/v1/repositories/99/tweets/', headers=user_headers)
assert r.status_code == 404
assert r.json["result"] == "failure"
def test_user_wrong_owner(self, flask_client: Client, user_headers):
r = flask_client.get(f'/api/v1/repositories/2/tweets/', headers=user_headers)
assert r.status_code == 403
assert r.json["result"] == "failure"
def test_user_not_logged(self, flask_client: Client, ):
r = flask_client.get(f'/api/v1/repositories/2/tweets/')
assert r.status_code == 401