Esempio n. 1
0
    def test_updating_surname_no_error_throw(self):
        director = Director(name='ennio', surname='spilberg')
        director.full_clean()
        director.save()

        director.surname = 'McDoe'
        director.save()
        director.full_clean()
        director.refresh_from_db()

        self.assertEqual(Director.objects.count(), 1)
        self.assertEqual(1, director.id)
        self.assertEqual('ennio', director.name)
        self.assertEqual('McDoe', director.surname)
Esempio n. 2
0
    def test_updating_name_no_error_throw(self):
        director = Director(name='ennio', surname='spilberg')
        director.full_clean()
        director.save()
        created_date_src = director.created

        director.name = 'steven'
        director.save()
        director.full_clean()
        director.refresh_from_db()
        created_date_dest = director.created

        self.assertEqual(Director.objects.count(), 1)
        self.assertEqual(1, director.id)
        self.assertEqual('steven', director.name)
        self.assertEqual('spilberg', director.surname)
        self.assertEqual(created_date_dest, created_date_src)