Skip to content

Commit

Permalink
e
Browse files Browse the repository at this point in the history
  • Loading branch information
exersalza committed Apr 18, 2024
1 parent 24a4158 commit a633d17
Show file tree
Hide file tree
Showing 3 changed files with 291 additions and 1 deletion.
1 change: 0 additions & 1 deletion cipherFinder/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
VALID_HOOKS = [
"Init",
"GetValidatedLines",
"GetGibberishCheckMatches",
"GetLoggingValues",
"GetFileContents",
"GetRawFileContents",
Expand Down
275 changes: 275 additions & 0 deletions cipher_finder/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions tests/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,26 @@ def execute(self, *args, **kw):
return "dummy result"
"""
)

with open(os.path.join(tmpdir, "test_plugin.py"), "w", encoding="utf-8") as f:
f.write(
"""
from cipherFinder.plugins import PluginInterface
class FetchMeTheirSouls(PluginInterface):
hook_name = "GetFileContents"
def execute(self, *args, **kw):
return "dummy result"
"""
)

# Load the plugins from the temporary directory
plugins = load_plugs(tmpdir)

# Check that the DummyPlugin was loaded and returns the expected result
assert "Init" in plugins
assert plugins["Init"].execute() == "dummy result"

# check if you can actually use "hook_name" as class name
assert "GetFileContents" in plugins
assert plugins["GetFileContents"].execute() == "dummy result"

0 comments on commit a633d17

Please sign in to comment.