From f0dc1f6b4a57ced07dfc5d613b807e37d9ac32e7 Mon Sep 17 00:00:00 2001 From: Ajin Abraham Date: Sun, 4 Aug 2024 10:25:47 -0700 Subject: [PATCH] tests for /api/v1/scan_logs --- mobsf/StaticAnalyzer/tests.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mobsf/StaticAnalyzer/tests.py b/mobsf/StaticAnalyzer/tests.py index aeee70840a..bb7fbcf7be 100755 --- a/mobsf/StaticAnalyzer/tests.py +++ b/mobsf/StaticAnalyzer/tests.py @@ -241,6 +241,21 @@ def api_test(): logger.error('Scan List API Test with custom http header 2') return True logger.info('[OK] Scan List API tests completed') + # Scan logs tests + logger.info('Running Scan Logs API tests') + for upl in uploaded: + resp = http_client.post( + '/api/v1/scan_logs', + {'hash': upl['hash']}, + HTTP_AUTHORIZATION=auth) + if resp.status_code == 200: + logs = json.loads(resp.content.decode('utf-8')) + if 'logs' in logs and len(logs['logs']) > 0: + logger.info('[OK] Scan Logs API test: %s', upl['hash']) + else: + logger.error('Scan Logs API test: %s', upl['hash']) + return True + logger.info('[OK] Static Analysis API test completed') # PDF Tests logger.info('Running PDF Generation API Test') if platform.system() in ['Darwin', 'Linux']: