Skip to content
Snippets Groups Projects
Commit 7a16fc8f authored by Jörn Künsemöller's avatar Jörn Künsemöller
Browse files

Task LSMR-14: Fixed functional tests

parent 0fe58953
No related branches found
No related tags found
1 merge request!87Lsmr epic
...@@ -411,26 +411,30 @@ class WorkRelationSelectionTemplateTestCase(unittest.TestCase): ...@@ -411,26 +411,30 @@ class WorkRelationSelectionTemplateTestCase(unittest.TestCase):
class WorkIORoleTestCase(unittest.TestCase): class WorkIORoleTestCase(unittest.TestCase):
# test data def setUp(self):
test_data_1 = {"role": BASE_URL + '/role_choice/correlator/',
"datatype": BASE_URL + '/datatype_choice/image/', # related items
"dataformat": BASE_URL + '/dataformat_choice/HDF5/', url = POST_and_assert_expected_response(self, BASE_URL + '/work_request_template/',
"outputs": None, WorkRequestTemplateTestCase.test_data_1, 201,
"inputs": None, WorkRequestTemplateTestCase.test_data_1)['url']
"tags": []
} # test data
self.test_data_1 = {"role": BASE_URL + '/role_choice/correlator/',
test_data_2 = {"role": BASE_URL + '/role_choice/target/', "datatype": BASE_URL + '/datatype_choice/image/',
"datatype": BASE_URL + '/datatype_choice/visibilities/', "dataformat": BASE_URL + '/dataformat_choice/HDF5/',
"dataformat": BASE_URL + '/dataformat_choice/MeasurementSet/', "outputs": url,
"outputs": None, "inputs": url,
"inputs": None, "tags": []}
"tags": []
} self.test_data_2 = {"role": BASE_URL + '/role_choice/target/',
"datatype": BASE_URL + '/datatype_choice/visibilities/',
test_patch = {"role": BASE_URL + '/role_choice/calibrator/', "dataformat": BASE_URL + '/dataformat_choice/MeasurementSet/',
"dataformat": BASE_URL + '/dataformat_choice/MeasurementSet/' "outputs": url,
} "inputs": url,
"tags": []}
self.test_patch = {"role": BASE_URL + '/role_choice/calibrator/',
"dataformat": BASE_URL + '/dataformat_choice/MeasurementSet/'}
def test_work_io_role_list_apiformat(self): def test_work_io_role_list_apiformat(self):
r = requests.get(BASE_URL + '/work_io_role/?format=api') r = requests.get(BASE_URL + '/work_io_role/?format=api')
...@@ -478,17 +482,6 @@ class WorkIORoleTestCase(unittest.TestCase): ...@@ -478,17 +482,6 @@ class WorkIORoleTestCase(unittest.TestCase):
r_dict = POST_and_assert_expected_response(self, BASE_URL + '/work_io_role/', test_data_invalid, 400, {}) r_dict = POST_and_assert_expected_response(self, BASE_URL + '/work_io_role/', test_data_invalid, 400, {})
self.assertTrue('Invalid hyperlink' in str(r_dict['inputs'])) self.assertTrue('Invalid hyperlink' in str(r_dict['inputs']))
def test_work_io_role_POST_existing_inputs_works(self):
# First POST a new item to reference
r_dict = POST_and_assert_expected_response(self, BASE_URL + '/work_request_template/', WorkRequestTemplateTestCase.test_data_1, 201, WorkRequestTemplateTestCase.test_data_1,)
url = r_dict['url']
# POST a new item with correct reference
test_data_valid = dict(self.test_data_1)
test_data_valid['inputs'] = url
POST_and_assert_expected_response(self, BASE_URL + '/work_io_role/', test_data_valid, 201, test_data_valid)
def test_work_io_role_POST_nonexistant_outputs_raises_error(self): def test_work_io_role_POST_nonexistant_outputs_raises_error(self):
# POST a new item with wrong reference # POST a new item with wrong reference
......
...@@ -10,7 +10,7 @@ PORT=8777 ...@@ -10,7 +10,7 @@ PORT=8777
lsmr -p $PORT & lsmr -p $PORT &
DJANGO_PID=$! DJANGO_PID=$!
echo "Started Django server with PID: " $DJANGO_PID echo "Started Django server with PID: " $DJANGO_PID
sleep 3 sleep 15
# Run test # Run test
./t_functional.py ./t_functional.py
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment