Example #1
0
    def testUpdateTeamChangesDatabaseObject(self):
        team = generate_objects.valid_team()
        team.speaker1 = 'oldsp1'
        team.speaker2 = 'oldsp2'

        request = self.factory.post('/data/team/' + str(team.id) + '/update/',
                                    data={
                                        'name': 'New Name',
                                        'speaker1' : 'newsp1',
                                        'speaker2' : 'newsp2',
                                        'institution' : team.institution.id
                                    })
        view = UpdateTeamView()
        view.post(request, team.id)

        team.refresh_from_db()

        self.assertEqual("New Name", team.name, "Team name wasn't updated")
        self.assertEqual("newsp1", team.speaker1, "Speaker 1 was not updated")
        self.assertEqual("newsp2", team.speaker2, "Speaker 2 was not updated")
Example #2
0
    def testUpdateTeamWithTeamDoesntExist(self):
        view = UpdateTeamView()

        with self.assertRaises(Http404):
            view.post(None, 0)