Skip to content
Permalink
Browse files

Add unit tests for summary fields

  • Loading branch information
mpurzynski committed Feb 6, 2020
1 parent 875c3c0 commit 85879dd2cfa1a5f09c9fff358dac04096a19eec1
@@ -67,7 +67,7 @@ def onMessage(self, message, metadata):
newmessage["details"][key] = mappedvalue

# This is redundant
newmessage["summary"] = "{0} called {1} on {2}".format(
newmessage["summary"] = "{0} executed {1} on {2}".format(
newmessage["details"]["username"], newmessage["details"]["action"], newmessage["details"]["resourcename"]
)

@@ -67,7 +67,7 @@ def onMessage(self, message, metadata):
newmessage["details"][key] = mappedvalue

# This is redundant
newmessage["summary"] = "{0} called {1} on {2}".format(
newmessage["summary"] = "{0} executed {1} on {2}".format(
newmessage["details"]["username"], newmessage["details"]["action"], newmessage["details"]["resourcename"],
)

@@ -31,6 +31,7 @@ pymongo==3.6.1
pynsive==0.2.6
python-dateutil==2.6.1
pytz==2017.3
PyYAML==5.1.1
requests-jwt==0.5.3
requests==2.22.0
rsa==3.1.4
@@ -321,5 +321,6 @@ def test_stackdriver_audit_activity(self):
assert result["details"]["resourcetype"] == "gce_instance"
assert result["details"]["service"] == "compute.googleapis.com"
assert result["details"]["username"] == "onceuponatime@inagalaxynottoofaraway.com"
assert result["summary"] == "onceuponatime@inagalaxynottoofaraway.com executed v1.compute.instances.reset on projects/mcd-001-252615/zones/us-west2-a/instances/mozdefdevvm1"

assert "protoPayload" not in result["details"]
@@ -241,4 +241,5 @@ def test_stackdriver(self):
assert result["utctimestamp"] == "2019-11-22T01:23:47.936931+00:00"
assert result["details"]["username"] == "luke@or.not"
assert result["details"]["service"] == "compute.googleapis.com"
assert result["summary"] == "luke@or.not executed compute.instances.reset on mozdefdevvm1"
assert "jsonPayload" not in result["details"]

0 comments on commit 85879dd

Please sign in to comment.
You can’t perform that action at this time.