コード例 #1
0
    def setUp(self):
        """ Create variables for testing """

        # Create a user to be used for testing
        self.user, self.info = Factory.create_user()
        Factory.create_session(self.info.organization, self.user)

        # Create some organizations and sessions
        self.org1 = Factory.create_organization(self.user)
        self.session1 = Factory.create_session(self.org1, self.user)
コード例 #2
0
    def handle(self, **options):
        # Delete what was there before so we have a clean start
        User.objects.filter(username='******').delete()
        User.objects.filter(username__startswith='testuser').delete()

        admin = Factory.create_admin()

        # Typical-case organization
        chess = Factory.create_organization(admin, name='UNC Chess Club')
        chess_session = Factory.create_session(chess, admin, name='Fall 2016')
        self.add_users(chess_session, 10)

        # Orgainization with two sessions
        strawhats = Factory.create_organization(admin, name='Strawhats')
        strawhats_session1 = Factory.create_session(strawhats, admin,
            name='East Blue')
        self.add_users(strawhats_session1, 9)
        strawhats_session2 = Factory.create_session(strawhats, admin,
            name='Grand Line')
        self.add_users(strawhats_session2, 11)

        # Organization where not everyone has completed all of the inventories
        incomplete = Factory.create_organization(admin, name='Incompletionists')
        incomplete_session = Factory.create_session(incomplete, admin, name='Fall 2016')

        for i in range(10):
            # Everyone completes BigFive
            inventory_cls_list = [BigFive]

            # 9 users complete CoreSelf
            if i != 9:
                inventory_cls_list.append(CoreSelf)

            # 2 users complete CareerCommitment
            if i < 2:
                inventory_cls_list.append(CareerCommitment)

            # 1 user completes Ambiguity and Via
            if i == 0:
                inventory_cls_list.append(Ambiguity)
                inventory_cls_list.append(Via)

            # No one completes FIRO-B or Via

            self.add_user(incomplete_session, inventory_cls_list)

        print()
コード例 #3
0
    def setUp(self):
        """ Set up submission data in an organization for testing """

        # Admin account without leaduserinfo
        self.admin = Factory.create_admin()

        # Create an organization with three sessions
        self.org = Factory.create_organization(self.admin)
        self.session1 = Factory.create_session(self.org, self.admin)
        self.session2 = Factory.create_session(self.org, self.admin)
        self.session3 = Factory.create_session(self.org, self.admin)
        self.sessions = [self.session1, self.session2, self.session3]

        # Attach an explicit, non staff user, to the organization
        self.user, self.info = Factory.create_user(self.session1)

        # Generate data (3 sets of submissions) for each session
        for session in self.sessions:
            for i in range(0, 3):
                user, info = Factory.create_user(session)
                Factory.create_set_of_submissions(user)