def test_write_record_update(self): """Test that we can write an updated record.""" # Assert task's config is not expected task = TaskRepository.fetch_task_by_id(self.url_task.id) self.assertNotEquals(task.config, {'url': 'hey'}) # Update tasks's config task.config = {'url': 'hey'} TaskRepository.write_record(task) # Assert tasks' config is as expected task = TaskRepository.fetch_task_by_id(self.url_task.id) self.assertEquals(task.config, {'url': 'hey'})
def test_write_record_update(self): """Test that we can write an updated record.""" # Assert task's config is not expected task = TaskRepository.fetch_task_by_id(self.url_task.id) self.assertNotEquals(task.config, {'url': 'hey'}) # Update tasks's config task.config = {'url': 'hey'} TaskRepository.write_record(task) # Assert tasks' config is as expected task = TaskRepository.fetch_task_by_id(self.url_task.id) self.assertEquals(task.config, {'url': 'hey'})
def test_write_record_new(self): """Test that we can create a new record.""" entity = TaskEntity.get_mock_object() TaskRepository.write_record(TaskMapper.to_record(entity)) task = TaskRepository.fetch_task_by_id(entity.id) self.assertEquals(task.id, entity.id)
def fetch_task_by_id(cls, id): """Fetch TaskEntity by id. :param str id: :returns TaskEntity: """ return TaskMapper.to_entity( TaskRepository.fetch_task_by_id(id), )
def test_write_record_new(self): """Test that we can create a new record.""" entity = TaskEntity.get_mock_object() TaskRepository.write_record( TaskMapper.to_record(entity) ) task = TaskRepository.fetch_task_by_id(entity.id) self.assertEquals(task.id, entity.id)
def test_fetch_task_by_id(self): """Test that a record can be retrieved from the datastore.""" self.assertEquals( TaskRepository.fetch_task_by_id(self.url_task.id), self.url_task, )
def test_fetch_task_by_id(self): """Test that a record can be retrieved from the datastore.""" self.assertEquals( TaskRepository.fetch_task_by_id(self.url_task.id), self.url_task, )