Esempio n. 1
0
File: tests.py Progetto: palfrey/nih
 def testEnqueue(self):
     downloader.pause()
     (url, res) = self._enqueueTestTrack()
     self.assertEquals(res[u'entry'][u'url'], url)
     self.assertEquals(res[u'entry'][u'username'], "test_user")
     self.assertEquals(res[u'queue'], [])
     (url, res) = self._enqueueTestTrack(True)
     self.assertEquals(len(res[u'queue']), 1)
     downloader.unpause()
Esempio n. 2
0
File: tests.py Progetto: Ferada/nih
 def testEnqueue(self):
     downloader.pause()
     (url, res) = self._enqueueTestTrack()
     self.assertEquals(res[u'entry'][u'url'], url)
     self.assertEquals(res[u'entry'][u'username'], "test_user")
     self.assertEquals(res[u'queue'], [])
     (url, res) = self._enqueueTestTrack(True)
     self.assertEquals(len(res[u'queue']), 1)
     downloader.unpause()
Esempio n. 3
0
File: tests.py Progetto: palfrey/nih
 def testEnqueueTop(self):
     downloader.pause()
     (url1, res) = self._enqueueTestTrack(atTop=True)
     self.assertEquals(res[u'entry'][u'url'], url1)
     self.assertEquals(res[u'entry'][u'username'], "test_user")
     self.assertEquals(res[u'queue'], [])
     (url2, res) = self._enqueueTestTrack(atTop=True)
     self.assertEquals(len(res[u'queue']), 1)
     self.assertEquals(res[u'queue'][0][u'url'], url2, (url1, url2))
     (url3, res) = self._enqueueTestTrack(atTop=True)
     self.assertEquals(len(res[u'queue']), 2)
     self.assertEquals(res[u'queue'][0][u'url'], url3)
     self.assertEquals(res[u'queue'][1][u'url'], url2)
     downloader.unpause()
Esempio n. 4
0
File: tests.py Progetto: Ferada/nih
 def testEnqueueTop(self):
     downloader.pause()
     (url1, res) = self._enqueueTestTrack(atTop = True)
     self.assertEquals(res[u'entry'][u'url'], url1)
     self.assertEquals(res[u'entry'][u'username'], "test_user")
     self.assertEquals(res[u'queue'], [])
     (url2, res) = self._enqueueTestTrack(atTop = True)
     self.assertEquals(len(res[u'queue']), 1)
     self.assertEquals(res[u'queue'][0][u'url'], url2, (url1, url2))
     (url3, res) = self._enqueueTestTrack(atTop = True)
     self.assertEquals(len(res[u'queue']), 2)
     self.assertEquals(res[u'queue'][0][u'url'], url3)
     self.assertEquals(res[u'queue'][1][u'url'], url2)
     downloader.unpause()
Esempio n. 5
0
File: tests.py Progetto: palfrey/nih
    def testNotCachedYet(self):
        print "starting cache test"
        self.clear_queue()
        downloader.pause()

        (url, _) = self._enqueueTestTrack()
        (url2, _) = self._enqueueTestTrack()

        res = self._method("pause", False)
        self.assertNotEqual(res['entry'], None, res)
        self.assertEqual(res['entry']['url'], url, res)
        res = self._method("skip", "test_user")
        self.assertNotEqual(res['entry'], None, res)
        self.assertEqual(res['entry']['url'], url2, res)
        res = self._method("skip", "test_user")
        self.assertEqual(res['entry'], None, res)

        downloader.unpause()
Esempio n. 6
0
File: tests.py Progetto: Ferada/nih
    def testNotCachedYet(self):
        logger.debug("starting cache test")
        self.clear_queue()
        downloader.pause()

        (url, _) = self._enqueueTestTrack()
        (url2, _) = self._enqueueTestTrack()

        res = self._method("pause", False, "Foo")
        self.assertNotEqual(res['entry'], None, res)
        self.assertEqual(res['entry']['url'], url, res)
        res = self._method("skip", "test_user")
        self.assertNotEqual(res['entry'], None, res)
        self.assertEqual(res['entry']['url'], url2, res)
        res = self._method("skip", "test_user")
        self.assertEqual(res['entry'], None, res)

        downloader.unpause()