def test_write_record_new(self): """Test that we can create a new record.""" entity = TaskConnectionEntity.get_mock_object() TaskConnectionRepository.write_record( TaskConnectionMapper.to_record(entity) ) connections = TaskConnectionRepository.fetch_connections_for_pipeline(entity.pipeline_id) self.assertEquals(connections[0].id, entity.id)
def test_write_task_connection(self): """Test that the provided entity gets written to the repository.""" entity = TaskConnectionEntity.get_mock_object() self.assertEquals( TaskConnectionService.fetch_task_connections_for_pipeline(entity.pipeline_id), [], ) TaskConnectionService.write_task_connection(entity) self.assertEquals( TaskConnectionService.fetch_task_connections_for_pipeline(entity.pipeline_id), [ entity, ], )