Skip to content

Commit

Permalink
Added VAR_STATE_PATH check.
Browse files Browse the repository at this point in the history
  • Loading branch information
elsif2 committed Aug 24, 2023
1 parent a045bee commit 0660a89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions intelmq/bots/parsers/shadowserver/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def enable_test_mode(enable):
else:
__config.schema_active = __config.schema_file


def enable_auto_update(enable):
""" Enable automatic schema update. """
__config.auto_update = enable
Expand Down
13 changes: 7 additions & 6 deletions intelmq/tests/bots/parsers/shadowserver/test_download_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
class TestShadowserverSchemaDownload(unittest.TestCase):

def test_download(self):
schema_file = os.path.join(VAR_STATE_PATH, 'shadowserver-schema.json')
config.set_logger(utils.log('test-bot', log_path=None))
if os.path.exists(schema_file):
os.unlink(schema_file)
self.assertEqual(True, config.update_schema())
self.assertEqual(True, os.path.exists(schema_file))
if os.path.isdir(VAR_STATE_PATH):
schema_file = os.path.join(VAR_STATE_PATH, 'shadowserver-schema.json')
config.set_logger(utils.log('test-bot', log_path=None))
if os.path.exists(schema_file):
os.unlink(schema_file)
self.assertEqual(True, config.update_schema())
self.assertEqual(True, os.path.exists(schema_file))

0 comments on commit 0660a89

Please sign in to comment.