def test_sends_correct_output_parameters_when_explicitly_set( self, m: Mocker): m.post('/job', text=RESPONSE_JOB_RUNNING, status_code=201) piazza.execute('test-service-id', {}, [{'boo': 'baz'}]) self.assertEqual([{ 'boo': 'baz' }], m.request_history[0].json()['data']['dataOutput'])
def test_sends_default_output_parameters(self, m: Mocker): m.post('/job', text=RESPONSE_JOB_RUNNING, status_code=201) piazza.execute('test-service-id', {}) self.assertEqual([{ 'mimeType': 'application/json', 'type': 'text' }], m.request_history[0].json()['data']['dataOutput'])
def test_returns_job_id(self, m: Mocker): m.post('/job', text=RESPONSE_JOB_RUNNING, status_code=201) job_id = piazza.execute('test-service-id', {'foo': 'bar'}, [{ 'boo': 'baz' }]) self.assertEqual('test-job-id', job_id)
def test_sends_correct_input_parameters(self, m: Mocker): m.post('/job', text=RESPONSE_JOB_RUNNING, status_code=201) piazza.execute('test-service-id', {'foo': 'bar'}) self.assertEqual({'foo': 'bar'}, m.request_history[0].json()['data']['dataInputs'])
def test_sends_correct_service_id(self, m: Mocker): m.post('/job', text=RESPONSE_JOB_RUNNING, status_code=201) piazza.execute('test-service-id', {}) self.assertEqual('test-service-id', m.request_history[0].json()['data']['serviceId'])
def test_calls_correct_url(self, m: Mocker): m.post('/job', text=RESPONSE_JOB_RUNNING, status_code=201) piazza.execute('test-service-id', {}) self.assertEqual('https://test-piazza-host.localdomain/job', m.request_history[0].url)