Exemplo n.º 1
0
    def test_happy_path(self, ctx, mock_product_repository: MagicMock,
                        product_manager: ProductManager):
        # When...
        product_manager.delete(ctx, TEST_PRODUCT_NAME)

        # Expect...
        mock_product_repository.delete_product.assert_called_once_with(
            ctx, TEST_PRODUCT_NAME)
Exemplo n.º 2
0
    def test_not_found(self, ctx, mock_product_repository: MagicMock,
                       product_manager: ProductManager):
        # Given...
        mock_product_repository.delete_product = MagicMock(
            side_effect=ProductNotFoundError)

        # When...
        with raises(ProductNotFoundError):
            product_manager.delete(ctx, TEST_PRODUCT_NAME)