Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechromancer committed Sep 22, 2023
1 parent 9977ba6 commit 1b53432
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions bbot/core/event/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,18 +377,18 @@ def _data_id(self):
def _json_data_key(self):
"""
Because self.data can be either a string or a dictionary, this function is used to standardize
JSON serialized events so that their .data attributes are _always_ dictionaries.
JSON-serialized events so that their .data attributes are _always_ dictionaries.
By default, simple string-based events like `IP_ADDRESS`, `DNS_NAME`, and `URL` are serialized
with their event type in the data.
so that their event type is the sole key, and their data is the value.
For example, an `IP_ADDRESS` will turn from `"192.168.0.1"' into `{"ip_address": "192.168.0.1"}`.
A `DNS_NAME` will turn from `evilcorp.com` into `{"dns_name": "evilcorp.com"}`.
For example, an `IP_ADDRESS` with .data of `"192.168.0.1"' will be `{"IP_ADDRESS": "192.168.0.1"}`.
A `DNS_NAME` of `evilcorp.com` will be `{"DNS_NAME": "evilcorp.com"}`, etc.
Returns:
The key to be used when construction a dictionary of the event's data.
The key to be used when constructing a dictionary of the event's data.
"""
return self.type.lower()
return self.type

@property
def pretty_string(self):
Expand Down
2 changes: 1 addition & 1 deletion bbot/test/test_step_2/module_tests/test_module_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ def check(self, module_test, events):
assert lines
e = event_from_json(json.loads(lines[0]))
assert e.type == "SCAN"
assert e.data == f"{module_test.scan.name} ({module_test.scan.id})"
assert e.data == {"SCAN": f"{module_test.scan.name} ({module_test.scan.id})"}

0 comments on commit 1b53432

Please sign in to comment.