Beispiel #1
0
    def test_self(self):
        """Authenticated users shouldn't be able to create countries."""
        TestUsers.new_user(username="******", password="******")
        self.client.login(username="******", password="******")

        response = self.get_response(self.params)
        self.assertMethodNotAllowed(response, "POST")
Beispiel #2
0
    def test_superuser(self):
        '''Superusers shouldn't be able to update committees.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.committee.id, params=self.params)
        self.assertMethodNotAllowed(response, 'PATCH')
Beispiel #3
0
    def test_self(self):
        '''Authenticated users shouldn't have permission to delete committees.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.committee.id)
        self.assertMethodNotAllowed(response, 'DELETE')
Beispiel #4
0
    def test_self(self):
        '''Authenticated users shouldn't be able to create countries.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.params)
        self.assertMethodNotAllowed(response, 'POST')
Beispiel #5
0
    def test_authenticated_user(self):
        '''Authenticated users shouldn't be able to update committees.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.committee.id, params=self.params)
        self.assertMethodNotAllowed(response, 'PATCH')
Beispiel #6
0
    def test_self(self):
        """Authenticated users shouldn't have permission to delete countries."""
        TestUsers.new_user(username="******", password="******")
        self.client.login(username="******", password="******")

        response = self.get_response(self.country.id)
        self.assertMethodNotAllowed(response, "DELETE")
Beispiel #7
0
    def test_import(self):
        '''Test that the admin panel can import delegates. '''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        school = TestSchools.new_school()
        cm1 = TestCommittees.new_committee(name='SPD')
        cm2 = TestCommittees.new_committee(name='USS')
        co1 = TestCountries.new_country(name="Côte d'Ivoire")
        co2 = TestCountries.new_country(name='Barbara Boxer')
        Assignment.objects.create(committee=cm1, country=co1, school=school)
        Assignment.objects.create(committee=cm2, country=co2, school=school)

        f = TestFiles.new_csv([
            ['Name', 'Committee', 'Country', 'School'],
            ['John Doe', 'SPD', "Côte d'Ivoire", 'Test School'],
            ['Jane Doe', 'USS', 'Barbara Boxer', 'Test School'],
        ])

        with closing(f) as f:
            self.client.post(reverse('admin:core_delegate_load'), {'csv': f})

        self.assertTrue(
            Delegate.objects.filter(assignment=Assignment.objects.get(
                school=School.objects.get(name='Test School'),
                committee=Committee.objects.get(name='SPD'),
                country=Country.objects.get(name="Côte d'Ivoire")),
                                    name='John Doe').exists())
        self.assertTrue(
            Delegate.objects.filter(assignment=Assignment.objects.get(
                school=School.objects.get(name='Test School'),
                committee=Committee.objects.get(name='USS'),
                country=Country.objects.get(name='Barbara Boxer')),
                                    name='Jane Doe').exists())
Beispiel #8
0
    def test_authenticated_user(self):
        '''Authenticated users shouldn't be able to update countries.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.country.id, params=self.params)
        self.assertPermissionDenied(response)
Beispiel #9
0
    def test_import(self):
        '''Test that the admin panel can import committees.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        f = TestFiles.new_csv([
            ['SPD', 'Special Pôlitical and Decolonization', 2, ''],
            ['USS', 'United States Senate', 2, True]
        ])

        with closing(f) as f:
            self.client.post(reverse('admin:core_committee_load'), {'csv': f})

        self.assertTrue(Committee.objects.filter(
            name='SPD',
            full_name='Special Pôlitical and Decolonization',
            delegation_size=2,
            special=False
        ).exists())
        self.assertTrue(Committee.objects.filter(
            name='USS',
            full_name='United States Senate',
            delegation_size=2,
            special=True
        ).exists())
Beispiel #10
0
    def test_anonymous_user(self):
        '''It should reject the request from an anonymous user.'''
        TestUsers.new_user(username='******')
        TestUsers.new_user(username='******')

        response = self.get_response()
        self.assertNotAuthenticated(response)
Beispiel #11
0
    def test_super_user(self):
        '''Countries should not be able to be deleted'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.country.id)
        self.assertMethodNotAllowed(response, 'DELETE')
Beispiel #12
0
    def test_authenticated_user(self):
        '''Authenticated users shouldn't be able to update countries.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.country.id, params=self.params)
        self.assertPermissionDenied(response)
    def test_superuser(self):
        '''It finalizes the assignments for a superuser.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.school.id)
        self.assertFinalized(response)
Beispiel #14
0
    def test_self(self):
        '''Authenticated users shouldn't have permission to delete countries.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.country.id)
        self.assertPermissionDenied(response)
