Example #1
0
 def test_unit_attribute_is_set_to_None(self):
     """testing if the unit attribute will be set to an empty if it is set
     to None
     """
     entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
     self.assertEqual(entry.unit, self.test_good.unit)
     entry.unit = None
     self.assertEqual(entry.unit, '')
Example #2
0
 def test_unit_attribute_is_working_properly(self):
     """testing if the unit attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
     test_value = 'TL/hour'
     assert entry.unit != test_value
     entry.unit = test_value
     assert entry.unit == test_value
Example #3
0
 def test_unit_attribute_is_set_to_None(self):
     """testing if the unit attribute will be set to an empty if it is set
     to None
     """
     entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
     self.assertEqual(entry.unit, self.test_good.unit)
     entry.unit = None
     self.assertEqual(entry.unit, '')
Example #4
0
 def test_unit_attribute_is_working_properly(self):
     """testing if the unit attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
     test_value = 'TL/hour'
     self.assertNotEqual(entry.unit, test_value)
     entry.unit = test_value
     self.assertEqual(entry.unit, test_value)
Example #5
0
 def test_unit_attribute_is_working_properly(self):
     """testing if the unit attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
     test_value = 'TL/hour'
     self.assertNotEqual(entry.unit, test_value)
     entry.unit = test_value
     self.assertEqual(entry.unit, test_value)
Example #6
0
 def test_cost_attribute_is_set_to_None(self):
     """testing if the cost attribute will be set to 0 if it is set to None
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
     )
     assert entry.cost == self.test_good.cost
     entry.cost = None
     assert entry.cost == 0.0
Example #7
0
 def test_price_attribute_is_working_properly(self):
     """testing if the price attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         price=10)
     test_value = 5.0
     assert entry.price != test_value
     entry.price = test_value
     assert entry.price == test_value
Example #8
0
 def test_amount_attribute_is_set_to_None(self):
     """testing if the amount attribute will be set to 0 if it is set to
     None
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         amount=10.0)
     self.assertEqual(entry.amount, 10.0)
     entry.amount = None
     self.assertEqual(entry.amount, 0.0)
Example #9
0
    def test_unit_attribute_is_not_a_string(self):
        """testing if a TypeError will be raised if the unit attribute is set
        to something other than a string
        """
        entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
        with pytest.raises(TypeError) as cm:
            entry.unit = 100.212

        assert str(cm.value) == \
            'BudgetEntry.unit should be a string, not float'
Example #10
0
 def test_cost_attribute_is_set_to_None(self):
     """testing if the cost attribute will be set to 0 if it is set to None
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
     )
     self.assertEqual(entry.cost, self.test_good.cost)
     entry.cost = None
     self.assertEqual(entry.cost, 0.0)
Example #11
0
 def test_amount_attribute_is_working_properly(self):
     """testing if the amount attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         amount=10)
     test_value = 5.0
     self.assertNotEqual(entry.amount, test_value)
     entry.amount = test_value
     self.assertEqual(entry.amount, test_value)
Example #12
0
 def test_realized_total_attribute_is_working_properly(self):
     """testing if the realized_total attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         realized_total=10)
     test_value = 5.0
     self.assertNotEqual(entry.realized_total, test_value)
     entry.realized_total = test_value
     self.assertEqual(entry.realized_total, test_value)
Example #13
0
 def test_realized_total_attribute_is_working_properly(self):
     """testing if the realized_total attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         realized_total=10)
     test_value = 5.0
     assert entry.realized_total != test_value
     entry.realized_total = test_value
     assert entry.realized_total == test_value
Example #14
0
 def test_budget_attribute_is_working_properly(self):
     """testing if the budget attribute value can correctly be changed
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         amount=10.0)
     new_budget = Budget(name='Test Budget', project=self.test_project)
     self.assertNotEqual(entry.budget, new_budget)
     entry.budget = new_budget
     self.assertEqual(entry.budget, new_budget)
Example #15
0
    def test_unit_attribute_is_not_a_string(self):
        """testing if a TypeError will be raised if the unit attribute is set
        to something other than a string
        """
        entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
        with self.assertRaises(TypeError) as cm:
            entry.unit = 100.212

        self.assertEqual(str(cm.exception),
                         'BudgetEntry.unit should be a string, not float')
Example #16
0
 def test_price_attribute_is_working_properly(self):
     """testing if the price attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         price=10)
     test_value = 5.0
     self.assertNotEqual(entry.price, test_value)
     entry.price = test_value
     self.assertEqual(entry.price, test_value)
