Exemplo n.º 1
0
    def testLogin(self):
        account3 = Account(username="******", pin="1234", balance=20.00)
        api = account3.generate_api_key()
        account3.save()
        get_api = account3.get_api()

        account4 = Account.api_authenticate(get_api)

        self.assertEqual(account4.username, "mike_bloom")
        self.assertEqual(account4.pin, "1234")
        self.assertEqual(account4.balance, 20.00)
Exemplo n.º 2
0
    def testNewAccount(self):
        account1 = Account()
        self.assertEqual(account1.tablename, "accounts")
        self.assertIsInstance(account1, Account)
        self.assertEqual(account1.fields,
                         ["username", "pin", "balance", "api_key"])

        account2 = Account(username="******", pin="4456", balance="1200.00")
        api = account2.generate_api_key()
        account2.save()
        get_api = account2.get_api()
        self.assertEqual(api, get_api)