Beispiel #15
0
    def test_import(self):
        '''Test that the admin panel can import Assignments.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        school = TestSchools.new_school()
        cm1 = TestCommittees.new_committee(name='SPD')
        cm2 = TestCommittees.new_committee(name='USS')
        co1 = TestCountries.new_country(name="Côte d'Ivoire")
        co2 = TestCountries.new_country(name='Barbara Boxer')

        f = TestFiles.new_csv([['Test School', 'SPD', "Côte d'Ivoire"],
                               ['Test School', 'USS', 'Barbara Boxer']])

        with closing(f) as f:
            self.client.post(reverse('admin:core_assignment_load'), {'csv': f})

        self.assertTrue(
            Assignment.objects.filter(
                school=School.objects.get(name='Test School'),
                committee=Committee.objects.get(name='SPD'),
                country=Country.objects.get(name="Côte d'Ivoire")).exists())
        self.assertTrue(
            Assignment.objects.filter(
                school=School.objects.get(name='Test School'),
                committee=Committee.objects.get(name='USS'),
                country=Country.objects.get(name='Barbara Boxer')).exists())
Beispiel #16
0
    def test_superuser(self):
        '''Assignments should not be able to be deleted through API'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.assignment.id)
        self.assert204(response)
    def test_superuser(self):
        '''It returns the assignments for a superuser.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.school.id)
        self.assert_assignments_equal(response)
    def test_superuser(self):
        '''It finalizes the assignments for a superuser.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.assignment.id)
        self.assertDeleted(response)
Beispiel #19
0
    def test_super_user(self):
        '''Countries should not be able to be deleted'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.country.id)
        self.assertMethodNotAllowed(response, 'DELETE')
Beispiel #20
0
    def test_superuser(self):
        '''Superusers shouldn't be able to update countries.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.country.id, params=self.params)
        self.assertMethodNotAllowed(response, 'PATCH')
Beispiel #21
0
    def test_superuser(self):
        '''It updates the delegates for a superuser.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.school.id)
        self.assertEqual(dict(response.data[0]),
            {
                'id': self.delegate1.id,
                'assignment': self.params[0]['assignment'],
                'school': self.delegate1.school.id,
                'name': unicode(self.delegate1.name),
                'email': unicode(self.delegate1.email),
                'summary': unicode(self.delegate1.summary),
                'created_at': self.delegate1.created_at.isoformat()
            },
        )
        self.assertEqual(dict(response.data[1]),
            {
                'id': self.delegate2.id,
                'assignment': self.params[1]['assignment'],
                'school': self.delegate2.school.id,
                'name': unicode(self.delegate2.name),
                'email': unicode(self.delegate2.email),
                'summary': unicode(self.delegate2.summary),
                'created_at': self.delegate2.created_at.isoformat()
            },
        )
Beispiel #22
0
    def test_super_user(self):
        """Countries should not be able to be deleted"""
        TestUsers.new_superuser(username="******", password="******")
        self.client.login(username="******", password="******")

        response = self.get_response(self.country.id)
        self.assertMethodNotAllowed(response, "DELETE")
Beispiel #23
0
    def test_anonymous_user(self):
        '''It should reject the request from an anonymous user.'''
        TestUsers.new_user(username='******')
        TestUsers.new_user(username='******')

        response = self.get_response()
        self.assertNotAuthenticated(response)
Beispiel #24
0
    def test_super_user(self):
        '''Superusers shouldn't be able to create countries.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.params)
        self.assertMethodNotAllowed(response, 'POST')
