Ejemplo n.º 1
0
def get_urls():
    """Get every Craigslist url using craigslist_meta API."""
    all_urls = []
    for site in Site.all():
        if site.has_area():
            for area in site:
                all_urls.append(area.url)
        else:
            all_urls.append(site.url)

    return all_urls
Ejemplo n.º 2
0
def test_all():
    """Test `all` method yields all site instances."""
    site_instances = [site for site in Site.all()]
    assert all(isinstance(item, Site) for item in site_instances)