Exemple #1
0
    def setUp(self):
        from v1.models import HomePage
        self.ROOT_PAGE = HomePage.objects.get(slug='cfgov')
        self.landing_page = RegulationLandingPage(
            title='Reg Landing', slug='reg-landing')
        self.ROOT_PAGE.add_child(instance=self.landing_page)

        self.part_1002 = mommy.make(
            Part,
            part_number='1002',
            title='Equal Credit Opportunity Act',
            letter_code='B',
            chapter='X'
        )
        self.effective_version = mommy.make(
            EffectiveVersion,
            effective_date=date(2014, 1, 18),
            part=self.part_1002
        )
        self.subpart = mommy.make(
            Subpart,
            label='Subpart General',
            title='General',
            subpart_type=Subpart.BODY,
            version=self.effective_version
        )
        self.section_num4 = mommy.make(
            Section,
            label='4',
            title='\xa7\xa01002.4 General rules.',
            contents='{a}\n(a) Regdown paragraph a.\n',
            subpart=self.subpart,
        )

        self.draft_effective_version = mommy.make(
            EffectiveVersion,
            effective_date=date(2020, 1, 18),
            part=self.part_1002,
            draft=True,
        )
        self.draft_subpart = mommy.make(
            Subpart,
            label='Subpart General',
            title='General',
            subpart_type=Subpart.BODY,
            version=self.draft_effective_version
        )
        self.draft_section_num4 = mommy.make(
            Section,
            label='4',
            title='\xa7\xa01002.4 General rules.',
            contents='{a}\n(a) Regdown paragraph a.\n',
            subpart=self.draft_subpart,
        )

        self.login()
    def setUp(self):
        from v1.models import HomePage
        self.ROOT_PAGE = HomePage.objects.get(slug='cfgov')
        self.landing_page = RegulationLandingPage(
            title='Reg Landing',
            slug='regulations'
        )
        self.ROOT_PAGE.add_child(instance=self.landing_page)

        self.part_1002 = mommy.make(
            Part,
            part_number='1002',
            title='Equal Credit Opportunity Act',
            short_name='Regulation B',
            chapter='X'
        )
        self.part_1003 = mommy.make(
            Part,
            part_number='1003',
            title='Home Mortgage Disclosure',
            short_name='Regulation C',
            chapter='X'
        )
        self.effective_version = mommy.make(
            EffectiveVersion,
            effective_date=datetime.date(2014, 1, 18),
            part=self.part_1002
        )
        self.future_effective_version = mommy.make(
            EffectiveVersion,
            effective_date=datetime.date(2022, 1, 1),
            part=self.part_1002
        )
        self.reg_page_1002 = RegulationPage(
            regulation=self.part_1002,
            title='Reg B',
            slug='1002'
        )
        self.reg_page_1003 = RegulationPage(
            regulation=self.part_1003,
            title='Reg C',
            slug='1003',
            live=False,
        )

        self.landing_page.add_child(instance=self.reg_page_1002)
        self.landing_page.add_child(instance=self.reg_page_1003)
        self.landing_page.save_revision().publish()
        self.reg_page_1002.save_revision().publish()
        self.reg_page_1003.save_revision()

        self.more_regs_page = Page.objects.first()
    def setUp(self):
        from v1.models import HomePage
        self.ROOT_PAGE = HomePage.objects.get(slug='cfgov')
        self.landing_page = RegulationLandingPage(title='Reg Landing',
                                                  slug='reg-landing')
        self.ROOT_PAGE.add_child(instance=self.landing_page)

        self.part_1002 = mommy.make(Part,
                                    part_number='1002',
                                    title='Equal Credit Opportunity Act',
                                    letter_code='B',
                                    chapter='X')
        self.part_1030 = mommy.make(Part,
                                    part_number='1030',
                                    title='Truth In Savings',
                                    letter_code='DD',
                                    chapter='X')
        self.effective_version = mommy.make(EffectiveVersion,
                                            effective_date=datetime.date(
                                                2014, 1, 18),
                                            part=self.part_1002)
        self.subpart = mommy.make(Subpart,
                                  label='Subpart General',
                                  title='General',
                                  subpart_type=Subpart.BODY,
                                  version=self.effective_version)
        self.subpart_appendices = mommy.make(Subpart,
                                             label='Appendices',
                                             title='Appendices',
                                             subpart_type=Subpart.APPENDIX,
                                             version=self.effective_version)
        self.subpart_interps = mommy.make(Subpart,
                                          label='Official Interpretations',
                                          title='Supplement I to Part 1002',
                                          subpart_type=Subpart.INTERPRETATION,
                                          version=self.effective_version)
        self.subpart_orphan = mommy.make(
            Subpart,
            label='General Mistake',
            title='An orphan subpart with no sections for testing',
            version=self.effective_version)
        self.section_num4 = mommy.make(
            Section,
            label='4',
            title='\xa7\xa01002.4 General rules.',
            contents='regdown content.',
            subpart=self.subpart,
        )
        self.section_num15 = mommy.make(
            Section,
            label='15',
            title='\xa7\xa01002.15 Rules concerning requests for information.',
            contents='regdown content.',
            subpart=self.subpart,
        )
        self.section_alpha = mommy.make(
            Section,
            label='A',
            title=('Appendix A to Part 1002-Federal Agencies '
                   'To Be Listed in Adverse Action Notices'),
            contents='regdown content.',
            subpart=self.subpart_appendices,
        )
        self.section_beta = mommy.make(
            Section,
            label='B',
            title=('Appendix B to Part 1002-Errata'),
            contents='regdown content.',
            subpart=self.subpart_appendices,
        )
        self.section_interps = mommy.make(
            Section,
            label='Interp-A',
            title=('Official interpretations for Appendix A to Part 1002'),
            contents='interp content.',
            subpart=self.subpart_interps,
        )
        self.reg_page = RegulationPage(regulation=self.part_1002,
                                       title='Reg B',
                                       slug='1002')

        self.reg_search_page = RegulationsSearchPage(title="Regulation search",
                                                     slug='reg-search')

        self.landing_page.add_child(instance=self.reg_page)
        self.landing_page.add_child(instance=self.reg_search_page)
        self.reg_search_page.save()
    def setUp(self):
        from v1.models import HomePage
        self.factory = RequestFactory()
        self.superuser = User.objects.create_superuser(username='******',
                                                       password='******',
                                                       email='*****@*****.**')

        self.site = Site.objects.get(is_default_site=True)

        self.ROOT_PAGE = HomePage.objects.get(slug='cfgov')
        self.landing_page = RegulationLandingPage(title='Reg Landing',
                                                  slug='reg-landing')
        self.ROOT_PAGE.add_child(instance=self.landing_page)

        self.part_1002 = baker.make(Part,
                                    cfr_title_number=12,
                                    part_number='1002',
                                    title='Equal Credit Opportunity Act',
                                    short_name='Regulation B',
                                    chapter='X')
        self.part_1030 = baker.make(Part,
                                    cfr_title_number=12,
                                    part_number='1030',
                                    title='Truth In Savings',
                                    short_name='Regulation DD',
                                    chapter='X')

        self.effective_version = baker.make(EffectiveVersion,
                                            effective_date=datetime.date(
                                                2014, 1, 18),
                                            part=self.part_1002)
        self.old_effective_version = baker.make(
            EffectiveVersion,
            effective_date=datetime.date(2011, 1, 1),
            part=self.part_1002,
        )
        self.draft_effective_version = baker.make(
            EffectiveVersion,
            effective_date=datetime.date(2020, 1, 1),
            part=self.part_1002,
            draft=True,
        )

        self.subpart = baker.make(Subpart,
                                  label='Subpart General',
                                  title='Subpart A - General',
                                  subpart_type=Subpart.BODY,
                                  version=self.effective_version)
        self.subpart_appendices = baker.make(Subpart,
                                             label='Appendices',
                                             title='Appendices',
                                             subpart_type=Subpart.APPENDIX,
                                             version=self.effective_version)
        self.subpart_interps = baker.make(Subpart,
                                          label='Official Interpretations',
                                          title='Supplement I to Part 1002',
                                          subpart_type=Subpart.INTERPRETATION,
                                          version=self.effective_version)
        self.subpart_orphan = baker.make(
            Subpart,
            label='General Mistake',
            title='An orphan subpart with no sections for testing',
            version=self.effective_version)
        self.old_subpart = baker.make(Subpart,
                                      label='Subpart General',
                                      title='General',
                                      subpart_type=Subpart.BODY,
                                      version=self.old_effective_version)
        self.section_num4 = baker.make(
            Section,
            label='4',
            title='\xa7\xa01002.4 General rules.',
            contents=(
                '{a}\n(a) Regdown paragraph a.\n'
                '{b}\n(b) Paragraph b\n'
                '\nsee(4-b-Interp)\n'
                '{c}\n(c) Paragraph c.\n'
                '{c-1}\n \n'
                '{d}\n(1) General rule. A creditor that provides in writing.\n'
            ),
            subpart=self.subpart,
        )
        self.graph_to_keep = baker.make(
            SectionParagraph,
            section=self.section_num4,
            paragraph_id='d',
            paragraph=(
                '(1) General rule. A creditor that provides in writing.'))
        self.graph_to_delete = baker.make(
            SectionParagraph,
            section=self.section_num4,
            paragraph_id='x',
            paragraph='(x) Non-existent graph that should get deleted.')
        self.section_num15 = baker.make(
            Section,
            label='15',
            title='\xa7\xa01002.15 Rules concerning requests for information.',
            contents='regdown content.',
            subpart=self.subpart,
        )
        self.section_alpha = baker.make(
            Section,
            label='A',
            title=('Appendix A to Part 1002-Federal Agencies '
                   'To Be Listed in Adverse Action Notices'),
            contents='regdown content.',
            subpart=self.subpart_appendices,
        )
        self.section_beta = baker.make(
            Section,
            label='B',
            title=('Appendix B to Part 1002-Errata'),
            contents='regdown content.',
            subpart=self.subpart_appendices,
        )
        self.section_interps = baker.make(
            Section,
            label='Interp-A',
            title=('Official interpretations for Appendix A to Part 1002'),
            contents='interp content.',
            subpart=self.subpart_interps,
        )
        self.old_section_num4 = baker.make(
            Section,
            label='4',
            title='\xa7\xa01002.4 General rules.',
            contents='regdown contents',
            subpart=self.old_subpart,
        )

        self.reg_page = RegulationPage(regulation=self.part_1002,
                                       title='Reg B',
                                       slug='1002')

        self.reg_search_page = RegulationsSearchPage(
            title="Search regulations", slug='search-regulations')

        self.landing_page.add_child(instance=self.reg_page)
        self.landing_page.add_child(instance=self.reg_search_page)
        self.reg_page.save()
        self.reg_search_page.save()

        CACHE_PURGED_URLS[:] = []