def test_pending_pages_1(self): mock_response = load_fixture_file('job_queues_1.json') self.query._get_job_status_id = MagicMock() self.query._get_job_status_id.return_value = 1 self.query.emop_api.get_request = MagicMock() self.query.emop_api.get_request.return_value = mock_response retval = self.query.pending_pages(q_filter='{"batch_id": 1}') self.assertEqual(mock_response['results'], retval)
def test_stage_in_data_1(self): data = load_fixture_file('job_queues_1.json') expected_files = [ "/data/shared/text-xml/EEBO-TCP-pages-text/e0006/40099/2.txt", "/data/eebo/e0006/40099/00001.000.001.tif", "/data/eebo/e0006/40099/00002.000.001.tif", "/data/shared/text-xml/EEBO-TCP-pages-text/e0006/40099/1.txt", ] self.transfer.stage_in_files = MagicMock() self.transfer.stage_in_data(data['results']) self.transfer.stage_in_files.assert_called_once_with(files=expected_files, wait=False)
def test_pending_pages_2(self): mock_response = load_fixture_file('job_queues_1.json') expected = [ { 'page': { "pg_ground_truth_file": "/data/shared/text-xml/EEBO-TCP-pages-text/e0006/40099/1.txt", 'pg_image_path': '/data/eebo/e0006/40099/00001.000.001.tif', }, }, { 'page': { "pg_ground_truth_file": "/data/shared/text-xml/EEBO-TCP-pages-text/e0006/40099/2.txt", 'pg_image_path': '/data/eebo/e0006/40099/00002.000.001.tif', }, }, ] self.query._get_job_status_id = MagicMock() self.query._get_job_status_id.return_value = 1 self.query.emop_api.get_request = MagicMock() self.query.emop_api.get_request.return_value = mock_response retval = self.query.pending_pages(q_filter='{"batch_id": 1}', r_filter='page.pg_image_path,pg_ground_truth_file') self.maxDiff = None self.assertEqual(expected, retval)
def test_get_endpoint_data(self): data = load_fixture_file('globus_endpoint_data.json') self.globus._api_call = MagicMock(return_value=data) retval = self.globus.get_endpoint_data(endpoint='go#ep1') self.globus._api_call.assert_called_once_with(descr='endpoint go#ep1', func='endpoint', endpoint_name='go#ep1') self.assertEqual(data, retval)