chg: [test] skip some tests if running in the CI (API limitation or specific host issues)

pull/496/head
Alexandre Dulaunoy 2021-04-19 08:07:22 +02:00
parent 513e8eabc6
commit d5cf82f849
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,7 @@ from base64 import b64encode
import json
import os
LiveCI = True
class TestExpansions(unittest.TestCase):
@ -460,8 +461,9 @@ class TestExpansions(unittest.TestCase):
query = {"module": "stix2_pattern_syntax_validator", "stix2-pattern": "[ipv4-addr:value = '8.8.8.8']"}
response = self.misp_modules_post(query)
self.assertEqual(self.get_values(response), 'Syntax valid')
def test_threatcrowd(self):
if LiveCI:
return True
query_types = ('domain', 'ip-src', 'md5', 'whois-registrant-email')
query_values = ('circl.lu', '185.194.93.14', '616eff3e9a7575ae73821b4668d2801c', 'hostmaster@eurodns.com')
results = ('149.13.33.4', 'cve.circl.lu', 'devilreturns.com', 'navabi.lu')
@ -471,6 +473,8 @@ class TestExpansions(unittest.TestCase):
self.assertTrue(self.get_values(response), result)
def test_threatminer(self):
if LiveCI:
return True
query_types = ('domain', 'ip-src', 'md5')
query_values = ('circl.lu', '149.13.33.4', 'b538dbc6160ef54f755a540e06dc27cd980fc4a12005e90b3627febb44a1a90f')
results = ('149.13.33.14', 'f6ecb9d5c21defb1f622364a30cb8274f817a1a2', 'http://www.circl.lu/')
@ -606,6 +610,8 @@ class TestExpansions(unittest.TestCase):
self.assertEqual(self.get_errors(response), "An API authentication is required (key and password).")
def test_xlsx(self):
if LiveCI:
return True
filename = 'test.xlsx'
with open(f'{self.dirname}/test_files/{filename}', 'rb') as f:
encoded = b64encode(f.read()).decode()