Beispiel #25
0
    def test_import(self):
        '''Test that the admin panel can import Assignments.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        school = TestSchools.new_school()
        cm1 = TestCommittees.new_committee(name='SPD')
        cm2 = TestCommittees.new_committee(name='USS')
        co1 = TestCountries.new_country(name="Côte d'Ivoire")
        co2 = TestCountries.new_country(name='Barbara Boxer')

        f = TestFiles.new_csv([
            ['Test School', 'SPD', "Côte d'Ivoire"],
            ['Test School', 'USS', 'Barbara Boxer']
        ])

        with closing(f) as f:
            self.client.post(reverse('admin:core_assignment_load'), {'csv': f})

        self.assertTrue(Assignment.objects.filter(
            school=School.objects.get(name='Test School'),
            committee=Committee.objects.get(name='SPD'),
            country=Country.objects.get(name="Côte d'Ivoire")
        ).exists())
        self.assertTrue(Assignment.objects.filter(
            school=School.objects.get(name='Test School'),
            committee=Committee.objects.get(name='USS'),
            country=Country.objects.get(name='Barbara Boxer')
        ).exists())
Beispiel #26
0
    def test_self(self):
        '''Authenticated users shouldn't have permission to delete countries.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.country.id)
        self.assertPermissionDenied(response)
Beispiel #27
0
    def test_superuser(self):
        """Superusers shouldn't be able to update countries."""
        TestUsers.new_superuser(username="******", password="******")
        self.client.login(username="******", password="******")

        response = self.get_response(self.country.id, params=self.params)
        self.assertMethodNotAllowed(response, "PATCH")
Beispiel #28
0
    def test_preference_export(self):
        '''Test that the admin panel can properly export school preferences.'''
        TestUsers.new_user(username='******', password='******')
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')
        school = TestSchools.new_school()
        self.client.logout()
        self.client.login(username='******', password='******')

        response = self.client.get(reverse('admin:core_school_preferences'))

        self.assertTrue(response)

        header = [
            "Name",
            "Assignments Requested",
            "Beginners",
            "Intermediates",
            "Advanced",
            "Spanish Speakers",
            "Bilingual?",
            "Specialized/Regional?",
            "Crisis?",
            "Alternative?",
            "Press Corps?",
            "Country 1",
            "Country 2",
            "Country 3",
            "Country 4",
            "Country 5",
            "Country 6",
            "Country 7",
            "Country 8",
            "Country 9",
            "Country 10",
            "Registration Comments"
            ]

        fields_csv = ",".join(map(str, header)) + "\r\n"

        countryprefs = [c for c in school.countrypreferences.all()]
        countryprefs += [''] * (10 - len(countryprefs))

        fields = [
                school.name,
                school.beginner_delegates + school.intermediate_delegates + school.advanced_delegates,
                school.beginner_delegates,
                school.intermediate_delegates,
                school.advanced_delegates,
                school.spanish_speaking_delegates,
                school.prefers_bilingual,
                school.prefers_specialized_regional,
                school.prefers_crisis,
                school.prefers_alternative,
                school.prefers_press_corps]
        fields.extend(countryprefs)
        fields.append(school.registration_comments)

        fields_csv += ",".join(map(str, fields))
        self.assertEquals(fields_csv, response.content[:-2])
Beispiel #29
0
    def test_superuser(self):
        '''Superusers shouldn't be able to create committees.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.params)
        self.assertMethodNotAllowed(response, 'POST')
Beispiel #30
0
    def test_superuser(self):
        '''Assignments should not be able to be deleted through API'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.assignment.id)
        self.assert204(response)
Beispiel #31
0
    def test_authenticated_user(self):
        '''Authenticated users shouldn't be able to create committees.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.params)
        self.assertMethodNotAllowed(response, 'POST')
Beispiel #32
0
    def test_import(self):
        '''Test that the admin panel can import countries. '''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        f = TestFiles.new_csv([
            ['United States of America', ''],
            ['Barbara Boxer', True],
            ["Côte d'Ivoire", '']
        ])

        with closing(f) as f:
            self.client.post(reverse('admin:core_country_load'), {'csv': f})

        self.assertTrue(Country.objects.filter(
            name='United States of America',
            special=False
        ).exists())
        self.assertTrue(Country.objects.filter(
            name='Barbara Boxer',
            special=True
        ).exists())
        self.assertTrue(Country.objects.filter(
            name="Côte d'Ivoire",
            special=False
        ).exists())
Beispiel #33
0
    def test_self(self):
        '''Authenticated users shouldn't have permission to delete committees.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.committee.id)
        self.assertMethodNotAllowed(response, 'DELETE')
