import inspect
from juris_base.tiers.tier5_daemon_auth import BaseAuthBrowserDaemon


def test_abstract_methods_include_login():
    abstract = {
        name for name, method in inspect.getmembers(BaseAuthBrowserDaemon)
        if getattr(method, "__isabstractmethod__", False)
    }
    assert "_do_login" in abstract
    assert "_is_logged_in" in abstract
    assert "_do_search" in abstract
    assert "_do_get" in abstract


def test_capsolver_config_defaults():
    class ConcreteDaemon(BaseAuthBrowserDaemon):
        KEEPALIVE_URL = "https://example.gov.ar"
        LOGIN_URL = "https://example.gov.ar/login"
        PORT = 19998
        async def _do_login(self, page): return True
        async def _is_logged_in(self, page): return True
        async def _do_search(self, page, params): return {}
        async def _do_get(self, page, id): return {}

    d = ConcreteDaemon()
    assert d.CAPSOLVER_API_KEY == ""  # empty by default, loaded from env
