Skip to content
Snippets Groups Projects
Commit 883ba89f authored by iggy's avatar iggy Committed by s2536528
Browse files

Deleted and Added a branch, due to lack of manage.py

parent 05b2fac9
Branches
No related tags found
No related merge requests found
......@@ -13,5 +13,21 @@
"year": 2018,
"is_primary": true
}
},
{
"model": "MySU.studyrecord",
"pk": 2,
"fields": {
"slug": "89ac22dc-5a71-4fac-8af4-7544b7eb71a1",
"study": 1,
"institution": 1,
"student": 2,
"phase": "Bachelor",
"date_start": "2017-09-01",
"date_end": "2018-08-31",
"year": 2018,
"is_primary": true
}
}
]
from rest_framework.test import APIClient
from rest_framework.test import APITestCase
from apps.MySU.viewsets import association
from apps.MySU.models import User
from tests.tests import fixtures
......@@ -13,10 +14,6 @@ class AssociationTestCase(APITestCase):
self.client = APIClient()
self.client.force_authenticate(user=self.user)
def test_get_helios(self):
response = self.client.get('/associations/rising-sun-alienship-helios')
self.assertEqual(200, response.status_code)
def test_put_helios(self):
response = self.client.put('/associations/rising-sun-alienship-helios', data={})
self.assertEqual(403, response.status_code)
......
......@@ -3,6 +3,8 @@ from rest_framework.test import APITestCase
from apps.MySU.models import User
from tests.tests import fixtures
from rest_framework.parsers import JSONParser
from apps.MySU.serializers import AssociationSpecificDataSerializer
class AssociationSpecificDataTestCase(APITestCase):
......@@ -14,7 +16,9 @@ class AssociationSpecificDataTestCase(APITestCase):
self.client.force_authenticate(user=self.user)
def test_put_helios(self):
pass
response = self.client.get('/association_data_fields')
self.assertEqual(200, response.status_code)
def test_put_student_union(self):
pass
......@@ -29,7 +33,14 @@ class AssociationSpecificDataTestCase(APITestCase):
pass
def test_post_student_union(self):
pass
data = {
'value': '67',
'association': 'test_association',
'membership': 'test_membership',
'data_field': 'custom data'
}
response = self.client.post("/association_data/", data=data)
self.assertEqual(201, response.status_code)
def test_delete_helios(self):
pass
......
......@@ -13,15 +13,6 @@ class StudyTestCase(APITestCase):
self.client = APIClient()
self.client.force_authenticate(user=self.user)
def test_put(self):
pass
def test_patch(self):
pass
def test_post(self):
pass
def test_get(self):
response = self.client.get('/studies/89ac22dc-5a71-4fac-8af4-5844b7eb71a1')
self.assertEqual(200, response.status_code, "Error: {}, Input: study pk 1".format(response.data))
......
from rest_framework.test import APIClient
from rest_framework.test import APITestCase
from apps.MySU.models import StudyRecord
from apps.MySU.serializers import StudyRecordSerializer
from apps.MySU.models import User
from tests.tests import fixtures
......@@ -12,18 +14,12 @@ class StudyRecordsTestCase(APITestCase):
self.user = User.objects.get(username='s1234567')
self.client = APIClient()
self.client.force_authenticate(user=self.user)
StudyRecord.objects.create(phase="Bachelor", year="2020", date_start="2018-09-01", date_end="2020-07-05", is_primary=True, institution_id="1", student_id="2", study_id="1")
def test_put(self):
pass
def test_get_self(self):
response = self.client.get('/studyrecords/89ac22dc-5a71-4fac-8af4-5844b7eb71a1')
self.assertEqual(200,response.status_code)
def test_patch(self):
pass
def test_post(self):
pass
def test_get(self):
pass
def test_list(self):
response = self.client.get('/studyrecords')
......
......@@ -14,18 +14,14 @@ class UserTestCase(APITestCase):
self.client.force_authenticate(user=self.user)
def test_put_self(self):
# TODO make proper request
pass
# data = {'student_number': 's7654321'}
# response = self.client.put('/users/efc00c85-87a8-446d-ad71-2d2d07d4b588', data=data)
# self.assertEqual(400, response.status_code, "Error: {}, Input: Other student number".format(response.data))
data = {'student_number': 's7654321'}
response = self.client.put('/users/efc00c85-87a8-446d-ad71-2d2d07d4b588', data=data)
self.assertEqual(200, response.status_code, "Error: {}, Input: Other student number".format(response.data))
def test_put_other(self):
# TODO make proper request
pass
# data = {'student_number': 's7654321'}
# response = self.client.put('/users/5b5742e6-b52b-4133-8151-a49d7b186026')
# self.assertEqual(404, response.status_code, "Error: {}, Input: Other student number".format(response.data))
data = {'student_number': 's7654321'}
response = self.client.put('/users/5b5742e6-b52b-4133-8151-a49d7b186026', data=data)
self.assertEqual(404, response.status_code, "Error: {}, Input: Other student number".format(response.data))
def test_patch_self(self):
data = {
......@@ -43,9 +39,6 @@ class UserTestCase(APITestCase):
response = self.client.patch('/users/5b5742e6-b52b-4133-8151-a49d7b186026', data=data)
self.assertEqual(404, response.status_code, "Error: {}, Input: Other student number".format(response.data))
def test_post(self):
pass
def test_get_self(self):
response = self.client.get('/users/me')
self.assertEqual(200, response.status_code, "Error: {}, Input: user via user/me".format(response.data))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment