예제 #1
0
    def test_search_accounts_without_result(self):
        app = App()
        app.db_util = mock.Mock()

        app.db_util.search_accounts.return_value = None
        result = app.search_accounts('search text')
        app.db_util.search_accounts.assert_called_once_with('search text')
        self.assertEqual(result, None)
예제 #2
0
    def test_search_accounts(self):
        app = App()
        app.db_util = mock.Mock()

        root = Account(
            guid='root_guid',
            name='Root Account',
            full_name='Root Account')
        income = Account(
            guid='income_guid',
            name='Income Account',
            full_name='Income Account')

        app.db_util.search_accounts.return_value = [root, income]

        result = app.search_accounts('search text')
        app.db_util.search_accounts.assert_called_once_with('search text')
        self.assertEqual(result, [root, income])