from .base import ModuleTestBase


class TestEmailFormat(ModuleTestBase):
    async def setup_before_prep(self, module_test):
        module_test.httpx_mock.add_response(
            url="https://www.email-format.com/d/blacklanternsecurity.com/",
            text="""<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0a63646c654a68666b6961666b647e6f7864796f697f78637e7324696567">[email&#160;protected]</a>""",
        )

    def check(self, module_test, events):
        assert any(e.data == "info@blacklanternsecurity.com" for e in events), "Failed to detect email"
