Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
detector_1_data = FileSystem.load(os.path.join(query_directory, file_1))
detector_1 = state_serializer.load(detector_1_data)
detector_2_data = FileSystem.load(os.path.join(query_directory, file_2))
detector_2 = state_serializer.load(detector_2_data)
assert detector_1.name == detector_2.name
assert detector_1.validation_query == detector_2.validation_query
assert detector_1.properties == detector_2.properties
assert detector_1.results == detector_2.results
shortcut_data = FileSystem.load(os.path.join(query_directory, "shortcut.json"))
shortcut = shortcut_serializer.load(shortcut_data)
assert shortcut.shortcuts['most-recent'] == file_1
shortcut_data = shortcut_serializer.dump(shortcut)
FileSystem.write(shortcut_data, os.path.join(query_directory, "shortcut.json"))
directory,
"--shortcut",
alias_2,
"--file",
alias,
])
shortcut_data = FileSystem.load(shortcut_path)
shortcut = ShortcutSchema().load(shortcut_data)
assert shortcut.shortcuts[alias] == filename
assert shortcut.shortcuts[alias_2] == filename
# Return shortcut back to its original state.
shortcut.shortcuts.pop(alias)
shortcut.shortcuts.pop(alias_2)
shortcut_data = ShortcutSchema().dump(shortcut)
FileSystem.write(shortcut_data, shortcut_path)
shortcut_path = directory + '/shortcut.json'
cli.main([
"add-shortcut",
"--query-directory",
directory,
"--shortcut",
alias,
"--file",
filename,
])
shortcut_data = FileSystem.load(shortcut_path)
shortcut = ShortcutSchema().load(shortcut_data)
assert shortcut.shortcuts[alias] == filename
shortcut.shortcuts.pop(alias)
shortcut_data = ShortcutSchema().dump(shortcut)
FileSystem.write(shortcut_data, shortcut_path)