-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from rapid7/new_input
Update HelpInputOutputValidator to validate on new Example inputs
- Loading branch information
Showing
8 changed files
with
58 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 7 additions & 14 deletions
21
unit_test/plugin_examples/good_plugin/komand_base64/actions/encode/action.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,18 @@ | ||
import komand | ||
from .schema import EncodeInput, EncodeOutput | ||
from .schema import EncodeInput, EncodeOutput, Input, Output, Component | ||
import base64 | ||
|
||
|
||
class Encode(komand.Action): | ||
|
||
def __init__(self): | ||
super(self.__class__, self).__init__( | ||
name='encode', | ||
description='Encode data to Base64', | ||
input=EncodeInput(), | ||
output=EncodeOutput()) | ||
name='encode', | ||
description=Component.DESCRIPTION, | ||
input=EncodeInput(), | ||
output=EncodeOutput()) | ||
|
||
def run(self, params={}): | ||
string = params['content'].encode('utf-8') | ||
string = params[Input.CONTENT].encode('utf-8') | ||
result = base64.standard_b64encode(string) | ||
return { 'data': result.decode('utf-8') } | ||
|
||
def test(self): | ||
string = 'base64'.encode('utf-8') | ||
result = base64.standard_b64encode(string).decode('utf-8') | ||
if result == 'YmFzZTY0': | ||
return { 'data': result } | ||
raise Exception('Base64 encode failed: %s') % result | ||
return {Output.DATA: result.decode('utf-8')} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters