def test_create_trigger_no_retry_count(self, m): path = '/organizations/{}/deployments/{}/triggers'.format( ORGANIZATION_ID, DEPLOYMENT_ID) m.post(path, json=TRIGGER_RES) client = APIClient() res = client.create_trigger(organization_id=ORGANIZATION_ID, deployment_id=DEPLOYMENT_ID, version_id=VERSION_ID, input_service_name=INPUT_SERVICE_NAME, input_service_id=CHANNEL_ID, model_id=TRAINING_MODEL_ID, distribution=DISTRIBUTION, environment=ENVIRONMENT) expected_payload = { 'environment': ENVIRONMENT, 'input_service_name': INPUT_SERVICE_NAME, 'input_service_id': CHANNEL_ID, 'distribution': DISTRIBUTION, 'version_id': VERSION_ID, 'models': { 'alias': TRAINING_MODEL_ID } } self.assertDictEqual(m.request_history[0].json(), expected_payload) self.assertDictEqual(res, TRIGGER_RES)
def test_get_triggers(self, m): path = '/organizations/{}/deployments/{}/triggers'.format( ORGANIZATION_ID, DEPLOYMENT_ID) m.get(path, json=TRIGGER_LIST_RES) client = APIClient() res = client.get_triggers(organization_id=ORGANIZATION_ID, deployment_id=DEPLOYMENT_ID) self.assertDictEqual(res, TRIGGER_LIST_RES)
def test_delete_trigger(self, m): path = '/organizations/{}/deployments/{}/triggers/{}'.format( ORGANIZATION_ID, DEPLOYMENT_ID, TRIGGER_ID) m.delete(path, json={"message": "tri-3333333333333333 deleted"}) client = APIClient() res = client.delete_trigger(organization_id=ORGANIZATION_ID, deployment_id=DEPLOYMENT_ID, trigger_id=TRIGGER_ID) self.assertDictEqual(res, {"message": "tri-3333333333333333 deleted"})