Files
OpenBB/openbb_platform/providers/sec/tests/test_cik_map.py
Danglewood dc4b26030f [V5] openbb-sec: Refactor for V5 (#7525)
* refactor openbb-sec for v5

* linting

* ty

* normalize compare_company_facts

* add workflows

* python 3.10 fix

* add more thorough url validation and tests

* ty check

* ty for python 3.10

* reconfigure with apps

* temp pyproject overrride

* pyproject

* pyproject

* pyproject

* codespell

* pyproject

* fix uk schema file links in schema_files

* test coverage

* test_cli

* port #7547 into this pr

* no hard coded prefix

* improve filing rendering capabilities

* fix xml text detection

* make codeql happy

* missed a file in the commit

* test coverage

* codespell

* fix flakey test

* some updates

* management_ownership --> management_profiles

* proxy statement markdown

* ruff

* fix test coverage

* more tests

* test coverage

* fix lint errors

* Add SEC adviser search, profile, and universe routes (#7559)

* Add SEC institutional data fetchers

* Add SEC filing index and Form D routes

* Add SEC investment adviser people data

* Expose SEC adviser and institutional routes

* fix(sec): address adviser review feedback

* refactor(sec): narrow adviser support to IAPD search

* feat(sec): add adviser firm and individual searches

* feat(sec): add adviser profile drill-down

* fix: repair pre-commit configuration

* feat(sec): add adviser universe route

* feat(sec): expose complete Form ADV data

---------

Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>

* fix test coverage

---------

Co-authored-by: deeleeramone <>
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
2026-09-24 08:47:49 -07:00

35 lines
1.1 KiB
Python

"""Unit tests for ``openbb_sec.models.cik_map``."""
import asyncio
from unittest.mock import patch
import pytest
from openbb_core.app.model.abstract.error import OpenBBError
from openbb_sec.models.cik_map import SecCikMapFetcher, SecCikMapQueryParams
def test_cik_map_aextract_symbol_not_found():
"""cik_map.py:54 -> raise OpenBBError when symbol_map returns nothing."""
async def _empty(symbol, use_cache): # noqa: ARG001
return ""
query = SecCikMapQueryParams(symbol="DOESNOTEXIST")
with patch("openbb_sec.utils.helpers.symbol_map", _empty):
with pytest.raises(OpenBBError) as exc:
asyncio.run(SecCikMapFetcher.aextract_data(query, None))
assert "not found in SEC database" in str(exc.value)
def test_cik_map_aextract_success():
"""cik_map.py happy path returns the resolved CIK dict."""
async def _cik(symbol, use_cache): # noqa: ARG001
return "0000320193"
query = SecCikMapQueryParams(symbol="AAPL")
with patch("openbb_sec.utils.helpers.symbol_map", _cik):
result = asyncio.run(SecCikMapFetcher.aextract_data(query, None))
assert result == {"cik": "0000320193"}