Beispiel #34
0
    def test_superuser(self):
        '''It returns the delegates for a superuser.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.school.id)
        self.assert_delegate_equal(response)
Beispiel #35
0
    def test_superuser(self):
        '''A superuser should not be able to delete an account.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')
        response = self.get_response(self.school.id)

        self.assertPermissionDenied(response)
        self.assertTrue(School.objects.filter(id=self.school.id).exists())
Beispiel #36
0
    def test_superuser(self):
        '''It should reject a request from a superuser.'''
        TestUsers.new_superuser(username='******', password='******')

        self.client.login(username='******', password='******')
        response = self.get_response()

        self.assertMethodNotAllowed(response, 'GET')
Beispiel #37
0
    def test_user(self):
        '''It should reject the request from a regular user.'''
        TestUsers.new_user(username='******', password='******')
        TestUsers.new_user(username='******')
        self.client.login(username='******', password='******')

        response = self.get_response()
        self.assertPermissionDenied(response)
Beispiel #38
0
    def test_superuser(self):
        '''It should reject a request from a superuser.'''
        TestUsers.new_superuser(username='******', password='******')

        self.client.login(username='******', password='******')
        response = self.get_response()

        self.assertMethodNotAllowed(response, 'GET')
Beispiel #39
0
    def test_user(self):
        '''It should reject the request from a regular user.'''
        TestUsers.new_user(username='******', password='******')
        TestUsers.new_user(username='******')
        self.client.login(username='******', password='******')

        response = self.get_response()
        self.assertPermissionDenied(response)
Beispiel #40
0
    def test_other_user(self):
        '''It should reject the request from another user.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.user.id)
        self.assertPermissionDenied(response)
        self.assertTrue(User.objects.filter(id=self.user.id).exists())
Beispiel #41
0
    def test_superuser(self):
        '''It should allow a superuser to delete a user.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.user.id)
        self.assertEqual(response.status_code, 204)
        self.assertFalse(User.objects.filter(id=self.user.id).exists())
Beispiel #42
0
    def test_superuser(self):
        '''A superuser should not be able to delete an account.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')
        response = self.get_response(self.school.id)

        self.assertPermissionDenied(response)
        self.assertTrue(School.objects.filter(id=self.school.id).exists())
Beispiel #43
0
    def test_other_user(self):
        '''It should reject the request from another user.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.user.id)
        self.assertPermissionDenied(response)
        self.assertTrue(HuxleyUser.objects.filter(id=self.user.id).exists())
Beispiel #44
0
    def test_superuser(self):
        '''It should allow a superuser to delete a user.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.user.id)
        self.assertEqual(response.status_code, 204)
        self.assertFalse(HuxleyUser.objects.filter(id=self.user.id).exists())
Beispiel #45
0
    def test_superuser(self):
        '''This should allow  a superuser to change school data.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')
        response = self.get_response(self.school.id, params=self.params)
        self.school = School.objects.get(id=self.school.id)

        self.assertEqual(response.data['name'], self.school.name)
        self.assertEqual(response.data['city'], self.school.city)
Beispiel #46
0
    def test_superuser(self):
        '''A superuser should be allowed to change information about a user.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.user.id, params=self.params)
        user = User.objects.get(id=self.user.id)
        self.assertEqual(response.data['first_name'], user.first_name)
        self.assertEqual(response.data['last_name'], user.last_name)
Beispiel #47
0
    def test_other_user(self):
        '''it should not allow a get request from another user.'''
        school = TestSchools.new_school()
        TestUsers.new_user(username='******', password='******')

        self.client.login(username='******', password='******')
        response = self.get_response(school.id)

        self.assertPermissionDenied(response)
Beispiel #48
0
    def test_other_user(self):
        '''It should reject request from another user.'''
        user1 = TestUsers.new_user(username='******')
        user2 = TestUsers.new_user(username='******', password='******')

        self.client.login(username='******', password='******')
        response = self.get_response(user1.id)

        self.assertPermissionDenied(response)
Beispiel #49
0
    def test_superuser(self):
        '''A superuser should be allowed to change information about a user.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.user.id, params=self.params)
        user = HuxleyUser.objects.get(id=self.user.id)
        self.assertEqual(response.data['first_name'], user.first_name)
        self.assertEqual(response.data['last_name'], user.last_name)
Beispiel #50
0
    def test_other_user(self):
        '''It should reject request from another user.'''
        user1 = TestUsers.new_user(username='******')
        user2 = TestUsers.new_user(username='******', password='******')

        self.client.login(username='******', password='******')
        response = self.get_response(user1.id)

        self.assertPermissionDenied(response)
