GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 64-68 lines in 4 locations

src/registration/tests/test_models.py 4 locations

@@ 622-689 (lines=68) @@
619
                          User.objects.get,
620
                          username='expired_accepted_user')
621
622
    def test_rejected_user_deletion(self):
623
        RegistrationProfile.objects.register(
624
            username='new_untreated_user',
625
            email='[email protected]',
626
            site=self.mock_site,
627
        )
628
        new_accepted_user = RegistrationProfile.objects.register(
629
            username='new_accepted_user',
630
            email='[email protected]',
631
            site=self.mock_site,
632
        )
633
        new_rejected_user = RegistrationProfile.objects.register(
634
            username='new_rejected_user',
635
            email='[email protected]',
636
            site=self.mock_site,
637
        )
638
        expired_untreated_user = RegistrationProfile.objects.register(
639
            username='expired untreated user',
640
            email='[email protected]',
641
            site=self.mock_site,
642
        )
643
        expired_accepted_user = RegistrationProfile.objects.register(
644
            username='expired_accepted_user',
645
            email='[email protected]',
646
            site=self.mock_site,
647
        )
648
        expired_rejected_user = RegistrationProfile.objects.register(
649
            username='expired_rejected_user',
650
            email='[email protected]',
651
            site=self.mock_site,
652
        )
653
654
        RegistrationProfile.objects.accept_registration(
655
            new_accepted_user.registration_profile,
656
            site=self.mock_site,
657
        )
658
        RegistrationProfile.objects.reject_registration(
659
            new_rejected_user.registration_profile,
660
            site=self.mock_site,
661
        )
662
        RegistrationProfile.objects.accept_registration(
663
            expired_accepted_user.registration_profile,
664
            site=self.mock_site,
665
        )
666
        RegistrationProfile.objects.reject_registration(
667
            expired_rejected_user.registration_profile,
668
            site=self.mock_site,
669
        )
670
671
        delta = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS+1)
672
673
        expired_untreated_user.date_joined -= delta
674
        expired_untreated_user.save()
675
        expired_accepted_user.date_joined -= delta
676
        expired_accepted_user.save()
677
        expired_rejected_user.date_joined -= delta
678
        expired_rejected_user.save()
679
680
        RegistrationProfile.objects.delete_rejected_users()
681
        # new_rejected_user and expired_rejected_user are deleted
682
        User = get_user_model()
683
        self.assertEqual(RegistrationProfile.objects.count(), 4)
684
        self.assertRaises(User.DoesNotExist,
685
                          User.objects.get,
686
                          username='new_rejected_user')
687
        self.assertRaises(User.DoesNotExist,
688
                          User.objects.get,
689
                          username='expired_rejected_user')
690
691
    def test_management_command_cleanup_expired_registrations(self):
692
        RegistrationProfile.objects.register(
@@ 756-821 (lines=66) @@
753
        self.assertRaises(User.DoesNotExist, User.objects.get,
754
                          username='expired_accepted_user')
755
756
    def test_management_command_cleanup_rejected_registrations(self):
757
        RegistrationProfile.objects.register(
758
            username='new_untreated_user',
759
            email='[email protected]',
760
            site=self.mock_site,
761
        )
762
        new_accepted_user = RegistrationProfile.objects.register(
763
            username='new_accepted_user',
764
            email='[email protected]',
765
            site=self.mock_site,
766
        )
767
        new_rejected_user = RegistrationProfile.objects.register(
768
            username='new_rejected_user',
769
            email='[email protected]',
770
            site=self.mock_site,
771
        )
772
        expired_untreated_user = RegistrationProfile.objects.register(
773
            username='expired untreated user',
774
            email='[email protected]',
775
            site=self.mock_site,
776
        )
777
        expired_accepted_user = RegistrationProfile.objects.register(
778
            username='expired_accepted_user',
779
            email='[email protected]',
780
            site=self.mock_site,
781
        )
782
        expired_rejected_user = RegistrationProfile.objects.register(
783
            username='expired_rejected_user',
784
            email='[email protected]',
785
            site=self.mock_site,
786
        )
787
788
        RegistrationProfile.objects.accept_registration(
789
            new_accepted_user.registration_profile,
790
            site=self.mock_site,
791
        )
792
        RegistrationProfile.objects.reject_registration(
793
            new_rejected_user.registration_profile,
794
            site=self.mock_site,
795
        )
796
        RegistrationProfile.objects.accept_registration(
797
            expired_accepted_user.registration_profile,
798
            site=self.mock_site,
799
        )
800
        RegistrationProfile.objects.reject_registration(
801
            expired_rejected_user.registration_profile,
802
            site=self.mock_site,
803
        )
804
805
        delta = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS+1)
806
807
        expired_untreated_user.date_joined -= delta
808
        expired_untreated_user.save()
809
        expired_accepted_user.date_joined -= delta
810
        expired_accepted_user.save()
811
        expired_rejected_user.date_joined -= delta
812
        expired_rejected_user.save()
813
814
        management.call_command('cleanup_rejected_registrations')
815
        # new_rejected_user and expired_rejected_user are deleted
816
        User = get_user_model()
817
        self.assertEqual(RegistrationProfile.objects.count(), 4)
818
        self.assertRaises(User.DoesNotExist, User.objects.get,
819
                          username='new_rejected_user')
