mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-25 06:24:19 +00:00
aggiunti test sui tweet
This commit is contained in:
parent
7b409cd3c2
commit
3f3f1066ca
1 changed files with 25 additions and 0 deletions
25
nest_backend/test/test_6_tweet.py
Normal file
25
nest_backend/test/test_6_tweet.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
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
|
Loading…
Reference in a new issue