示例#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"