Style fixes
This commit is contained in:
+2
-1
@@ -136,7 +136,8 @@ class SignupForm(models.Model):
|
|||||||
"pattern": pattern
|
"pattern": pattern
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else: raise Exception("invalid question type!")
|
else:
|
||||||
|
raise Exception("invalid question type!")
|
||||||
|
|
||||||
ids = list(map(lambda x: x["id"], questions))
|
ids = list(map(lambda x: x["id"], questions))
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ ALL_QUESTION_TYPES = [
|
|||||||
{"id": "i10d426d5", "name": "Asd3", "type": "checkbox", "options": ["A", "B", "C"]}
|
{"id": "i10d426d5", "name": "Asd3", "type": "checkbox", "options": ["A", "B", "C"]}
|
||||||
]
|
]
|
||||||
|
|
||||||
ALL_QUESTION_TYPES_ANSWER = {"j5CeRZDvl": "Testi", "RHJhSoaLD": "maybe", "i10d426d5": ["B","C"]}
|
ALL_QUESTION_TYPES_ANSWER = {"j5CeRZDvl": "Testi", "RHJhSoaLD": "maybe", "i10d426d5": ["B", "C"]}
|
||||||
|
|
||||||
|
|
||||||
def createSignupForm(name="Form1", start_time=timezone.now(), end_time=month_from_now(), questions=ALL_QUESTION_TYPES, visible=True):
|
def createSignupForm(name="Form1", start_time=timezone.now(), end_time=month_from_now(), questions=ALL_QUESTION_TYPES, visible=True):
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class SignupTestCase(APITestCase):
|
|||||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
# Bad id
|
# Bad id
|
||||||
response = self.client.post(URL, createSignupRequest(self.signupFormText.id, { "malformed": "Tekstiä" }), format="json")
|
response = self.client.post(URL, createSignupRequest(self.signupFormText.id, {"malformed": "Tekstiä"}), format="json")
|
||||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
# Wrong data type for text
|
# Wrong data type for text
|
||||||
@@ -110,7 +110,7 @@ class SignupTestCase(APITestCase):
|
|||||||
|
|
||||||
# Wrong data type for checkbox
|
# Wrong data type for checkbox
|
||||||
response = self.client.post(URL, createSignupRequest(self.signupFormCheck.id, {
|
response = self.client.post(URL, createSignupRequest(self.signupFormCheck.id, {
|
||||||
"i10d426d5": {"j5CeRZDvl": { "asd": "123" }}
|
"i10d426d5": {"j5CeRZDvl": {"asd": "123"}}
|
||||||
}), format="json")
|
}), format="json")
|
||||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
@@ -122,13 +122,12 @@ class SignupTestCase(APITestCase):
|
|||||||
|
|
||||||
# Wrong data type for radiobutton
|
# Wrong data type for radiobutton
|
||||||
response = self.client.post(URL, createSignupRequest(self.signupFormRadio.id, {
|
response = self.client.post(URL, createSignupRequest(self.signupFormRadio.id, {
|
||||||
"RHJhSoaLD": { "asd": "123" }
|
"RHJhSoaLD": {"asd": "123"}
|
||||||
}), format="json")
|
}), format="json")
|
||||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
self.assertEqual(Signup.objects.count(), 2)
|
self.assertEqual(Signup.objects.count(), 2)
|
||||||
|
|
||||||
|
|
||||||
# Update and Delete are available for super admin (Django Admin)
|
# Update and Delete are available for super admin (Django Admin)
|
||||||
# and to the user that signed up (uid token)
|
# and to the user that signed up (uid token)
|
||||||
@skip("NotImplemented")
|
@skip("NotImplemented")
|
||||||
|
|||||||
Reference in New Issue
Block a user