Skip to content

Commit

Permalink
Create test_audit_report.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Jul 29, 2024
1 parent a278853 commit ccf4df8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions blockchain_integration/pi_network/tests/test_audit_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import unittest
from security.audits.audit_report import AuditReport

class TestAuditReport(unittest.TestCase):
def test_audit_report(self):
audit_id = 'AUDIT_ID'
timestamp = datetime.datetime.now()
event_type = 'TEST_EVENT'
event_data = {'test_data': 'Hello, World!'}
audit_report = AuditReport(audit_id, timestamp, event_type, event_data)
self.assertEqual(audit_report.audit_id, audit_id)
self.assertEqual(audit_report.timestamp, timestamp)
self.assertEqual(audit_report.event_type, event_type)
self.assertEqual(audit_report.event_data, event_data)

def test_audit_report_to_json(self):
audit_id = 'AUDIT_ID'
timestamp = datetime.datetime.now()
event_type = 'TEST_EVENT'
event_data = {'test_data': 'Hello, World!'}
audit_report = AuditReport(audit_id, timestamp, event_type, event_data)
json_report = audit_report.to_json()
self.assertEqual(json_report['audit_id'], audit_id)
self.assertEqual(json_report['timestamp'], timestamp.isoformat())
self.assertEqual(json_report['event_type'], event_type)
self.assertEqual(json_report['event_data'], event_data)

if __name__ == '__main__':
unittest.main()

0 comments on commit ccf4df8

Please sign in to comment.