def accounts(): accounts_dic = {} accounts = Account.all() for account in accounts: accounts_dic[account.username] = { "username": account.username, "balance": account.balance, "api-key": account.api_key } return jsonify({"accounts": accounts_dic})
def testAll(self): caroline = Account(username="******", password_hash="password", balance=10000, first_name="Caroline", last_name="Grabowski", email="*****@*****.**") caroline.save() alex = Account(username="******", password_hash="password", balance=20000, first_name="Alex", last_name="C", email="*****@*****.**") alex.save() all_data = Account.all() # self.assertEqual(len(all_data), 2, "all data should return all rows of data") self.assertEqual(all_data[0].first_name, "Caroline", "all function should return all account data") self.assertEqual(all_data[1].first_name, "Alex", "all function should return all account data")