def test_only_owned_budget_list(self): self.c.login(username=self.user.username, password='******') own_budget = BudgetFactory(user=self.user) other_budget = BudgetFactory() res = self.c.get('/budget', follow=True) self.assertIn(own_budget.name.encode(), res.content) self.assertNotIn(other_budget.name.encode(), res.content)
def test_view_budgets_when_logged_in(self): self.c.login( username=self.user.username, password='******' ) budgets = BudgetFactory(user=self.user) res = self.c.get('/budgets', follow=True) self.assertIn(budgets.name.encode(), res.content)
def setUp(self): self.user = UserFactory() self.user.set_password('12345') self.user.save() self.budget = BudgetFactory(user=self.user) self.c = Client()
def setUp(self): self.budget = BudgetFactory(name='Red Bull', total_budget=234.56)
def setUp(self): self.budget = BudgetFactory(name='food', total_budget=234.56) self.transaction = TransactionFactory(description='apples', type='withdrawal', amount=1.23, budget=self.budget)
def test_view_if_logged_in(self): self.c.login(username=self.user.username, password='******') budget = BudgetFactory(user=self.user) res = self.c.get('/budget', follow=True) self.assertEqual(res.status_code, 200) self.assertIn(b'<h1>Create New Budget</h1>', res.content)
def setUp(self): self.budget = BudgetFactory(name='test name', total_budget=42)