Example #17
0
 def test_price_attribute_is_set_to_None(self):
     """testing if the price attribute will be set to 0 if price attribute
     is set to None
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         price=10.0)
     self.assertEqual(entry.price, 10.0)
     entry.price = None
     self.assertEqual(entry.price, 0.0)
Example #18
0
 def test_realized_total_attribute_is_set_to_None(self):
     """testing if the realized_total attribute will be set to 0 if it is
     set to None
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         realized_total=10.0)
     self.assertEqual(entry.realized_total, 10.0)
     entry.realized_total = None
     self.assertEqual(entry.realized_total, 0.0)
Example #19
0
 def test_cost_attribute_is_set_to_None(self):
     """testing if the cost attribute will be set to 0 if it is set to None
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
     )
     self.assertEqual(entry.cost, self.test_good.cost)
     entry.cost = None
     self.assertEqual(entry.cost, 0.0)
Example #20
0
 def test_good_attribute_is_working_properly(self):
     """testing if the good attribute can be correctly set
     """
     test_value = Good(name='Some Other Good')
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         amount=53)
     self.assertNotEqual(entry.good, test_value)
     entry.good = test_value
     self.assertEqual(entry.good, test_value)
Example #21
0
 def test_amount_attribute_is_working_properly(self):
     """testing if the amount attribute is working properly
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         amount=10)
     test_value = 5.0
     assert entry.amount != test_value
     entry.amount = test_value
     assert entry.amount == test_value
Example #22
0
 def test_msrp_attribute_is_set_to_None(self):
     """testing if the msrp attribute will be set to 0 if msrp attribute is
     set to None
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
     )
     assert entry.msrp == self.test_good.msrp
     entry.msrp = None
     assert entry.msrp == 0.0
Example #23
0
 def test_msrp_attribute_is_set_to_None(self):
     """testing if the msrp attribute will be set to 0 if msrp attribute is
     set to None
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
     )
     self.assertEqual(entry.msrp, self.test_good.msrp)
     entry.msrp = None
     self.assertEqual(entry.msrp, 0.0)
Example #24
0
 def test_msrp_attribute_is_set_to_None(self):
     """testing if the msrp attribute will be set to 0 if msrp attribute is
     set to None
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
     )
     self.assertEqual(entry.msrp, self.test_good.msrp)
     entry.msrp = None
     self.assertEqual(entry.msrp, 0.0)
Example #25
0
 def test_msrp_attribute_is_working_properly(self):
     """testing if the msrp attribute is working properly
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
     )
     test_value = 5.0
     self.assertNotEqual(entry.msrp, test_value)
     entry.msrp = test_value
     self.assertEqual(entry.msrp, test_value)
Example #26
0
 def test_msrp_attribute_is_working_properly(self):
     """testing if the msrp attribute is working properly
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
     )
     test_value = 5.0
     assert entry.msrp != test_value
     entry.msrp = test_value
     assert entry.msrp == test_value
Example #27
0
    def test_price_attribute_is_not_a_number(self):
        """testing if a TypeError will be raised if price attribute is set to
        something other than a number
        """
        entry = BudgetEntry(budget=self.test_budget,
                            good=self.test_good,
                            price=10)
        with pytest.raises(TypeError) as cm:
            entry.price = 'some string'

        assert str(cm.value) == 'BudgetEntry.price should be a number, not str'
Example #28
0
 def test_msrp_attribute_is_working_properly(self):
     """testing if the msrp attribute is working properly
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
     )
     test_value = 5.0
     self.assertNotEqual(entry.msrp, test_value)
     entry.msrp = test_value
     self.assertEqual(entry.msrp, test_value)
