class TestDatasourceTestingRmQueue(unittest.TestCase): def setUp(self): self.datasource = RmQueue() fixture = os.path.join(os.path.dirname(os.path.abspath(__file__)), \ 'fixtures', 'rm_queue.html') self.datasource.update(open(fixture)) def testURL(self): """ Check we have a sane URL. """ self.assert_(len(self.datasource.URL) > 5) self.assert_(self.datasource.URL.startswith('http')) def testInterval(self): """ Check we have a sane update interval. """ self.assert_(self.datasource.INTERVAL > 60) def testSize(self): self.assertEqual(self.datasource.get_size(), 10) def testTop(self): self.assert_(self.datasource.is_rm('libgocr')) def testBottom(self): self.assert_(self.datasource.is_rm('sablevm-classlib'))
class TestDatasourceTestingRmQueue(unittest.TestCase): def setUp(self): fixture = os.path.join(os.path.dirname(os.path.abspath(__file__)), "fixtures", "rm_queue.html") with io.open(fixture, encoding="utf-8") as f: data = f.read() self.mocker = requests_mock.Mocker() self.mocker.start() self.mocker.register_uri("GET", RmQueue.URL, text=data) session = requests.Session() self.datasource = RmQueue(session) def tearDown(self): self.mocker.stop() def testURL(self): """ Check we have a sane URL. """ self.assertTrue(len(self.datasource.URL) > 5) self.assertTrue(self.datasource.URL.startswith("http")) def testInterval(self): """ Check we have a sane update interval. """ self.assertTrue(self.datasource.INTERVAL > 60) def testSize(self): self.datasource.update() self.assertEqual(self.datasource.get_size(), 5) def testTop(self): self.datasource.update() self.assertTrue(self.datasource.is_rm("mtasc")) def testBottom(self): self.datasource.update() self.assertTrue(self.datasource.is_rm("rnahybrid"))
class TestDatasourceTestingRmQueue(unittest.TestCase): def setUp(self): fixture = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'fixtures', 'rm_queue.html') with io.open(fixture, encoding='utf-8') as f: data = f.read() self.mocker = requests_mock.Mocker() self.mocker.start() self.mocker.register_uri('GET', RmQueue.URL, text=data) session = requests.Session() self.datasource = RmQueue(session) def tearDown(self): self.mocker.stop() def testURL(self): """ Check we have a sane URL. """ self.assertTrue(len(self.datasource.URL) > 5) self.assertTrue(self.datasource.URL.startswith('http')) def testInterval(self): """ Check we have a sane update interval. """ self.assertTrue(self.datasource.INTERVAL > 60) def testSize(self): self.datasource.update() self.assertEqual(self.datasource.get_size(), 5) def testTop(self): self.datasource.update() self.assertTrue(self.datasource.is_rm('mtasc')) def testBottom(self): self.datasource.update() self.assertTrue(self.datasource.is_rm('rnahybrid'))