def test_user_results_five(self): self.assertEqual( utils.calc_financial_results(30000, 60000, "No", "No", 0, 0), { "checking": 3700, "savings": 11100, "match": 0, "ira": 5500, "ret401k": 0, "investment": 9700 })
def test_user_results_two(self): self.assertEqual( utils.calc_financial_results(0, 0, "Yes", "Yes", 0, 0), { "checking": 0, "savings": 0, "match": 0, "ira": 0, "ret401k": 0, "investment": 0 })
def test_user_results_eight(self): self.assertEqual( utils.calc_financial_results(30000, 60000, "Yes", "Yes", 1.0, 0.05), { "checking": 3700, "savings": 11100, "match": 3000, "ira": 5500, "ret401k": 6700, "investment": 0 })
def show_existing_results(): """ This route accesses saved data from the database and calculates the results. """ if g.logged_in is True: if g.inputs is True: user_assets = m_session.query(model.UserBanking).filter_by( user_id=g.user.id).one() total_assets = user_assets.inputted_assets + \ user_assets.checking_amt + user_assets.savings_amt + \ user_assets.IRA_amt + user_assets.comp401k_amt + \ user_assets.investment_amt income = g.user.income comp_401k = g.user.company_401k match_401k = g.user.company_match match_percent = g.user.match_percent match_salary = g.user.match_salary results = utils.calc_financial_results( total_assets, income, comp_401k, match_401k, match_percent, match_salary) max_results = utils.calc_max_financials( income, comp_401k, match_401k, match_percent, match_salary) return render_template( "results.html", checking=utils.format_currency(results["checking"]), savings=utils.format_currency(results["savings"]), match=utils.format_currency(results["match"]), ira=utils.format_currency(results["ira"]), ret401k=utils.format_currency(results["ret401k"]), investment=utils.format_currency(results["investment"]), results=json.dumps(results), max_results=json.dumps(max_results)) else: flash("Our financial data on you is incomplete. \ Please input now.") return redirect("/input/banking") else: return redirect("/login")
def test_user_results_twelve(self): self.assertEqual(utils.calc_financial_results( 40000, 60000, "Yes", "No", 0, 0), { "checking": 3700, "savings": 11100, "match": 0, "ira": 5500, "ret401k": 18000, "investment": 1700})
def test_user_results_nine(self): self.assertEqual(utils.calc_financial_results( 10000, 60000, "Yes", "No", 0, 0), { "checking": 3700, "savings": 6300, "match": 0, "ira": 0, "ret401k": 0, "investment": 0})
def test_user_results_eight(self): self.assertEqual(utils.calc_financial_results( 40000, 60000, "Yes", "Yes", 1.0, 0.05), { "checking": 3700, "savings": 11100, "match": 3000, "ira": 5500, "ret401k": 15000, "investment": 1700})
def test_user_results_two(self): self.assertEqual(utils.calc_financial_results( 0, 0, "Yes", "Yes", 0, 0), { "checking": 0, "savings": 0, "match": 0, "ira": 0, "ret401k": 0, "investment": 0})