Exemple #1
0
    def test_should_add_product(self):
        product = Product(warehouse_id=1,
                          code="Some Code",
                          description="Optional description",
                          price=10)
        product.add()

        self.assertIn(product, self.db.session)
class WarehouseViewTest(WarehouseTest):
    def setUp(self):
        WarehouseTest.setUp(self)
        self.create_test_users()
        self.product = Product(warehouse_id=self.warehouse.id,
                               code="Test Product",
                               description="Test Description",
                               price=1)
        self.product.add()
Exemple #3
0
    def test_should_not_return_error_given_product_already_in_database(self):
        product = Product(warehouse_id=1,
                          code="Unique Code",
                          description="Optional description",
                          price=10)
        product.add()
        error = product.validation.validate_unique_values()

        self.assertEqual(error, None)
class ProductTest(Test):
    def setUp(self):
        Test.setUp(self)
        self.warehouse = Warehouse(name="Test Warehouse")
        self.warehouse.add()
        self.product = Product(warehouse_id=self.warehouse.id,
                               code="Test Code",
                               description="Optional description",
                               price=10)
        self.product.add()
Exemple #5
0
class ReceiptTest(Test):
    def setUp(self):
        Test.setUp(self)
        self.customer = Customer(customer_name="Test Name",
                                 address="Test Address",
                                 rfc="Test RFC")
        self.customer.add()
        self.product_1 = Product(warehouse_id=1, code="Code 1", price=10)
        self.product_1.add()
        self.product_2 = Product(warehouse_id=1, code="Code 2", price=10)
        self.product_2.add()
        self.receipt = Receipt(customer_id=self.customer.id)
        self.receipt.add()
class FinishedProductTest(Test):

    def setUp(self):
        Test.setUp(self)
        self.product = Product(
            warehouse_id=1,
            code="Test Code",
            description="Optional description",
            price=10
        )
        self.product.add()
        self.finished_product = FinishedProduct(
            product_id=self.product.id,
            quantity=1,
            unit="pz"
        )
        self.finished_product.add()