820
        self.assertRaises(User.DoesNotExist, User.objects.get,
821
                          username='expired_rejected_user')
822
823
    def test_management_command_cleanup_registrations(self):
824
        RegistrationProfile.objects.register(
@@ 556-620 (lines=65) @@
553
            RegistrationProfile.objects.filter(pk=profile.pk).exists()
554
        )
555
556
    def test_expired_user_deletion(self):
557
        RegistrationProfile.objects.register(
558
            username='new_untreated_user',
559
            email='[email protected]',
560
            site=self.mock_site,
561
        )
562
        new_accepted_user = RegistrationProfile.objects.register(
563
            username='new_accepted_user',
564
            email='[email protected]',
565
            site=self.mock_site,
566
        )
567
        new_rejected_user = RegistrationProfile.objects.register(
568
            username='new_rejected_user',
569
            email='[email protected]',
570
            site=self.mock_site,
571
        )
572
        expired_untreated_user = RegistrationProfile.objects.register(
573
            username='expired untreated user',
574
            email='[email protected]',
575
            site=self.mock_site,
576
        )
577
        expired_accepted_user = RegistrationProfile.objects.register(
578
            username='expired_accepted_user',
579
            email='[email protected]',
580
            site=self.mock_site,
581
        )
582
        expired_rejected_user = RegistrationProfile.objects.register(
583
            username='expired_rejected_user',
584
            email='[email protected]',
585
            site=self.mock_site,
586
        )
587
588
        RegistrationProfile.objects.accept_registration(
589
            new_accepted_user.registration_profile,
590
            site=self.mock_site,
591
        )
592
        RegistrationProfile.objects.reject_registration(
593
            new_rejected_user.registration_profile,
594
            site=self.mock_site,
595
        )
596
        RegistrationProfile.objects.accept_registration(
597
            expired_accepted_user.registration_profile,
598
            site=self.mock_site,
599
        )
600
        RegistrationProfile.objects.reject_registration(
601
            expired_rejected_user.registration_profile,
602
            site=self.mock_site,
603
        )
604
605
        delta = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS+1)
606
607
        expired_untreated_user.date_joined -= delta
608
        expired_untreated_user.save()
609
        expired_accepted_user.date_joined -= delta
610
        expired_accepted_user.save()
611
        expired_rejected_user.date_joined -= delta
612
        expired_rejected_user.save()
613
614
        RegistrationProfile.objects.delete_expired_users()
615
        # Only expired_accepted_user is deleted
616
        User = get_user_model()
617
        self.assertEqual(RegistrationProfile.objects.count(), 5)
618
        self.assertRaises(User.DoesNotExist,
619
                          User.objects.get,
620
                          username='expired_accepted_user')
621
622
    def test_rejected_user_deletion(self):
623
        RegistrationProfile.objects.register(
@@ 691-754 (lines=64) @@
688
                          User.objects.get,
689
                          username='expired_rejected_user')
690
691
    def test_management_command_cleanup_expired_registrations(self):
692
        RegistrationProfile.objects.register(
693
            username='new_untreated_user',
694
            email='[email protected]',
695
            site=self.mock_site,
696
        )
697
        new_accepted_user = RegistrationProfile.objects.register(
698
            username='new_accepted_user',
699
            email='[email protected]',
700
            site=self.mock_site,
701
        )
702
        new_rejected_user = RegistrationProfile.objects.register(
703
            username='new_rejected_user',
704
            email='[email protected]',
705
            site=self.mock_site,
706
        )
707
        expired_untreated_user = RegistrationProfile.objects.register(
708
            username='expired untreated user',
709
            email='[email protected]',
710
            site=self.mock_site,
711
        )
712
        expired_accepted_user = RegistrationProfile.objects.register(
713
            username='expired_accepted_user',
714
            email='[email protected]',
715
            site=self.mock_site,
716
        )
717
        expired_rejected_user = RegistrationProfile.objects.register(
718
            username='expired_rejected_user',
719
            email='[email protected]',
720
            site=self.mock_site,
721
        )
722
723
        RegistrationProfile.objects.accept_registration(
724
            new_accepted_user.registration_profile,
725
            site=self.mock_site,
726
        )
727
        RegistrationProfile.objects.reject_registration(
728
            new_rejected_user.registration_profile,
729
            site=self.mock_site,
730
        )
731
        RegistrationProfile.objects.accept_registration(
732
            expired_accepted_user.registration_profile,
733
            site=self.mock_site,
734
        )
735
        RegistrationProfile.objects.reject_registration(
736
            expired_rejected_user.registration_profile,
737
            site=self.mock_site,
738
        )
739
740
        delta = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS+1)
741
742
        expired_untreated_user.date_joined -= delta
743
        expired_untreated_user.save()
744
        expired_accepted_user.date_joined -= delta
745
        expired_accepted_user.save()
746
        expired_rejected_user.date_joined -= delta
747
        expired_rejected_user.save()
748
749
        management.call_command('cleanup_expired_registrations')
750
        # Only expired_accepted_user is deleted
751
        User = get_user_model()
752
        self.assertEqual(RegistrationProfile.objects.count(), 5)
753
        self.assertRaises(User.DoesNotExist, User.objects.get,
754
                          username='expired_accepted_user')
755
756
    def test_management_command_cleanup_rejected_registrations(self):
757
        RegistrationProfile.objects.register(