Example #29
0
 def test_realized_total_attribute_is_set_to_None(self):
     """testing if the realized_total attribute will be set to 0 if it is
     set to None
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
         realized_total=10.0
     )
     self.assertEqual(entry.realized_total, 10.0)
     entry.realized_total = None
     self.assertEqual(entry.realized_total, 0.0)
Example #30
0
    def test_amount_attribute_is_not_a_number(self):
        """testing if a TypeError will be raised if amount attribute is set to
        something other than a number
        """
        entry = BudgetEntry(budget=self.test_budget,
                            good=self.test_good,
                            amount=10)
        with self.assertRaises(TypeError) as cm:
            entry.amount = 'some string'

        self.assertEqual(str(cm.exception),
                         'BudgetEntry.amount should be a number, not str')
Example #31
0
 def test_budget_attribute_is_working_properly(self):
     """testing if the budget attribute value can correctly be changed
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
         amount=10.0
     )
     new_budget = Budget(name='Test Budget', project=self.test_project)
     self.assertNotEqual(entry.budget, new_budget)
     entry.budget = new_budget
     self.assertEqual(entry.budget, new_budget)
Example #32
0
 def test_price_attribute_is_working_properly(self):
     """testing if the price attribute is working properly
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
         price=10
     )
     test_value = 5.0
     self.assertNotEqual(entry.price, test_value)
     entry.price = test_value
     self.assertEqual(entry.price, test_value)
Example #33
0
 def test_price_attribute_is_set_to_None(self):
     """testing if the price attribute will be set to 0 if price attribute
     is set to None
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
         price=10.0
     )
     self.assertEqual(entry.price, 10.0)
     entry.price = None
     self.assertEqual(entry.price, 0.0)
Example #34
0
 def test_good_attribute_is_working_properly(self):
     """testing if the good attribute can be correctly set
     """
     test_value = Good(name='Some Other Good')
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
         amount=53
     )
     self.assertNotEqual(entry.good, test_value)
     entry.good = test_value
     self.assertEqual(entry.good, test_value)
Example #35
0
    def test_unit_attribute_is_not_a_string(self):
        """testing if a TypeError will be raised if the unit attribute is set
        to something other than a string
        """
        entry = BudgetEntry(budget=self.test_budget, good=self.test_good)
        with self.assertRaises(TypeError) as cm:
            entry.unit = 100.212

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.unit should be a string, not float'
        )
Example #36
0
 def test_budget_attribute_is_working_properly(self):
     """testing if the budget attribute value can correctly be changed
     """
     entry = BudgetEntry(budget=self.test_budget,
                         good=self.test_good,
                         amount=10.0)
     new_budget = Budget(name='Test Budget',
                         project=self.test_project,
                         status_list=self.budget_status_list)
     assert entry.budget != new_budget
     entry.budget = new_budget
     assert entry.budget == new_budget
Example #37
0
 def test_amount_attribute_is_working_properly(self):
     """testing if the amount attribute is working properly
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
         amount=10
     )
     test_value = 5.0
     self.assertNotEqual(entry.amount, test_value)
     entry.amount = test_value
     self.assertEqual(entry.amount, test_value)
Example #38
0
 def test_amount_attribute_is_set_to_None(self):
     """testing if the amount attribute will be set to 0 if it is set to
     None
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
         amount=10.0
     )
     self.assertEqual(entry.amount, 10.0)
     entry.amount = None
     self.assertEqual(entry.amount, 0.0)
Example #39
0
    def test_budget_attribute_is_not_a_budget_instance(self):
        """testing if a TypeError will be raised if the budget attribute is not
        set to a something that is a Budget instance
        """
        entry = BudgetEntry(budget=self.test_budget,
                            good=self.test_good,
                            amount=10.0)
        with pytest.raises(TypeError) as cm:
            entry.budget = 'not a budget instance'

        assert str(cm.value) == \
            'BudgetEntry.budget should be a Budget instance, not str'
Example #40
0
    def test_realized_total_attribute_is_not_a_number(self):
        """testing if a TypeError will be raised if realized_total attribute is
        set to something other than a number
        """
        entry = BudgetEntry(budget=self.test_budget,
                            good=self.test_good,
                            realized_total=10)
        with pytest.raises(TypeError) as cm:
            entry.realized_total = 'some string'

        assert str(cm.value) == \
            'BudgetEntry.realized_total should be a number, not str'
