Пример #1
0
    def test_goods_attribute_is_working_properly(self):
        """testing if the goods attribute is working properly
        """
        client1 = Client(**self.kwargs)
        from stalker.models.budget import Good
        good1 = Good(name='Test Good 1')
        good2 = Good(name='Test Good 2')
        good3 = Good(name='Test Good 3')
        client1.goods = [good1, good2, good3]

        assert client1.goods == [good1, good2, good3]
Пример #2
0
 def test_cost_attribute_is_None(self):
     """testing if the cost attribute will be 0.0 if it is set to None
     """
     g = Good(**self.kwargs)
     assert g.cost != 0
     g.cost = None
     assert g.cost == 0
Пример #3
0
 def test_msrp_attribute_is_None(self):
     """testing if the msrp attribute will be 0.0 if it is set to None
     """
     g = Good(**self.kwargs)
     self.assertNotEqual(g.msrp, 0)
     g.msrp = None
     self.assertEqual(g.msrp, 0)
Пример #4
0
 def test_cost_attribute_is_zero(self):
     """testing if it is totally ok to test the cost attribute to 0
     """
     g = Good(**self.kwargs)
     self.assertNotEqual(g.cost, 0.0)
     g.cost = 0.0
     self.assertEqual(g.cost, 0.0)
Пример #5
0
 def test_cost_attribute_is_None(self):
     """testing if the cost attribute will be 0.0 if it is set to None
     """
     g = Good(**self.kwargs)
     self.assertNotEqual(g.cost, 0)
     g.cost = None
     self.assertEqual(g.cost, 0)
Пример #6
0
 def test_msrp_attribute_is_zero(self):
     """testing if it is totally ok to test the msrp attribute to 0
     """
     g = Good(**self.kwargs)
     assert g.msrp != 0.0
     g.msrp = 0.0
     assert g.msrp == 0.0
Пример #7
0
 def test_msrp_attribute_is_zero(self):
     """testing if it is totally ok to test the msrp attribute to 0
     """
     g = Good(**self.kwargs)
     self.assertNotEqual(g.msrp, 0.0)
     g.msrp = 0.0
     self.assertEqual(g.msrp, 0.0)
Пример #8
0
 def test_unit_argument_is_skipped(self):
     """testing if the unit attribute will be an empty string if the unit
     argument is skipped
     """
     self.kwargs.pop('unit')
     g = Good(**self.kwargs)
     assert g.unit == ''
Пример #9
0
 def test_client_argument_is_skipped(self):
     """testing if a Good can be created without a Client
     """
     self.kwargs.pop('client', None)
     g = Good(**self.kwargs)
     assert g is not None
     assert isinstance(g, Good)
Пример #10
0
 def test_unit_argument_is_None(self):
     """testing if the unit attribute will be an empty string if the unit
     argument is None
     """
     self.kwargs['unit'] = None
     g = Good(**self.kwargs)
     assert g.unit == ''
Пример #11
0
 def test_cost_attribute_is_zero(self):
     """testing if it is totally ok to test the cost attribute to 0
     """
     g = Good(**self.kwargs)
     assert g.cost != 0.0
     g.cost = 0.0
     assert g.cost == 0.0
Пример #12
0
 def test_msrp_attribute_is_None(self):
     """testing if the msrp attribute will be 0.0 if it is set to None
     """
     g = Good(**self.kwargs)
     assert g.msrp != 0
     g.msrp = None
     assert g.msrp == 0
Пример #13
0
 def test_cost_argument_is_skipped(self):
     """testing if the cost attribute value will be 0.0 if the cost argument
     is skipped
     """
     self.kwargs.pop('cost')
     g = Good(**self.kwargs)
     assert g.cost == 0
Пример #14
0
 def test_msrp_argument_is_None(self):
     """testing if the msrp attribute value will be 0.0 if the msrp argument
     is None
     """
     self.kwargs['msrp'] = None
     g = Good(**self.kwargs)
     assert g.msrp == 0
Пример #15
0
 def test_msrp_argument_is_skipped(self):
     """testing if the msrp attribute value will be 0.0 if the msrp argument
     is skipped
     """
     self.kwargs.pop('msrp')
     g = Good(**self.kwargs)
     assert g.msrp == 0
