Skip to content
Snippets Groups Projects

Fixes for MultipleChoiceOption and FeedbackOption API

Merged Ghost User requested to merge fix/delete-feedback-mco into develop
All threads resolved!
@@ -54,16 +54,28 @@ def test_not_present(test_client, add_test_data):
assert data['status'] == 404
def test_problem_not_present(test_client, add_test_data):
req_json = {
'x': 100,
'y': 40,
'problem_id': 99,
'page': 1,
'label': 'a',
'name': 'test'
}
result = test_client.put('/api/mult-choice/', data=req_json)
data = json.loads(result.data)
assert data['status'] == 404
def test_add(test_client, add_test_data):
req = mco_json()
response = test_client.put('/api/mult-choice/', data=req)
response = test_client.put('/api/mult-choice/', data=req)
data = json.loads(response.data)
assert data['message'] == 'New multiple choice question with id 2 inserted. ' \
+ 'New feedback option with id 1 inserted.'
assert data['mult_choice_id'] == 2
assert data['status'] == 200
@@ -73,6 +85,8 @@ def test_add_get(test_client, add_test_data):
response = test_client.put('/api/mult-choice/', data=req)
data = json.loads(response.data)
assert data['mult_choice_id']
id = data['mult_choice_id']
result = test_client.get(f'/api/mult-choice/{id}')
@@ -91,11 +105,14 @@ def test_add_get(test_client, add_test_data):
assert exp_resp == data
def test_update_put(test_client, add_test_data):
def test_update_patch(test_client, add_test_data):
req = mco_json()
response = test_client.put('/api/mult-choice/', data=req)
data = json.loads(response.data)
assert data['mult_choice_id']
id = data['mult_choice_id']
req2 = {
Loading