Пример #1
0
    def test_get_page(self):

        path = tempfile.mkdtemp()
        try:
            html1 = milk.get_page(1, path)
            self.assertIn("zebraPhone", html1)
            self.assertTrue(os.path.exists(os.path.join(path, "page_1.html")))

            # Get from cache, result must be identical.
            html2 = milk.get_page(1, path)
            self.assertEquals(html1, html2)
        finally:        
            shutil.rmtree(path)
Пример #2
0
    def test_get_page(self):

        path = tempfile.mkdtemp()
        try:
            html1 = milk.get_page(1, path)
            self.assertIn("zebraPhone", html1)
            self.assertTrue(os.path.exists(os.path.join(path, "page_1.html")))

            # Get from cache, result must be identical.
            html2 = milk.get_page(1, path)
            self.assertEquals(html1, html2)
        finally:
            shutil.rmtree(path)
Пример #3
0
    def test_get_stations_table(self):

        html = milk.get_page(1, self.CACHE_DIR)
        table = milk.extract_stations_table(html)

        self.assertEquals(table.tag, "table")
        self.assertEquals(table.get('class'), "cqwpGridViewTable " \
                         "cqwpGridViewTableFullVaccines PaymentsGridViewGroup")
Пример #4
0
    def test_get_stations_table(self):

        html = milk.get_page(1, self.CACHE_DIR)
        table = milk.extract_stations_table(html)

        self.assertEquals(table.tag, "table")
        self.assertEquals(table.get('class'), "cqwpGridViewTable " \
                         "cqwpGridViewTableFullVaccines PaymentsGridViewGroup")
Пример #5
0
    def test_get_stations_rows(self):

        html = milk.get_page(1, self.CACHE_DIR)
        table = milk.extract_stations_table(html)
        rows = milk.extract_station_rows(table)

        self.assertEquals(15, len(rows))
        for row in rows:
            self.assertEquals(2, len(row))
Пример #6
0
    def test_get_stations_rows(self):

        html = milk.get_page(1, self.CACHE_DIR)
        table = milk.extract_stations_table(html)
        rows = milk.extract_station_rows(table)

        self.assertEquals(15, len(rows))
        for row in rows:
            self.assertEquals(2, len(row))
Пример #7
0
 def get_a_station(self, page=1, index=9):
     html = milk.get_page(page, self.CACHE_DIR)
     table = milk.extract_stations_table(html)
     rows = milk.extract_station_rows(table)
     station = milk.extract_station_from_row(rows[index])
     return station
Пример #8
0
 def get_a_station(self, page=1, index=9):
     html = milk.get_page(page, self.CACHE_DIR)
     table = milk.extract_stations_table(html)
     rows = milk.extract_station_rows(table)
     station = milk.extract_station_from_row(rows[index])
     return station