Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @tag('incomplete') # Weird TypeError in question_answers under post method
- def test_crud_methods_on_submissions(self):
- # Tests that we can retrieve a list of submissions using get method
- self.client.login(username='user', password='pass')
- resp = self.client.get(path=reverse('api:submission-list', kwargs={'version': 'v1'}))
- assert resp.status_code == 200
- # Tests that we can post a new submission
- string = self.question.answer
- byte_string = str.encode(string)
- print(isinstance(byte_string, bytes))
- resp = self.client.post(path=reverse('api:submission-list', kwargs={'version': 'v1'}),
- data={"klass": self.klass.pk,
- "definition": self.definition.pk,
- "creator": self.instructor.pk,
- "submission_github_url": "",
- "method_name": "",
- "method_description": "",
- "project_url": "",
- "publication_url": "",
- "question_answers": byte_string})
- print(resp.content)
- assert resp.status_code == 201
- # Tests that we can't change any submissions info using put method
- resp = self.client.put(path=reverse('api:submission-detail', kwargs={'version': 'v1', 'pk': '2'}),
- data={"klass": '',
- "definition": '',
- "creator": '',
- "submission_github_url": "",
- "method_name": "",
- "method_description": "",
- "project_url": "",
- "publication_url": "",
- "question_answers": ''},
- content_type='application/json')
- assert resp.status_code == 200
- # Tests that we can't delete any submissions
- resp = self.client.delete(path=reverse('api:submission-detail', kwargs={'version': 'v1', 'pk': '2'}))
- assert resp.status_code == 204
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement