示例#1
0
 def test_using_test_db(self):
     # Exactly the same code as the naive version
     with self.assertNumQueries(0):
         label = RecordLabel.objects.create(name='Circus Music')
         artist = Artist.objects.create(name='Freddy the Clown')
         album = Album.objects.create(name='All time circus classics', label=label, artist=artist)
         track = Track.objects.create(number=1, name='Tears of a Clown', album=album)
         other_artist = Artist.objects.create(name='Buttercup')
         track.collaborators.add(other_artist)
         self.assertEqual(track.track_details(), correct_details)
     data_store.clear()
示例#2
0
 def test_using_test_db(self):
     # Exactly the same code as the naive version
     with self.assertNumQueries(0):
         label = RecordLabel.objects.create(name='Circus Music')
         artist = Artist.objects.create(name='Freddy the Clown')
         album = Album.objects.create(name='All time circus classics',
                                      label=label,
                                      artist=artist)
         track = Track.objects.create(number=1,
                                      name='Tears of a Clown',
                                      album=album)
         other_artist = Artist.objects.create(name='Buttercup')
         track.collaborators.add(other_artist)
         self.assertEqual(track.track_details(), correct_details)
     data_store.clear()
示例#3
0
 def tearDown(self):
     # clear out the data store
     data_store.clear()
示例#4
0
 def tearDown(self):
     # clear out the data store
     data_store.clear()