def testQueuedItem(self): self.assertEqual(QueuedItem.objects.count(), 1) self.assertTrue( isinstance(QueuedItem.objects.all()[0].content_object, User)) f = Film( type=1, permalink='przypadek', imdb_code=111, status=1, version=1, \ release_year=1999, title='Przypadek' ) f.save() self.assertEqual(QueuedItem.objects.count(), 3) self.assertTrue( isinstance(QueuedItem.objects.all()[1].content_object, Film)) modified_at = QueuedItem.objects.all()[1].modified_at f.title = 'Przypadek - test' f.save() self.assertEqual(QueuedItem.objects.count(), 3) self.assertTrue(QueuedItem.objects.all()[1].modified_at > modified_at) f.delete() self.assertEqual(QueuedItem.objects.all()[1].action_type, QueuedItem.ACTION_REMOVED) self.assertEqual(QueuedItem.objects.count(), 3)
def testQueueCommand( self ): f = Film( type=1, permalink='przypadek', imdb_code=111, status=1, version=1, \ release_year=1999, title='Przypadek' ) f.save() f.delete() self.assertEqual( QueuedItem.objects.count(), 3 ) call_command( 'update_index_queue' ) self.assertEqual( QueuedItem.objects.count(), 1 )
def testQueueCommand(self): f = Film( type=1, permalink='przypadek', imdb_code=111, status=1, version=1, \ release_year=1999, title='Przypadek' ) f.save() f.delete() self.assertEqual(QueuedItem.objects.count(), 3) call_command('update_index_queue') self.assertEqual(QueuedItem.objects.count(), 1)
def testQueuedItem( self ): self.assertEqual( QueuedItem.objects.count(), 1 ) self.assertTrue( isinstance( QueuedItem.objects.all()[0].content_object, User ) ) f = Film( type=1, permalink='przypadek', imdb_code=111, status=1, version=1, \ release_year=1999, title='Przypadek' ) f.save() self.assertEqual( QueuedItem.objects.count(), 3 ) self.assertTrue( isinstance( QueuedItem.objects.all()[1].content_object, Film ) ) modified_at = QueuedItem.objects.all()[1].modified_at f.title = 'Przypadek - test' f.save() self.assertEqual( QueuedItem.objects.count(), 3 ) self.assertTrue( QueuedItem.objects.all()[1].modified_at > modified_at ) f.delete() self.assertEqual( QueuedItem.objects.all()[1].action_type, QueuedItem.ACTION_REMOVED ) self.assertEqual( QueuedItem.objects.count(), 3 )