Ejemplo n.º 1
0
    def test_get_section_details(self):
        responses.add(
            responses.GET,
            'https://psmobile.pitt.edu/app/catalog/classsection/UPITT/2194/27469',
            body=self.cs_extra_data_2,
            status=200)
        with patch('requests.Session') as mock:
            mock.return_value = MockSession(self.cs_section_data)
            cs_section = course.get_section_details('2194', '27469')
            self.assertEqual(cs_section.instructor, 'William Laboon')
            self.assertEqual(
                str(cs_section),
                'PittSection(CS, 1632, LEC, 27469, William Laboon)')

            self.assertEqual(cs_section.term, '2194')
            self.assertEqual(cs_section.subject, 'CS')
            self.assertEqual(cs_section.course_number, '1632')
            self.assertEqual(cs_section.course_title,
                             'SOFTWARE QUALITY ASSURANCE')
            self.assertEqual(repr(cs_section),
                             json.dumps(cs_section.to_dict()))

            self.assertIsInstance(cs_section.extra_details, dict)
            self.assertIsInstance(cs_section.extra_details, dict)

            self.assertIsInstance(cs_section.to_dict(), dict)
            self.assertIsInstance(cs_section.to_dict(extra_details=True), dict)
Ejemplo n.º 2
0
 def test_get_section_details_basic_extra_details(self):
     responses.add(responses.GET, 'https://psmobile.pitt.edu/app/catalog/classsection/UPITT/2194/27469',
                   body=self.cs_extra_data_4, status=200)
     with patch('requests.Session') as mock:
         mock.return_value = MockSession(self.cs_section_data)
         cs_section = course.get_section_details('2194', '27469')
         self.assertIsInstance(cs_section.extra_details, dict)
         self.assertIsInstance(cs_section.extra_details, dict)
Ejemplo n.º 3
0
 def test_get_section_details_improper_section_type(self):
     responses.add(responses.GET, 'https://psmobile.pitt.edu/app/catalog/classsection/UPITT/2194/27469',
                   body=self.cs_extra_data_1, status=200)
     with patch('requests.Session') as mock:
         mock.return_value = MockSession(self.cs_section_data)
         cs_section = course.get_section_details('2194', 27469)
         self.assertEqual(cs_section.instructor, 'William Laboon')
         self.assertEqual(str(cs_section), 'PittSection(CS, 1632, LEC, 27469, William Laboon)')