From fa133ce12c3b263c41646fa533aea62e628ac17f Mon Sep 17 00:00:00 2001 From: Terrtia Date: Mon, 5 Aug 2019 16:31:03 +0200 Subject: [PATCH] fix: [test api] typo --- doc/README.md | 20 ++++++++++---------- tests/testApi.py | 10 +++++++--- var/www/Flask_server.py | 3 +-- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/doc/README.md b/doc/README.md index 143f782f..e553c4ba 100644 --- a/doc/README.md +++ b/doc/README.md @@ -660,7 +660,7 @@ curl https://127.0.0.1:7000/api/v1/import/item --header "Authorization: iHc1_ChZ -### GET Import item info: `api/v1/import/item/` +### GET Import item info: `api/v1/get/import/item/` #### Description @@ -751,16 +751,16 @@ curl -k https://127.0.0.1:7000/api/v1/get/import/item --header "Authorization: i ##### ``api/get/crawler/domain/`` POST ### Check if a tor/regular domain have been crawled -##### ``api/get/crawler/domain/metadata/ `` GET +##### ``api/get/crawler/domain/metadata/ `` POST ### Get domain tags -##### ``api/get/crawler/domain/tag/ `` GET +##### ``api/get/crawler/domain/tag/ `` POST ### Get domain history -##### ``api/get/crawler/domain/history/ `` GET +##### ``api/get/crawler/domain/history/ `` POST ### Get domain list of items -##### ``api/get/crawler/domain/item/ `` GET +##### ``api/get/crawler/domain/item/ `` POST ----- @@ -773,14 +773,14 @@ curl -k https://127.0.0.1:7000/api/v1/get/import/item --header "Authorization: i ##### ``api/get/decoded`` POST ### Check if a decoded item exists (via sha1) -##### ``api/get/decoded/exist/`` GET +##### ``api/get/decoded/exist/`` POST ### Get decoded item metadata ### Check if a decoded item exists (via sha1) -##### ``api/get/decoded/metadata/`` GET +##### ``api/get/decoded/metadata/`` POST ### Get decoded item correlation (1 depth) -##### ``api/get/decoded/metadata/`` GET +##### ``api/get/decoded/metadata/`` POST ----- @@ -789,10 +789,10 @@ curl -k https://127.0.0.1:7000/api/v1/get/import/item --header "Authorization: i ##### ``api/get/cryptocurrency`` POST ### Check if a cryptocurrency address (bitcoin, ..) exists -##### ``api/get/cryptocurrency/exist/`` GET +##### ``api/get/cryptocurrency/exist/`` POST ### Get cryptocurrency address metadata -##### ``api/get/cryptocurrency/metadata/`` GET +##### ``api/get/cryptocurrency/metadata/`` POST ----- diff --git a/tests/testApi.py b/tests/testApi.py index 77331769..ceac0185 100644 --- a/tests/testApi.py +++ b/tests/testApi.py @@ -23,21 +23,25 @@ def parse_response(obj, ail_response): return res_json def get_api_key(): - with open(os.path.join(os.environ['AIL_HOME'], 'DEFAULT_PASSWORD'). 'r') as f: + with open(os.path.join(os.environ['AIL_HOME'], 'DEFAULT_PASSWORD'), 'r') as f: content = f.read() - content = content.splitline() + content = content.splitlines() apikey = content[-1] apikey = apikey.replace('API_Key=', '', 1) + return apikey + +APIKEY = get_api_key() class TestApiV1(unittest.TestCase): import_uuid = None item_id = None + def setUp(self): self.app = app self.app.config['TESTING'] = True self.client = self.app.test_client() - self.apikey = get_api_key() + self.apikey = APIKEY self.item_content = "text to import" self.item_tags = ["infoleak:analyst-detection=\"private-key\""] self.expected_tags = ["infoleak:analyst-detection=\"private-key\"", 'infoleak:submission="manual"'] diff --git a/var/www/Flask_server.py b/var/www/Flask_server.py index c4d3c3c9..6361e94c 100755 --- a/var/www/Flask_server.py +++ b/var/www/Flask_server.py @@ -115,8 +115,7 @@ try: toIgnoreModule.add(line) except IOError: - f = open(os.path.join(Flask_dir, 'templates', 'ignored_modules.txt'), 'w') - f.close() + pass # Dynamically import routes and functions from modules # Also, prepare header.html