Commit d913f1bc authored by D.H.D. Nguyen's avatar D.H.D. Nguyen
Browse files

update tests

parent a2f39ada
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -102,7 +102,31 @@ def test_submit_valid_batch(test_client, init_database):
	assert b"Admin" in response.data
	assert b"Batch 1 successfully submitted!" in response.data

def test_reupload_same_valid_batch(test_client, init_database):
	"""
	GIVEN a Flask application
	WHEN a logged in annotator submits a valid annotation again for a submitted batch 
		at e.g. '/annotator/test/batch-1' page (POST)
	THEN check if:
		1. the response is valid (annotator is redirected to the project page) -> GET
		2. it renders the right template 
		(template 'templates/annotator/project.html' has page title of project name 'TEST'
		3. a message from Admin that this batch is already submitted pops up
	"""
	test_client.post('/annotator',
					 data=dict(keyword='ax7832ljf', name='jung'),
					 follow_redirects=True)

	response = test_client.post('/annotator/test/batch-1',
								data={"action":"submit", "question-1-best_item":'1', "question-1-worst_item":'3'}, 
								follow_redirects=True)
	# 1.
	assert response.status_code == 200
	# 2.
	assert b"TEST" in response.data
	# 3.
	assert b"Admin" in response.data
	assert b"Batch 1 already submitted!" in response.data



+1 −0
Original line number Diff line number Diff line
@@ -204,3 +204,4 @@ def test_upload_valid_project(test_client, init_database):
	# 2.
	assert b"JUNG" in response.data

	
 No newline at end of file