Пример #1
0
    def test_no_env(self, mock_file):
        with self.assertRaises(CensysException) as context:
            CensysAsmAPI()

        self.assertIn("No ASM API key configured.", str(context.exception))
Пример #2
0
    def test_get_exception_class(self, status_code, exception, mock):
        response = Response()
        mock.return_value = {"errorCode": status_code}

        self.assertEqual(CensysAsmAPI()._get_exception_class(response), exception)
Пример #3
0
 def setUp(self):
     super().setUp()
     self.setUpApi(CensysAsmAPI(self.api_id))
Пример #4
0
 def test_no_env(self, mock_file):
     with pytest.raises(CensysException,
                        match="No ASM API key configured."):
         CensysAsmAPI()
Пример #5
0
 def __init__(self, asset_type, api_key: Optional[str] = None, **kwargs):
     CensysAsmAPI.__init__(self, api_key, **kwargs)
     self.base_path = f"assets/{asset_type}"
Пример #6
0
 def __init__(self, api_key: Optional[str] = None, **kwargs):
     CensysAsmAPI.__init__(self, api_key, **kwargs)
     self.base_path = "seeds"