def test_get_absent_flow(self): flow_id = '23f11ab7-e071-4997-97f3-ace07bb9e56d' self.proxy_manager.get_flow.side_effect = exceptions.UnexistentFlowError( flow_id) response = self.fetch(self.get_url(f'/flows/{flow_id}')) self.assertEqual(response.code, 404) self.proxy_manager.get_flow.assert_called_once_with(flow_id)
def test_absent_error(self): flow_id = '23f11ab7-e071-4997-97f3-ace07bb9e56d' self.proxy_manager.duplicate_flow.side_effect = exceptions.UnexistentFlowError(flow_id) response = self.fetch( self.get_url(f'/flows/{flow_id}/duplicate'), method='POST', body=b'', ) self.assertEqual(response.code, 404) self.proxy_manager.duplicate_flow.assert_called_once_with(flow_id)
def test_delete_absent_flow(self): flow_id = '23f11ab7-e071-4997-97f3-ace07bb9e56d' self.proxy_manager.remove_flow.side_effect = exceptions.UnexistentFlowError( flow_id) response = self.fetch( self.get_url(f'/flows/{flow_id}'), method='DELETE', ) self.assertEqual(response.code, 404) self.proxy_manager.remove_flow.assert_called_once_with(flow_id) self.assertMatchSnapshot(json.loads(response.body))
def test_update_absent_flow(self): flow_id = '23f11ab7-e071-4997-97f3-ace07bb9e56d' flow_data = {'flow': 'data'} self.proxy_manager.update_flow.side_effect = exceptions.UnexistentFlowError(flow_id) response = self.fetch( self.get_url(f'/flows/{flow_id}'), method='PUT', body=json.dumps(flow_data), headers={'Content-Type': 'application/json'}, ) self.assertEqual(response.code, 404) self.proxy_manager.update_flow.assert_called_once_with(flow_id, flow_data)