예제 #1
0
파일: tests.py 프로젝트: wolf811/naks-new
    def test_reestr_of_ac_filled_with_centers_by_direction(self, rf):
        for org in self.org_names:
            mixer.blend(SROMember, short_name=org, status='a')
        personal_centers = mixer.cycle(5).blend(AccreditedCenter,
                                                direction='personal',
                                                sro_member__status='a')
        inactive_sro_centers_personal = mixer.cycle(5).blend(
            AccreditedCenter, direction='personal', sro_member__status='na')
        inactive_by_status_centers = mixer.cycle(5).blend(
            AccreditedCenter,
            active=False,
            direction='personal',
            sro_member=SROMember.objects.filter(
                short_name__in=self.org_names).first())
        request = rf.get('/reestr/centers/')
        response = reestr.centers(request, direction='personal')
        html = response.content.decode('utf8')
        for center in personal_centers:
            assert center.short_code in html

        for center in inactive_sro_centers_personal:
            assert center.short_code in html

        for center in inactive_by_status_centers:
            assert center.short_code in html
예제 #2
0
파일: tests.py 프로젝트: wolf811/naks-new
 def test_filter_parameters_passed_to_reestr_page_context(
         self, mock_render, rf):
     weldtypes = mixer.cycle(10).blend(WeldType)
     gtus = mixer.cycle(10).blend(GTU)
     levels = mixer.cycle(4).blend(Level)
     request = rf.get('/reestr/centers/')
     response = reestr.centers(request, direction='personal')
     context = self.context(mock_render.call_args)
     for weld in weldtypes:
         assert weld in context['weld_types']
     for gtu in gtus:
         assert gtu in context['gtus']
     for level in levels:
         assert level in context['levels']
예제 #3
0
파일: tests.py 프로젝트: wolf811/naks-new
 def test_member_shutdown_cause_to_center_inactivity(self, mock_render, rf):
     org = mixer.blend(SROMember, status='a')
     active_centers = mixer.cycle(5).blend(AccreditedCenter,
                                           active=True,
                                           sro_member=org,
                                           direction='personal')
     # now shutdown_org
     org.status = 'na'
     org.save()
     request = rf.get('/reestr/centers/')
     response = reestr.centers(request, direction='personal')
     context = self.context(mock_render.call_args)
     for c in active_centers:
         assert c in combined(context['inactive_centers']['left'],
                              context['inactive_centers']['right'])
예제 #4
0
파일: tests.py 프로젝트: wolf811/naks-new
 def test_centers_are_in_different_context(self, mock_render, rf):
     orgs = mixer.cycle(5).blend(SROMember, status='a')
     counter = 0
     for org in orgs:
         mixer.blend(AccreditedCenter,
                     short_code=mixer.sequence("active_{}".format(counter)),
                     sro_member=org,
                     active=True)
         mixer.blend(AccreditedCenter,
                     short_code=mixer.sequence(
                         "inactive_{}".format(counter)),
                     sro_member=org,
                     active=False)
         mixer.blend(AccreditedCenter,
                     short_code=mixer.sequence(
                         "suspended_{}".format(counter)),
                     sro_member=org,
                     temporary_suspend_date=mixer.RANDOM)
         counter += 1
     active_centers = AccreditedCenter.objects.filter(
         active=True, temporary_suspend_date__isnull=True)
     inactive_centers = AccreditedCenter.objects.filter(active=False)
     suspended_centers = AccreditedCenter.objects.filter(
         temporary_suspend_date__isnull=False)
     request = rf.get('/reestr/centers/')
     response = reestr.centers(request, direction='personal')
     context = self.context(mock_render.call_args)
     active_centers_cntxt = combined(context['active_centers']['left'],
                                     context['active_centers']['right'])
     inactive_centers_cntxt = combined(context['inactive_centers']['left'],
                                       context['inactive_centers']['right'])
     suspended_centers_cntxt = combined(
         context['suspended_centers']['left'],
         context['suspended_centers']['right'])
     for center in active_centers:
         assert center in active_centers_cntxt and\
             center not in inactive_centers_cntxt and\
             center not in suspended_centers_cntxt
     for center in inactive_centers:
         assert center in inactive_centers_cntxt and\
             center not in active_centers_cntxt and\
             center not in suspended_centers_cntxt
     for center in suspended_centers:
         assert center in suspended_centers_cntxt and\
             center not in active_centers_cntxt and\
             center not in inactive_centers_cntxt
예제 #5
0
파일: tests.py 프로젝트: wolf811/naks-new
 def test_reestr_of_centers_accessable_by_url(self, rf):
     request = rf.get('/reestr/centers/')
     response = reestr.centers(request, direction='personal')
     assert response.status_code == 200