Example #41
0
 def test_realized_total_attribute_is_working_properly(self):
     """testing if the realized_total attribute is working properly
     """
     entry = BudgetEntry(
         budget=self.test_budget,
         good=self.test_good,
         realized_total=10
     )
     test_value = 5.0
     self.assertNotEqual(entry.realized_total, test_value)
     entry.realized_total = test_value
     self.assertEqual(entry.realized_total, test_value)
Example #42
0
    def test_budget_attribute_is_set_to_none(self):
        """testing if a TypeError will be raised if the budget attribute is
        set to None
        """
        entry = BudgetEntry(
            budget=self.test_budget,
            good=self.test_good,
        )
        with pytest.raises(TypeError) as cm:
            entry.budget = None

        assert str(cm.value) == \
            'BudgetEntry.budget should be a Budget instance, not NoneType'
Example #43
0
    def test_good_attribute_is_set_to_None(self):
        """testing if a TypeError will be raised if the good attribute is set
        to None
        """
        entry = BudgetEntry(budget=self.test_budget,
                            good=Good(name='Some Good'),
                            amount=53)
        with pytest.raises(TypeError) as cm:
            entry.good = None

        assert str(cm.value) == \
            'BudgetEntry.good should be a stalker.models.budget.Good ' \
            'instance, not NoneType'
Example #44
0
    def test_good_attribute_is_set_to_None(self):
        """testing if a TypeError will be raised if the good attribute is set
        to None
        """
        entry = BudgetEntry(budget=self.test_budget,
                            good=Good(name='Some Good'),
                            amount=53)
        with self.assertRaises(TypeError) as cm:
            entry.good = None

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.good should be a stalker.models.budget.Good instance,'
            ' not NoneType')
Example #45
0
    def test_budget_attribute_is_set_to_none(self):
        """testing if a TypeError will be raised if the budget attribute is
        set to None
        """
        entry = BudgetEntry(
            budget=self.test_budget,
            good=self.test_good,
        )
        with self.assertRaises(TypeError) as cm:
            entry.budget = None

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.budget should be a Budget instance, not NoneType'
        )
Example #46
0
    def test_msrp_attribute_is_not_a_number(self):
        """testing if a TypeError will be raised if msrp attribute is set to
        something other than a number
        """
        entry = BudgetEntry(
            budget=self.test_budget,
            good=self.test_good,
        )
        with self.assertRaises(TypeError) as cm:
            entry.msrp = 'some string'

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.msrp should be a number, not str'
        )
Example #47
0
    def test_budget_attribute_is_not_a_budget_instance(self):
        """testing if a TypeError will be raised if the budget attribute is not
        set to a something that is a Budget instance
        """
        entry = BudgetEntry(
            budget=self.test_budget,
            good=self.test_good,
            amount=10.0
        )
        with self.assertRaises(TypeError) as cm:
            entry.budget = 'not a budget instance'

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.budget should be a Budget instance, not str'
        )
Example #48
0
    def test_good_attribute_is_set_to_None(self):
        """testing if a TypeError will be raised if the good attribute is set
        to None
        """
        entry = BudgetEntry(
            budget=self.test_budget,
            good=Good(name='Some Good'),
            amount=53
        )
        with self.assertRaises(TypeError) as cm:
            entry.good = None

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.good should be a stalker.models.budget.Good instance,'
            ' not NoneType'
        )
Example #49
0
    def test_good_attribute_is_not_a_good_instance(self):
        """testing if a TypeError will be raised when the good attribute is set
        to a value other than a Good instance
        """
        entry = BudgetEntry(
            budget=self.test_budget,
            good=self.test_good,
            amount=53,
        )
        with self.assertRaises(TypeError) as cm:
            entry.good = 'this is not a Good instance'

        self.assertEqual(
            str(cm.exception),
            'BudgetEntry.good should be a stalker.models.budget.Good instance, '
            'not str'
        )