示例#1
0
 def test_book_transactions(self, new_book):
     ncur = new_book.currencies(mnemonic="CAD")
     new_book.flush()
     assert len(new_book.currencies) == 2
     assert not new_book.is_saved
     new_book.cancel()
     assert new_book.is_saved
     assert len(new_book.currencies) == 1
     nncur = new_book.currencies(mnemonic="USD")
     new_book.flush()
     assert not new_book.is_saved
     assert len(new_book.currencies) == 2
     new_book.save()
     assert new_book.is_saved
     assert len(new_book.currencies) == 2
     new_book.delete(nncur)
     assert not new_book.is_saved
     assert len(new_book.currencies) == 1
     new_book.save()
     assert new_book.is_saved
     assert len(new_book.currencies) == 1
     nncur = new_book.currencies(mnemonic="USD")
     new_book.flush()
     assert len(new_book.currencies) == 2
     assert not new_book.is_saved
示例#2
0
 def test_book_transactions(self, new_book):
     ncur = new_book.currencies(mnemonic="CAD")
     new_book.flush()
     assert len(new_book.currencies) == 2
     assert not new_book.is_saved
     new_book.cancel()
     assert new_book.is_saved
     assert len(new_book.currencies) == 1
     nncur = new_book.currencies(mnemonic="USD")
     new_book.flush()
     assert not new_book.is_saved
     assert len(new_book.currencies) == 2
     new_book.save()
     assert new_book.is_saved
     assert len(new_book.currencies) == 2
     new_book.delete(nncur)
     assert not new_book.is_saved
     assert len(new_book.currencies) == 1
     new_book.save()
     assert new_book.is_saved
     assert len(new_book.currencies) == 1
     nncur = new_book.currencies(mnemonic="USD")
     new_book.flush()
     assert len(new_book.currencies) == 2
     assert not new_book.is_saved
示例#3
0
    def test_create_save_cancel_flush(self, new_book):
        EUR = new_book.commodities[0]
        EUR.mnemonic = "foo"
        assert EUR.mnemonic == "foo"
        new_book.cancel()
        assert EUR.mnemonic == "EUR"

        EUR.mnemonic = "foo"
        assert EUR.mnemonic == "foo"
        new_book.flush()
        assert EUR.mnemonic == "foo"
        new_book.cancel()
        assert EUR.mnemonic == "EUR"

        EUR.mnemonic = "foo"
        new_book.save()
        assert EUR.mnemonic == "foo"
示例#4
0
    def test_create_save_cancel_flush(self, new_book):
        EUR = new_book.commodities[0]
        EUR.mnemonic = "foo"
        assert EUR.mnemonic == "foo"
        new_book.cancel()
        assert EUR.mnemonic == "EUR"

        EUR.mnemonic = "foo"
        assert EUR.mnemonic == "foo"
        new_book.flush()
        assert EUR.mnemonic == "foo"
        new_book.cancel()
        assert EUR.mnemonic == "EUR"

        EUR.mnemonic = "foo"
        new_book.save()
        assert EUR.mnemonic == "foo"