Esempio n. 1
0
def mock_get_cik_map(monkeypatch):
    response_json = {"0": {"cik_str": "320193", "ticker": "AAPL", "title": "Apple Inc."},
                     "1": {"cik_str": "789019", "ticker": "MSFT", "title": "MICROSOFT CORP"},
                     "2": {"cik_str": "1018724", "ticker": "AMZN", "title": "AMAZON COM INC"},
                     "3": {"cik_str": "1326801", "ticker": "FB", "title": "Facebook Inc"},
                     "4": {"cik_str": "1652044", "ticker": "GOOGL", "title": "Alphabet Inc."},
                     "5": {"cik_str": "1652044", "ticker": "GOOG", "title": "Alphabet Inc."}}
    response_json = json.dumps(response_json)
    monkeypatch.setattr(requests, 'get', MockResponse(content=bytes(response_json, "utf-8")))
def mock_single_filing_page_good_response(monkeypatch):
    monkeypatch.setattr(
        requests, 'get', lambda *args, **kwargs: MockResponse(
            datapath_args=['CIK', 'single_filing_page.html']))
def mock_multiple_cik_results_good_response(monkeypatch):
    monkeypatch.setattr(
        requests, 'get', lambda *args, **kwargs: MockResponse(
            datapath_args=['CIK', 'cik_multiple_results.html']))
def mock_single_filing_type_good_response(monkeypatch):
    """Mock response with list of single filing type for single CIK."""
    monkeypatch.setattr(
        requests, 'get', lambda *args, **kwargs: MockResponse(
            datapath_args=['CIK', 'single_cik_multiple_filings_10k.html']))
def mock_no_cik_found_bad_response(monkeypatch):
    monkeypatch.setattr(
        requests, 'get', lambda *args, **kwargs: MockResponse(
            datapath_args=['CIK', 'cik_not_found.html']))
Esempio n. 6
0
def mock_single_cik_not_found(monkeypatch):
    monkeypatch.setattr(
        NetworkClient, "get_response",
        MockResponse(datapath_args=["CIK", "cik_not_found.html"]))
Esempio n. 7
0
def mock_single_cik_multiple_results_response(monkeypatch):
    monkeypatch.setattr(
        NetworkClient, "get_response",
        MockResponse(datapath_args=["CIK", "cik_multiple_results.html"]))
Esempio n. 8
0
def mock_single_cik_lookup_response(monkeypatch):
    monkeypatch.setattr(
        NetworkClient, "get_response",
        MockResponse(datapath_args=["CIK", "single_cik_search_result.html"]))
Esempio n. 9
0
 def _mock_single_cik_not_found(*args, **kwargs):
     return MockResponse(datapath_args=["CIK", "cik_not_found.html"],
                         file_read_args="rb")
Esempio n. 10
0
 def _mock_single_cik_multiple_results_response(*args, **kwargs):
     return MockResponse(datapath_args=["CIK", "cik_multiple_results.html"],
                         file_read_args="rb")
Esempio n. 11
0
 def _mock_single_cik_lookup_response(*args, **kwargs):
     return MockResponse(
         datapath_args=["CIK", "single_cik_search_result.html"],
         file_read_args="rb")