コード例 #1
0
 def test_saving_and_retrieving_scene_descriptions(self):
     self.artist_ = Author.objects.create(first_name='First',
                                          last_name='Last')
     self.artwork_ = Artwork.objects.create(title='Artwork Title',
                                            artist=self.artist_)
     scene = Scene(artwork=self.artwork_)
     scene.description = 'the first list item described'
     scene.longitude = -122.41575
     scene.latitude = 37.749202
     scene.save()
     self.assertEqual(Scene.objects.count(), 1)
     scene.delete()
     self.assertEqual(Scene.objects.count(), 0)
コード例 #2
0
    def test_saving_a_movie_to_a_scene(self):
        a_ = Director.objects.create(full_name="Skip X")
        m_ = Movie.objects.create(artist=a_)

        scene = Scene(artwork=m_)
        scene.description = 'the first list item described'
        scene.notes = 'noted'
        scene.name = 'scene name'
        scene.longitude = -122.41575
        scene.latitude = 37.749202
        scene.save()
        self.assertEqual(Scene.objects.count(), 1)
        first = Scene.objects.first()
        self.assertEqual(first.artwork.artist.full_name, a_.full_name)
        scene.delete()
        scene.full_clean()
        self.assertEqual(Scene.objects.count(), 0)