Skip to content

Commit 7b270cf

Browse files
author
Dan Hertz
committed
fix file api endpoint
1 parent ea8dda3 commit 7b270cf

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

nightfall/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ def _file_scan_scan(self, session_id: str, webhook_url: str, policy_uuid: str,
204204
else:
205205
data = {"policy": {"webhookURL": webhook_url}}
206206
if detection_rule_uuids:
207-
data["detectionRuleUUIDs"] = detection_rule_uuids
207+
data["policy"]["detectionRuleUUIDs"] = detection_rule_uuids
208208
if detection_rules:
209-
data["detectionRules"] = [d.as_dict() for d in detection_rules]
209+
data["policy"]["detectionRules"] = [d.as_dict() for d in detection_rules]
210210

211211
response = requests.post(
212212
url=self.FILE_SCAN_SCAN_ENDPOINT.format(session_id),

tests/test_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ def test_scan_file_detection_rules(nightfall):
2727
with open(file, "w") as fp:
2828
fp.write("4916-6734-7572-5015 is my credit card number")
2929

30-
result = nightfall.scan_file(
30+
id, message = nightfall.scan_file(
3131
file,
3232
os.environ['WEBHOOK_ENDPOINT'],
3333
detection_rules=[DetectionRule([Detector(min_confidence="LIKELY", min_num_findings=1,
3434
display_name="Credit Card Number",
3535
nightfall_detector="CREDIT_CARD_NUMBER")])]
3636
)
3737

38-
assert all(key in result for key in ['id', 'message'])
39-
assert result['message'] == 'scan initiated'
38+
assert id is not None
39+
assert message == 'scan initiated'

0 commit comments

Comments
 (0)