Beispiel #51
0
    def test_superuser(self):
        '''This should allow  a superuser to change school data.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')
        response = self.get_response(self.school.id, params=self.params)
        self.school = School.objects.get(id=self.school.id)

        self.assertEqual(response.data['name'], self.school.name)
        self.assertEqual(response.data['city'], self.school.city)
Beispiel #52
0
    def test_other_user(self):
        '''it should not allow a get request from another user.'''
        school = TestSchools.new_school()
        TestUsers.new_user(username='******', password='******')

        self.client.login(username='******', password='******')
        response = self.get_response(school.id)

        self.assertPermissionDenied(response)
Beispiel #53
0
    def test_other_user(self):
        '''Should not allow another user to change a school's data'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')
        response = self.get_response(self.school.id, params=self.params)
        updated_school = School.objects.get(id=self.school.id)

        self.assertPermissionDenied(response)
        self.assertEqual(updated_school.name, self.school.name)
        self.assertEqual(updated_school.city, self.school.city)
Beispiel #54
0
    def test_other_user(self):
        '''Should not allow another user to change a school's data'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')
        response = self.get_response(self.school.id, params=self.params)
        updated_school = School.objects.get(id=self.school.id)

        self.assertPermissionDenied(response)
        self.assertEqual(updated_school.name, self.school.name)
        self.assertEqual(updated_school.city, self.school.city)
Beispiel #55
0
    def test_other_user(self):
        '''Another user should not be able to change information about any other user.'''
        TestUsers.new_user(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(self.user.id, params=self.params)
        self.assertPermissionDenied(response)

        user = HuxleyUser.objects.get(id=self.user.id)
        self.assertEqual(user.first_name, 'Test')
        self.assertEqual(user.last_name, 'User')
Beispiel #56
0
    def test_reset_password(self):
        '''It should correctly reset a user's password or raise an error.'''
        password = '******'
        user = TestUsers.new_user(username='******', password=password)
        self.assertTrue(user.check_password(password))

        User.reset_password('lololol')
        user = User.objects.get(id=user.id)
        self.assertFalse(user.check_password(password))

        with self.assertRaises(User.DoesNotExist):
            TestUsers.new_user(username='', email='')
            User.reset_password('')
Beispiel #57
0
    def test_superuser(self):
        '''Superusers should be able to create assignments.'''
        TestUsers.new_superuser(username='******', password='******')
        self.client.login(username='******', password='******')

        response = self.get_response(params=self.params)
        response.data.pop('id')
        self.assertEqual(
            response.data, {
                "committee": self.committee.id,
                "country": self.country.id,
                "school": self.school.id,
                "rejected": True,
            })
Beispiel #58
0
    def test_superuser(self):
        '''it should allow a get request from a superuser.'''
        school = TestSchools.new_school()
        user = TestUsers.new_superuser(username='******', password='******')

        self.client.login(username='******', password='******')
        response = self.get_response(school.id)

        self.assertEqual(
            response.data, {
                'id': school.id,
                'registered': school.registered,
                'name': school.name,
                'address': school.address,
                'city': school.city,
                'state': school.state,
                'zip_code': school.zip_code,
                'country': school.country,
                'primary_name': school.primary_name,
                'primary_email': school.primary_email,
                'primary_phone': school.primary_phone,
                'secondary_name': school.secondary_name,
                'secondary_email': school.secondary_email,
                'secondary_phone': school.secondary_phone,
                'program_type': school.program_type,
                'times_attended': school.times_attended,
                'min_delegation_size': school.min_delegation_size,
                'max_delegation_size': school.max_delegation_size,
                'international': school.international,
                'waitlist': school.waitlist
            })
Beispiel #59
0
    def test_superuser(self):
        '''It should return the correct fields for a superuser.'''
        user1 = TestUsers.new_user(username='******')
        user2 = TestUsers.new_superuser(username='******', password='******')

        self.client.login(username='******', password='******')
        response = self.get_response(user1.id)

        self.assertEqual(response.data, {
            'id': user1.id,
            'username': user1.username,
            'first_name': user1.first_name,
            'last_name': user1.last_name,
            'user_type': user1.user_type,
            'school': user1.school_id,
            'committee': user1.committee_id})