From b23ce4bd5a09ff478ce586e388462b4a1ca0fe79 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Wed, 26 Sep 2018 11:40:16 +0100 Subject: [PATCH] Add test to ensure the RFP renders correctly --- opentech/apply/funds/models/applications.py | 6 +++++- opentech/apply/funds/tests/factories/models.py | 1 + opentech/apply/funds/tests/test_models.py | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/opentech/apply/funds/models/applications.py b/opentech/apply/funds/models/applications.py index 92e2c33ae..62a6e13fa 100644 --- a/opentech/apply/funds/models/applications.py +++ b/opentech/apply/funds/models/applications.py @@ -37,7 +37,6 @@ class ApplicationBaseManager(PageQuerySet): class ApplicationBase(EmailForm, WorkflowStreamForm): # type: ignore is_createable = False - template = 'funds/application_base.html' # Adds validation around forms & workflows. Isn't on Workflow class due to not displaying workflow field on Round base_form_class = WorkflowFormAdminForm @@ -53,6 +52,11 @@ class ApplicationBase(EmailForm, WorkflowStreamForm): # type: ignore parent_page_types = ['apply_home.ApplyHomePage'] + def get_template(self, request, *args, **kwargs): + # We want to force children to use our base template + # template attribute is ignored by children + return 'funds/application_base.html' + def detail(self): # The location to find out more information return self.application_public.first() diff --git a/opentech/apply/funds/tests/factories/models.py b/opentech/apply/funds/tests/factories/models.py index 144d4ef4e..5828a117a 100644 --- a/opentech/apply/funds/tests/factories/models.py +++ b/opentech/apply/funds/tests/factories/models.py @@ -40,6 +40,7 @@ __all__ = [ 'LabFactory', 'LabBaseFormFactory', 'LabSubmissionFactory', + 'RequestForPartnersFactory', 'SealedRoundFactory', 'SealedSubmissionFactory', 'workflow_for_stages', diff --git a/opentech/apply/funds/tests/test_models.py b/opentech/apply/funds/tests/test_models.py index 5eddda073..6e295b757 100644 --- a/opentech/apply/funds/tests/test_models.py +++ b/opentech/apply/funds/tests/test_models.py @@ -19,6 +19,7 @@ from .factories import ( CustomFormFieldsFactory, FundTypeFactory, LabFactory, + RequestForPartnersFactory, RoundFactory, ) @@ -465,3 +466,11 @@ class TestSubmissionRenderMethods(TestCase): ) answers = submission.render_answers() self.assertNotIn(rich_text_label, answers) + + +class TestRequestForPartners(TestCase): + def test_message_when_no_round(self): + rfp = RequestForPartnersFactory() + request = make_request(site=rfp.get_site()) + response = rfp.serve(request) + self.assertContains(response, 'not accepting') -- GitLab