Example #1
0
    def test_budget_attribute_is_set_to_None(self):
        """testing if a TypeError will ve raised when the budget attribute is
        set to None
        """
        from stalker import Invoice
        test_invoice = Invoice(budget=self.test_budget,
                               client=self.test_client,
                               amount=1500,
                               unit='TRY')
        with pytest.raises(TypeError) as cm:
            test_invoice.budget = None

        assert str(cm.value) == \
            'Invoice.budget should be a Budget instance, not NoneType'
Example #2
0
    def test_budget_attribute_is_set_to_a_value_other_than_a_budget_instance(
            self):
        """testing if a TypeError will be raised when the Budget attribute is
        set to a value other than a Budget instance
        """
        from stalker import Invoice
        test_invoice = Invoice(budget=self.test_budget,
                               client=self.test_client,
                               amount=1500,
                               unit='TRY')
        with pytest.raises(TypeError) as cm:
            test_invoice.budget = 'Not a budget instance'

        assert str(cm.value) == \
            'Invoice.budget should be a Budget instance, not str'