Exemplo n.º 1
0
    def test_all_registrations_with_transcriptable_course(self, mock_get_resource):
        with self.settings(
                RESTCLIENTS_SWS_DAO_CLASS='restclients.dao_implementation.sws.File',
                RESTCLIENTS_PWS_DAO_CLASS='restclients.dao_implementation.pws.File'):

            section = get_section_by_label('2013,winter,DROP_T,100/B')

            # Test for default resource, i.e. transcriptable_course=yes
            registrations = get_all_registrations_by_section(section)
            mock_get_resource.assert_called_with('/student/v5/registration.json?curriculum_abbreviation=DROP_T&instructor_reg_id=&course_number=100&verbose=true&year=2013&quarter=winter&is_active=&section_id=B')

            # Test for transcriptable_course=yes explicitly
            registrations = get_all_registrations_by_section(
                section, transcriptable_course='yes')
            mock_get_resource.assert_called_with('/student/v5/registration.json?curriculum_abbreviation=DROP_T&instructor_reg_id=&course_number=100&verbose=true&year=2013&quarter=winter&is_active=&section_id=B&transcriptable_course=yes')

            # Test for transcriptable_course=all resource
            registrations = get_all_registrations_by_section(
                section, transcriptable_course='all')
            mock_get_resource.assert_called_with('/student/v5/registration.json?curriculum_abbreviation=DROP_T&instructor_reg_id=&course_number=100&verbose=true&year=2013&quarter=winter&is_active=&section_id=B&transcriptable_course=all')

            # Test for transcriptable_course=no
            registrations = get_all_registrations_by_section(
                section, transcriptable_course='no')
            mock_get_resource.assert_called_with('/student/v5/registration.json?curriculum_abbreviation=DROP_T&instructor_reg_id=&course_number=100&verbose=true&year=2013&quarter=winter&is_active=&section_id=B&transcriptable_course=no')
Exemplo n.º 2
0
    def test_enrollments(self):
        with self.settings(
                RESTCLIENTS_SWS_DAO_CLASS='restclients.dao_implementation.sws.File',
                RESTCLIENTS_PWS_DAO_CLASS='restclients.dao_implementation.pws.File'):

            user = PWS().get_person_by_netid('javerage')

            csv = Collector()
            self.assertEquals(len(csv.enrollments), 0)
            self.assertEquals(csv.add(EnrollmentCSV(section_id='abc', person=user,
                role='Student', status='active')), True)
            self.assertEquals(len(csv.enrollments), 1)

            section = get_section_by_label('2013,winter,DROP_T,100/B')

            for registration in get_all_registrations_by_section(section):
                self.assertEquals(csv.add(EnrollmentCSV(registration=registration)), True)

            section = get_section_by_label('2013,spring,TRAIN,101/A')

            for user in section.get_instructors():
                self.assertEquals(csv.add(EnrollmentCSV(section=section,
                    instructor=user, status='active')), True)

            self.assertEquals(len(csv.enrollments), 4)
            self.assertEquals(csv.has_data(), True)
Exemplo n.º 3
0
    def test_student_enrollment_csv(self):
        with self.settings(
                RESTCLIENTS_SWS_DAO_CLASS='restclients.dao_implementation.sws.File',
                RESTCLIENTS_PWS_DAO_CLASS='restclients.dao_implementation.pws.File'):

            section = get_section_by_label('2013,winter,DROP_T,100/B')

            for registration in get_all_registrations_by_section(section):
                self.assertEquals(str(EnrollmentCSV(registration=registration)), ',,%s,Student,,2013-winter-DROP_T-100-B--,active,\n' % registration.person.uwregid)
Exemplo n.º 4
0
    def test_active_registration_status_after_drop_and_add(self):
        with self.settings(
                RESTCLIENTS_SWS_DAO_CLASS='restclients.dao_implementation.sws.File',
                RESTCLIENTS_PWS_DAO_CLASS='restclients.dao_implementation.pws.File'):

            section = get_section_by_label('2013,winter,DROP_T,100/B')
            registrations = get_all_registrations_by_section(section)

            self.assertEquals(len(registrations), 1)
            javerage_reg = registrations[0]
            self.assertEquals(javerage_reg.person.uwnetid, 'javerage')
            self.assertEquals(javerage_reg.is_active, True)
Exemplo n.º 5
0
    def test_active_registration_status_after_drop_and_add(self):
        with self.settings(
                RESTCLIENTS_SWS_DAO_CLASS='restclients.dao_implementation.sws.File',
                RESTCLIENTS_PWS_DAO_CLASS='restclients.dao_implementation.pws.File'):

            section = get_section_by_label('2013,winter,DROP_T,100/B')
            registrations = get_all_registrations_by_section(section)

            self.assertEquals(len(registrations), 3)
            javerage_reg = registrations[2]
            self.assertEquals(javerage_reg.person.uwnetid, 'javerage')
            self.assertEquals(javerage_reg.is_active, True)
            self.assertEquals(javerage_reg.is_auditor, True)
            self.assertEquals(javerage_reg.is_credit, True)
            self.assertEquals(str(javerage_reg.request_date.date()), '2015-11-18')
            self.assertEquals(javerage_reg.request_status, 'ADDED TO CLASS')
            self.assertEquals(javerage_reg.duplicate_code, 'A')
            self.assertEquals(javerage_reg.repository_timestamp.isoformat(), '2016-01-05T02:45:15')
Exemplo n.º 6
0
 def get_all_registrations_for_section(self, section):
     deprecation(
         "Use restclients.sws.registration.get_all_registrations_by_section")
     from restclients.sws.registration import get_all_registrations_by_section
     return get_all_registrations_by_section(section)
Exemplo n.º 7
0
 def get_all_registrations_for_section(self, section):
     deprecation(
         "Use restclients.sws.registration.get_all_registrations_by_section")
     from restclients.sws.registration import get_all_registrations_by_section
     return get_all_registrations_by_section(section)
Exemplo n.º 8
0
def get_registrations_by_section(section):
    return get_all_registrations_by_section(section, transcriptable_course="all")