mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-28 23:44:19 +00:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
027964825a
4 changed files with 67 additions and 7 deletions
|
@ -1,13 +1,13 @@
|
||||||
# Log riunioni collettive dello Sprint 2
|
# Log riunioni collettive dello Sprint 3
|
||||||
|
|
||||||
| Data | Ora | Durata | Attività |
|
| Data | Ora | Durata | Attività |
|
||||||
|------|-----|--------|----------|
|
|------|-----|--------|----------|
|
||||||
| | | | |
|
| | | | |
|
||||||
|
|
||||||
Totale generale di tutti i componenti: 12.0h
|
Totale generale di tutti i componenti: 12.5h
|
||||||
|
|
||||||
|
|
||||||
# Log attività individuali dello Sprint 2
|
# Log attività individuali dello Sprint 3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,8 +75,9 @@ Chiara Calzolari - UI Designer
|
||||||
| 24/05 | 2.0h | Traduzione UI
|
| 24/05 | 2.0h | Traduzione UI
|
||||||
| 24/05 | 1.0h | Traduzione UI
|
| 24/05 | 1.0h | Traduzione UI
|
||||||
| 25/05 | 1.0h | Traduzione UI
|
| 25/05 | 1.0h | Traduzione UI
|
||||||
|
| 27/05 | 0.5h | Traduzione UI
|
||||||
|-------|--------|
|
|-------|--------|
|
||||||
|totale| 12.0h |
|
|totale| 12.5h |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,44 @@ def page_repository(rid):
|
||||||
if repository.owner_id != user.email and not user.isAdmin:
|
if repository.owner_id != user.email and not user.isAdmin:
|
||||||
return json_error("You are not the owner of this repository.", REPOSITORY_NOT_OWNER), 403
|
return json_error("You are not the owner of this repository.", REPOSITORY_NOT_OWNER), 403
|
||||||
try:
|
try:
|
||||||
|
# Deleting Tweets...
|
||||||
|
tweets = [t.tweet for t in repository.tweets]
|
||||||
|
for tweet in tweets:
|
||||||
|
if len(tweet.repositories) < 2:
|
||||||
|
# Delete Tweets if only attached to this repo
|
||||||
|
for conn in tweet.repositories:
|
||||||
|
ext.session.delete(conn)
|
||||||
|
for conn in tweet.conditions:
|
||||||
|
ext.session.delete(conn)
|
||||||
|
ext.session.delete(tweet)
|
||||||
|
ext.session.commit()
|
||||||
|
else:
|
||||||
|
conns = [conn for conn in tweet.repositories if conn.rid == rid]
|
||||||
|
for conn in conns:
|
||||||
|
ext.session.delete(conn)
|
||||||
|
ext.session.commit()
|
||||||
|
# Deleting authorizations...
|
||||||
|
for auth in repository.authorizations:
|
||||||
|
ext.session.delete(auth)
|
||||||
|
ext.session.commit()
|
||||||
|
# Deleting conditions...
|
||||||
|
for condition in repository.conditions:
|
||||||
|
ext.session.delete(condition)
|
||||||
|
ext.session.commit()
|
||||||
|
# Deleting Alerts...
|
||||||
|
for alert in repository.alerts:
|
||||||
|
for elem in alert.conditions:
|
||||||
|
condition = elem.condition
|
||||||
|
ext.session.delete(elem)
|
||||||
|
ext.session.commit()
|
||||||
|
if not condition.repository_id:
|
||||||
|
ext.session.delete(condition)
|
||||||
|
ext.session.commit()
|
||||||
|
for notification in alert.notifications:
|
||||||
|
ext.session.delete(notification)
|
||||||
|
ext.session.commit()
|
||||||
|
ext.session.delete(alert)
|
||||||
|
ext.session.commit()
|
||||||
ext.session.delete(repository)
|
ext.session.delete(repository)
|
||||||
ext.session.commit()
|
ext.session.commit()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
@ -125,7 +125,7 @@ class TestRepositoryGet:
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert r.json["result"] == "success"
|
assert r.json["result"] == "success"
|
||||||
|
|
||||||
def test_get_non_existing_repository(self, flask_client: Client, admin_headers):
|
def test_repository_not_found(self, flask_client: Client, admin_headers):
|
||||||
r = flask_client.get(f'/api/v1/repositories/99', headers=admin_headers)
|
r = flask_client.get(f'/api/v1/repositories/99', headers=admin_headers)
|
||||||
assert r.status_code == 404
|
assert r.status_code == 404
|
||||||
assert r.json["result"] == "failure"
|
assert r.json["result"] == "failure"
|
||||||
|
|
|
@ -9,7 +9,7 @@ class TestAuthozitazionsGet:
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert r.json["result"] == "success"
|
assert r.json["result"] == "success"
|
||||||
|
|
||||||
def test_get_non_existing_repository(self, flask_client: Client, admin_headers):
|
def test_repository_not_found(self, flask_client: Client, admin_headers):
|
||||||
r = flask_client.get('/api/v1/repositories/99/authorizations/', headers=admin_headers)
|
r = flask_client.get('/api/v1/repositories/99/authorizations/', headers=admin_headers)
|
||||||
assert r.status_code == 404
|
assert r.status_code == 404
|
||||||
assert r.json["result"] == "failure"
|
assert r.json["result"] == "failure"
|
||||||
|
@ -66,7 +66,28 @@ class TestAuthorizationsPut:
|
||||||
r = flask_client.put(f'/api/v1/repositories/1/authorizations/')
|
r = flask_client.put(f'/api/v1/repositories/1/authorizations/')
|
||||||
assert r.status_code == 401
|
assert r.status_code == 401
|
||||||
|
|
||||||
def test_get_non_existing_repository(self, flask_client: Client, admin_headers):
|
def test_repository_not_found(self, flask_client: Client, admin_headers):
|
||||||
r = flask_client.post('/api/v1/repositories/99/authorizations/', headers=admin_headers)
|
r = flask_client.post('/api/v1/repositories/99/authorizations/', headers=admin_headers)
|
||||||
assert r.status_code == 404
|
assert r.status_code == 404
|
||||||
assert r.json["result"] == "failure"
|
assert r.json["result"] == "failure"
|
||||||
|
|
||||||
|
|
||||||
|
class TestAuthorizationsDelete:
|
||||||
|
def test_for_success(self, flask_client: Client, user_headers):
|
||||||
|
r = flask_client.delete(f'/api/v1/repositories/1/authorizations/user_test@nest.com', headers=user_headers)
|
||||||
|
assert r.status_code == 204
|
||||||
|
assert r.json["result"] == "success"
|
||||||
|
|
||||||
|
def test_user_not_logged(self, flask_client: Client):
|
||||||
|
r = flask_client.delete(f'/api/v1/repositories/1/authorizations/user_test@nest.com')
|
||||||
|
assert r.status_code == 401
|
||||||
|
|
||||||
|
def test_wrong_owner(self, flask_client: Client, admin_headers):
|
||||||
|
r = flask_client.delete(f'/api/v1/repositories/1/authorizations/user_test@nest.com', headers=admin_headers)
|
||||||
|
assert r.status_code == 403
|
||||||
|
assert r.json["result"] == "failure"
|
||||||
|
|
||||||
|
def test_repository_not_found(self, flask_client: Client, admin_headers):
|
||||||
|
r = flask_client.delete(f'/api/v1/repositories/99/authorizations/user_test@nest.com', headers=admin_headers)
|
||||||
|
assert r.status_code == 404
|
||||||
|
assert r.json["result"] == "failure"
|
||||||
|
|
Loading…
Reference in a new issue