def test_djangotrendingclient_get(): client = DjangoTrendingClient( Article.objects.in_bulk, Article.objects.all, hostname="example.com", endpoint="hello.json") articles = client.get("example") expected = [article2, article0, article1] assert articles == expected articles = client.get("example", limit=2) expected = [article2, article0] assert articles == expected articles = client.get("example", limit=200) expected = [article2, article0, article1] assert articles == expected
def test_djangotrendingclient_get(): mock_response = Response() mock_response.ok = True mock_response.content = mock_content requests.get = MagicMock(return_value=mock_response) client = DjangoTrendingClient( Article.objects.in_bulk, Article.objects.all, hostname="example.com", endpoint="hello.json") articles = client.get("example") expected = [article2, article0, article1] assert articles == expected articles = client.get("example", limit=2) expected = [article2, article0] assert articles == expected articles = client.get("example", limit=200) expected = [article2, article0, article1] assert articles == expected