示例#1
0
    def test_accounts(self, mock_driver):
        token_json = json.dumps({'token': '123'})
        mock_driver.return_value.find_element_by_name.return_value.get_attribute.return_value = token_json

        accounts_json = json.dumps(
            {'response': {
                '42': {
                    'response': accounts_example
                }
            }})
        mock_driver.return_value.request.return_value.text = accounts_json

        accounts = mintapi.get_accounts('foo', 'bar')

        self.assertFalse('lastUpdatedInDate' in accounts)
        self.assertNotEqual(accounts, accounts_example)

        accounts_annotated = copy.deepcopy(accounts_example)
        for account in accounts_annotated:
            account['lastUpdatedInDate'] = (datetime.datetime.fromtimestamp(
                account['lastUpdated'] / 1000))
        self.assertEqual(accounts, accounts_annotated)

        # ensure everything is json serializable as this is the command-line
        # behavior.
        mintapi.print_accounts(accounts)
示例#2
0
 def __init__(self, username, password):
     self.mint = mintapi.Mint(username, password)
     #print("Refreshing mint accounts...")
     #self.mint.initiate_account_refresh()
     #self.refresh_accounts()
     #print("Accounts refreshed!")
     self.accounts = self.mint.get_accounts()
     mintapi.print_accounts(self.accounts)
示例#3
0
文件: tests.py 项目: mcronce/mintapi
    def testAccounts(self):
        accounts = mintapi.get_accounts('foo', 'bar')

        self.assertFalse('lastUpdatedInDate' in accounts)
        self.assertNotEqual(accounts, accounts_example)

        accounts_annotated = copy.deepcopy(accounts_example)
        for account in accounts_annotated:
            account['lastUpdatedInDate'] = datetime.datetime.fromtimestamp(account['lastUpdated']/1000)
        self.assertEqual(accounts, accounts_annotated)

        # ensure everything is json serializable as this is the command-line behavior.
        mintapi.print_accounts(accounts)
示例#4
0
    def testAccounts(self):
        accounts = mintapi.get_accounts('foo', 'bar')

        self.assertFalse('lastUpdatedInDate' in accounts)
        self.assertNotEqual(accounts, accounts_example)

        accounts_annotated = copy.deepcopy(accounts_example)
        for account in accounts_annotated:
            account['lastUpdatedInDate'] = datetime.datetime.fromtimestamp(
                account['lastUpdated'] / 1000)
        self.assertEqual(accounts, accounts_annotated)

        # ensure everything is json serializable as this is the command-line behavior.
        mintapi.print_accounts(accounts)
示例#5
0
    def test_accounts(self, mock_driver):
        mock_driver.return_value = (TestMock(), "test")
        accounts = mintapi.get_accounts('foo', 'bar')

        self.assertFalse('lastUpdatedInDate' in accounts)
        self.assertNotEqual(accounts, accounts_example)

        accounts_annotated = copy.deepcopy(accounts_example)
        for account in accounts_annotated:
            account['lastUpdatedInDate'] = (datetime.datetime.fromtimestamp(
                account['lastUpdated'] / 1000))
        self.assertEqual(accounts, accounts_annotated)

        # ensure everything is json serializable as this is the command-line
        # behavior.
        mintapi.print_accounts(accounts)
示例#6
0
    def test_accounts(self, mock_driver):
        token_json = json.dumps({'token': '123'})
        mock_driver.return_value.find_element_by_name.return_value.get_attribute.return_value = token_json

        accounts_json = json.dumps({'response': {'42': {'response': accounts_example}}})
        mock_driver.return_value.request.return_value.text = accounts_json

        accounts = mintapi.get_accounts('foo', 'bar')

        self.assertFalse('lastUpdatedInDate' in accounts)
        self.assertNotEqual(accounts, accounts_example)

        accounts_annotated = copy.deepcopy(accounts_example)
        for account in accounts_annotated:
            account['lastUpdatedInDate'] = (datetime.datetime.fromtimestamp(account['lastUpdated'] / 1000))
        self.assertEqual(accounts, accounts_annotated)

        # ensure everything is json serializable as this is the command-line
        # behavior.
        mintapi.print_accounts(accounts)