Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    def test_write_task(self):
        """Test that the provided entity gets written to the repository."""
        entity = TaskEntity.get_mock_object()

        with self.assertRaises(ResourceNotFoundException):
            TaskService.fetch_task_by_id(entity.id)

        TaskService.write_task(entity)

        self.assertEquals(
            TaskService.fetch_task_by_id(entity.id),
            entity,
        )