Пример #16
0
 def test_cost_argument_is_None(self):
     """testing if the cost attribute value will be 0.0 if the cost argument
     is None
     """
     self.kwargs['cost'] = None
     g = Good(**self.kwargs)
     assert g.cost == 0
Пример #17
0
 def test_client_argument_is_none(self):
     """testing if a Good can be created without a Client
     """
     self.kwargs['client'] = None
     g = Good(**self.kwargs)
     assert g is not None
     assert isinstance(g, Good)
Пример #18
0
 def test_unit_attribute_is_working_properly(self):
     """testing if the unit attribute value can be changed properly
     """
     test_value = 'this is my unit'
     g = Good(**self.kwargs)
     assert g.unit != test_value
     g.unit = test_value
     assert g.unit == test_value
Пример #19
0
 def test_unit_argument_is_working_properly(self):
     """testing if the unit argument value is properly passed to the unit
     attribute
     """
     test_value = 'this is my unit'
     self.kwargs['unit'] = test_value
     g = Good(**self.kwargs)
     assert g.unit == test_value
Пример #20
0
 def test_unit_attribute_is_set_to_None(self):
     """testing if the unit attribute will be an empty string if it is set
     to None
     """
     g = Good(**self.kwargs)
     assert g.unit != ''
     g.unit = None
     assert g.unit == ''
Пример #21
0
 def test_cost_argument_is_working_properly(self):
     """testing if the cost argument value is properly passed to the cost
     attribute
     """
     test_value = 113
     self.kwargs['cost'] = test_value
     g = Good(**self.kwargs)
     assert g.cost == test_value
Пример #22
0
 def test_unit_attribute_is_working_properly(self):
     """testing if the unit attribute value can be changed properly
     """
     test_value = 'this is my unit'
     g = Good(**self.kwargs)
     self.assertNotEqual(g.unit, test_value)
     g.unit = test_value
     self.assertEqual(g.unit, test_value)
Пример #23
0
 def test_client_argument_is_working_properly(self):
     """testing if the client argument is working properly
     """
     from stalker.models.client import Client
     client = Client(name='Test Client')
     self.kwargs['client'] = client
     g = Good(**self.kwargs)
     assert g.client == client
Пример #24
0
 def test_msrp_attribute_is_working_properly(self):
     """testing if the msrp attribute value can be properly changed
     """
     test_value = 145
     g = Good(**self.kwargs)
     self.assertNotEqual(g.msrp, test_value)
     g.msrp = test_value
     self.assertEqual(g.msrp, test_value)
Пример #25
0
 def test_msrp_argument_is_working_properly(self):
     """testing if the msrp argument value is properly passed to the msrp
     attribute
     """
     test_value = 113
     self.kwargs['msrp'] = test_value
     g = Good(**self.kwargs)
     assert g.msrp == test_value
Пример #26
0
 def test_unit_attribute_is_set_to_None(self):
     """testing if the unit attribute will be an empty string if it is set
     to None
     """
     g = Good(**self.kwargs)
     self.assertNotEqual(g.unit, '')
     g.unit = None
     self.assertEqual(g.unit, '')
Пример #27
0
    def test_cost_attribute_is_working_properly(self):
        """testing if the cost attribute value can be properly changed
        """
        test_value = 145
        g = Good(**self.kwargs)
        assert g.cost != test_value

        g.cost = test_value
        assert g.cost == test_value
Пример #28
0
 def test_client_attribute_is_working_properly(self):
     """testing if the client attribute is working properly
     """
     from stalker.models.client import Client
     client = Client(name='Test Client')
     g = Good(**self.kwargs)
     assert g.client != client
     g.client = client
     assert g.client == client
Пример #29
0
    def test_cost_argument_is_negative(self):
        """testing if a ValueError will be raised if the cost argument is a
        negative number
        """
        self.kwargs['cost'] = -10
        with pytest.raises(ValueError) as cm:
            g = Good(**self.kwargs)

        assert str(cm.value) == 'Good.cost should be a non-negative number'
Пример #30
0
    def test_msrp_attribute_is_working_properly(self):
        """testing if the msrp attribute value can be properly changed
        """
        test_value = 145
        g = Good(**self.kwargs)
        assert g.msrp != test_value

        g.msrp = test_value
        assert g.msrp == test_value