Skip to content
Snippets Groups Projects
Commit 7dfa66a6 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Tidy up the fund tests

parent ca35670c
No related branches found
No related tags found
No related merge requests found
...@@ -13,44 +13,40 @@ def days_from_today(days): ...@@ -13,44 +13,40 @@ def days_from_today(days):
class TestFundModel(TestCase): class TestFundModel(TestCase):
def setUp(self):
self.fund = FundTypeFactory(parent=None)
def test_can_access_workflow_class(self): def test_can_access_workflow_class(self):
fund = FundTypeFactory(parent=None) self.assertEqual(self.fund.workflow, 'single')
self.assertEqual(fund.workflow, 'single') self.assertEqual(self.fund.workflow_class, SingleStage)
self.assertEqual(fund.workflow_class, SingleStage)
def test_no_open_rounds(self): def test_no_open_rounds(self):
fund = FundTypeFactory(parent=None) self.assertIsNone(self.fund.open_round)
self.assertIsNone(fund.open_round)
def test_open_ended_round(self): def test_open_ended_round(self):
fund = FundTypeFactory(parent=None) open_round = RoundFactory(end_date=None, parent=self.fund)
open_round = RoundFactory(end_date=None, parent=fund) self.assertEqual(self.fund.open_round, open_round)
self.assertEqual(fund.open_round, open_round)
def test_normal_round(self): def test_normal_round(self):
fund = FundTypeFactory(parent=None) open_round = RoundFactory(parent=self.fund)
open_round = RoundFactory(parent=fund) self.assertEqual(self.fund.open_round, open_round)
self.assertEqual(fund.open_round, open_round)
def test_closed_round(self): def test_closed_round(self):
fund = FundTypeFactory(parent=None)
yesterday = days_from_today(-1) yesterday = days_from_today(-1)
last_week = days_from_today(-7) last_week = days_from_today(-7)
RoundFactory(start_date=last_week, end_date=yesterday, parent=fund) RoundFactory(start_date=last_week, end_date=yesterday, parent=self.fund)
self.assertIsNone(fund.open_round) self.assertIsNone(self.fund.open_round)
def test_round_not_open(self): def test_round_not_open(self):
fund = FundTypeFactory(parent=None)
tomorrow = days_from_today(1) tomorrow = days_from_today(1)
RoundFactory(start_date=tomorrow, parent=fund) RoundFactory(start_date=tomorrow, parent=self.fund)
self.assertIsNone(fund.open_round) self.assertIsNone(self.fund.open_round)
def test_multiple_open_rounds(self): def test_multiple_open_rounds(self):
fund = FundTypeFactory(parent=None) open_round = RoundFactory(parent=self.fund)
open_round = RoundFactory(parent=fund)
next_round_start = open_round.end_date + timedelta(days=1) next_round_start = open_round.end_date + timedelta(days=1)
RoundFactory(start_date=next_round_start, end_date=None, parent=fund) RoundFactory(start_date=next_round_start, end_date=None, parent=self.fund)
self.assertEqual(fund.open_round, open_round) self.assertEqual(self.fund.open_round, open_round)
class TestRoundModel(TestCase): class TestRoundModel(TestCase):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment