From 8c38c0244f8c530bc7a4d67d7f70bb59af942a63 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 28 Apr 2020 17:41:06 +0200 Subject: prevent crashes when money should be transfered to the issuer --- test.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test.py') diff --git a/test.py b/test.py index 94235e1..929605c 100755 --- a/test.py +++ b/test.py @@ -197,6 +197,13 @@ class TestTransactionCmd(unittest.TestCase): compare_state("test/state.json_transactions1") + def test_transactions_with_myself(self): + res = run_bot(self, num[alice], f"!schieb {alice} 1,1") + self.assertEqual(res.stdout, 'ERROR: you can not transfere money to or from yourself') + + res = run_bot(self, num[alice], f"!zieh {alice} 2.1") + self.assertEqual(res.stdout, 'ERROR: you can not transfere money to or from yourself') + class TestSumCmd(unittest.TestCase): def test_summary_single_user(self): reset_state("test/state.json_transactions1") @@ -297,6 +304,17 @@ foo not known. Please take care manually New Balance: alice: \t<- charlie 10.00 +\tBalance: 10.00""" + self.assertEqual(res.stdout, msg) + + def test_split_with_sender_in_user_list(self): + res = run_bot(self, num[alice], f"!split 30 {charlie} {alice}") + msg = \ +"""Split 30.00 between 3 -> 10.00 each +alice, you will be charged multiple times. This may not be what you want +New Balance: +alice: +\t<- charlie 10.00 \tBalance: 10.00""" self.assertEqual(res.stdout, msg) -- cgit v1.2.3