def test_get_transactions_no_filters(self): """get_transactions: check if all account transactions are returned when no filter is provided. """ # given number_transactions = 2 account = self.create_account( balance=Decimal("20.00"), transactions=TransactionFactory.create_batch(number_transactions)) # when query = get_transactions(account.id) # then self.assertEqual(number_transactions, query.count())
def test_get_statement(self): """get: check if statement is received for a valid account""" # given number_transactions = 5 account = self.create_account( transactions=TransactionFactory.create_batch(number_transactions) ) # when response = self.app.test_client().get( f'/accounts/statement/{account.id}', ) response_data = json.loads(response.data) # then self.assert200(response) self.assertEqual(len(response_data['transactions']), len(account.transactions)) self.assertEqual(response_data['id'], account.id)