[Improvement] fix discourse loader to avoid rate limit (#953)

Co-authored-by: Deven Patel <deven298@yahoo.com>
This commit is contained in:
Deven Patel
2023-11-15 15:33:16 -08:00
committed by GitHub
parent 5201beaab0
commit c14bd7b73b
5 changed files with 25 additions and 18 deletions

View File

@@ -66,7 +66,7 @@ def test_discourse_loader_load_post_with_valid_post_id(discourse_loader, monkeyp
assert "meta_data" in post_data
def test_discourse_loader_load_post_with_invalid_post_id(discourse_loader, monkeypatch):
def test_discourse_loader_load_post_with_invalid_post_id(discourse_loader, monkeypatch, caplog):
def mock_get(*args, **kwargs):
class MockResponse:
def raise_for_status(self):
@@ -76,8 +76,9 @@ def test_discourse_loader_load_post_with_invalid_post_id(discourse_loader, monke
monkeypatch.setattr(requests, "get", mock_get)
with pytest.raises(Exception, match="Test error"):
discourse_loader._load_post(123)
discourse_loader._load_post(123)
assert "Failed to load post" in caplog.text
def test_discourse_loader_load_data_with_valid_query(discourse_loader, monkeypatch):