Get jsonschema from questions JSON

This commit is contained in:
Aarni Halinen
2020-06-15 19:18:57 +03:00
parent 2e11621e5b
commit 0edde936cc
3 changed files with 56 additions and 5 deletions
+4 -4
View File
@@ -20,7 +20,7 @@ class SignupTestCase(APITestCase):
self.hiddenForm = createSignupForm(visible=False)
self.signup1 = createSignupObject(self.signupForm, ALL_QUESTION_TYPES)
self.signup2 = createSignupObject(self.signupForm, [])
self.signup2 = createSignupObject(self.signupForm, ALL_QUESTION_TYPES)
username, password = "test_admin", "password123"
self.authClient = User.objects.create_superuser(username, "myemail@test.com", password)
@@ -58,7 +58,6 @@ class SignupTestCase(APITestCase):
def test_create_signup(self):
new = createSignupJSON(self.signupForm.id, ALL_QUESTION_TYPES_ANSWER)
response = self.client.post(URL, new, format="json")
print(response.data)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(Signup.objects.count(), 3)
@@ -77,10 +76,11 @@ class SignupTestCase(APITestCase):
def test_get_hidden_forms_admin(self):
pass
@skip("NotImplemented")
def test_create_malformed_answer(self):
response = self.client.post(URL, createSignupJSON(self.signupForm.id, []), format="json")
malformed = createSignupJSON(self.signupForm.id, [])
response = self.client.post(URL, malformed, format="json")
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(Signup.objects.count(), 2)
# Update and Delete are available for super admin (Django Admin)
# and to the user that signed up (uid token)