diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..639900d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/Backend___Make_your_own_run_config__.xml b/.idea/runConfigurations/Backend___Make_your_own_run_config__.xml
index 096048f..13fbfcc 100644
--- a/.idea/runConfigurations/Backend___Make_your_own_run_config__.xml
+++ b/.idea/runConfigurations/Backend___Make_your_own_run_config__.xml
@@ -6,7 +6,7 @@
-
+
diff --git a/code/backend/nest_backend/test/repositories_test.py b/code/backend/nest_backend/test/repositories_test.py
new file mode 100644
index 0000000..70945c1
--- /dev/null
+++ b/code/backend/nest_backend/test/repositories_test.py
@@ -0,0 +1,41 @@
+import requests
+import json
+import unittest
+
+
+auth_code = ""
+
+
+class MyTestCase(unittest.TestCase):
+ def test_repository_create(self):
+ global auth_code
+ # TEST IN POST
+ r = requests.post('http://localhost:5000/api/v1/login', json={'email': 'utente_test@nest.com', 'password': 'password'})
+ j = json.loads(r.text)
+ assert j['result'] == "success"
+ auth_code = j['data']['access_token']
+
+ r = requests.post(f'http://localhost:5000/api/v1/repositories/', headers={'authorization': "Bearer " + auth_code},
+ json={})
+ j = json.loads(r.text)
+ assert j['result'] == "success"
+
+ print("Repository creata correttamente!")
+
+ # TEST IN GET
+ r = requests.post('http://localhost:5000/api/v1/login', json={'email': 'utente_test@nest.com', 'password': 'password'})
+ j = json.loads(r.text)
+ assert j['result'] == "success"
+ auth_code = j['data']['access_token']
+
+ r = requests.get(f'http://localhost:5000/api/v1/repositories/', headers={'authorization': "Bearer " + auth_code},
+ json={'owner_id': 'utente_test@nest.com', 'isActive': False})
+ j = json.loads(r.text)
+ assert j['result'] == "success"
+
+ for i in j:
+ print(j[i])
+
+
+print("Testing del metodo repository_create")
+
diff --git a/code/backend/nest_backend/test/repository_create_test.py b/code/backend/nest_backend/test/repository_create_test.py
deleted file mode 100644
index fa69d2c..0000000
--- a/code/backend/nest_backend/test/repository_create_test.py
+++ /dev/null
@@ -1,27 +0,0 @@
-import requests
-import json
-import unittest
-
-
-auth_code = ""
-
-
-class MyTestCase(unittest.TestCase):
- def test_repository_create(self):
- global auth_code
-
- r = requests.post('http://localhost:5000/api/login', json={'email': 'utente13@nest.com', 'password': ''})
- j = json.loads(r.text)
- assert j['result'] == "success"
- auth_code = j['data']['access_token']
-
- r = requests.post(f'http://localhost:5000/api/repository/create', headers={'authorization': "Bearer " + auth_code},
- json={'name': 'prova3', 'owner_id': 'email'})
- j = json.loads(r.text)
- assert j['result'] == "success"
-
- print("Repository_create eseguito correttamente!")
-
-
-print("Testing del metodo repository_create")
-
diff --git a/code/backend/nest_backend/test/user_create_test.py b/code/backend/nest_backend/test/user_create_test.py
deleted file mode 100644
index f8e4bcb..0000000
--- a/code/backend/nest_backend/test/user_create_test.py
+++ /dev/null
@@ -1,45 +0,0 @@
-import unittest
-import requests
-import json
-
-
-auth_code = ""
-
-
-class MyTestCase(unittest.TestCase):
- def test_user_create(self):
- global auth_code
-
- # testo come admin: successo
- r = requests.post('http://localhost:5000/api/login', json={'email': 'admin@admin.com', 'password': 'password'})
- j = json.loads(r.text)
- assert j['result'] == "success"
- auth_code = j['data']['access_token']
-
- r = requests.post(f'http://localhost:5000/api/user/create', headers={'authorization': "Bearer " + auth_code},
- json={'email': 'utente_test@nest.com', 'password': 'password', 'username': 'utente_test'})
- j = json.loads(r.text)
- assert j['result'] == "success"
-
-
- # testo come utente normale: fallisce
- auth_code = ""
- r = requests.post('http://localhost:5000/api/login', json={'email': 'utente_test@nest.com', 'password': 'password'})
- j = json.loads(r.text)
- assert j['result'] == "success"
- auth_code = j['data']['access_token']
-
- r = requests.post(f'http://localhost:5000/api/user/create', headers={'authorization': "Bearer " + auth_code},
- json={'email': 'utente_test_2@nest.com', 'password': 'password', 'username': 'utente_test_2'})
- j = json.loads(r.text)
- assert j['result'] == "failure"
-
- print("User_create eseguito correttamente!")
-
-
-print("Testing del metodo user_create")
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/code/backend/nest_backend/test/users_test.py b/code/backend/nest_backend/test/users_test.py
new file mode 100644
index 0000000..aded5dc
--- /dev/null
+++ b/code/backend/nest_backend/test/users_test.py
@@ -0,0 +1,71 @@
+import unittest
+import requests
+import json
+
+
+auth_code = ""
+
+
+class MyTestCase(unittest.TestCase):
+ def test_user_create(self):
+ global auth_code
+ # TEST IN POST
+ # User autenticato come Admin: successo
+ r = requests.post('http://localhost:5000/api/v1/login', json={'email': 'admin@admin.com', 'password': 'password'})
+ j = json.loads(r.text)
+ assert j['result'] == "success"
+ auth_code = j['data']['access_token']
+
+ r = requests.post(f'http://localhost:5000/api/v1/users', headers={'authorization': "Bearer " + auth_code},
+ json={'email': 'utente_test@nest.com', 'password': 'password', 'username': 'utente_test'})
+ j = json.loads(r.text)
+ assert j['result'] == "success"
+ print("User creato correttamente!")
+
+
+ # User autenticato come non-Admin: fallisce
+ auth_code = ""
+ r = requests.post('http://localhost:5000/api/v1/login', json={'email': 'utente20@nest.com', 'password': 'password'})
+ j = json.loads(r.text)
+ assert j['result'] == "success"
+ auth_code = j['data']['access_token']
+
+ r = requests.post(f'http://localhost:5000/api/v1/users', headers={'authorization': "Bearer " + auth_code},
+ json={'email': 'utente_test_2@nest.com', 'password': 'password', 'username': 'utente_test_2'})
+ j = json.loads(r.text)
+ assert j['result'] == "failure"
+
+ print("User non creato correttamente!")
+
+ # TEST IN GET
+ # User autenticato come Admin
+ r = requests.post('http://localhost:5000/api/v1/login', json={'email': 'admin@admin.com', 'password': 'password'})
+ j = json.loads(r.text)
+ assert j['result'] == "success"
+ auth_code = j['data']['access_token']
+
+ r = requests.get(f'http://localhost:5000/api/v1/users', headers={'authorization': "Bearer " + auth_code})
+ j = json.loads(r.text)
+ assert j['result'] == "success"
+
+ for i in j:
+ print(j[i])
+
+ # User autenticato come non-Admin
+ r = requests.post('http://localhost:5000/api/v1/login', json={'email': 'utente_test@nest.com', 'password': 'password'})
+ j = json.loads(r.text)
+ assert j['result'] == "success"
+ auth_code = j['data']['access_token']
+
+ r = requests.get(f'http://localhost:5000/api/v1/users', headers={'authorization': "Bearer " + auth_code})
+ j = json.loads(r.text)
+ assert j['result'] == "failure"
+
+
+print("Testing del metodo user_create")
+
+
+if __name__ == '__main__':
+ unittest.main()
+
+