summaryrefslogtreecommitdiff
path: root/tests/test_message.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_message.py')
-rw-r--r--tests/test_message.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_message.py b/tests/test_message.py
new file mode 100644
index 0000000..025c3c4
--- /dev/null
+++ b/tests/test_message.py
@@ -0,0 +1,24 @@
+from memoryhole import message
+
+import pytest
+
+
+def test_protection_level():
+ pl0 = message.ProtectionLevel(signed_by=['alice'], encrypted_by=['alice'])
+ pl1 = message.ProtectionLevel(signed_by=['alice'])
+ pl2 = message.ProtectionLevel(encrypted_by=['alice'])
+ pl3 = message.ProtectionLevel()
+ assert pl0 > pl1
+ assert pl1 > pl2
+ assert pl2 > pl3
+ assert pl0 == pl0
+ assert pl1 == pl1
+ assert pl2 == pl2
+ assert pl2 < pl1
+ assert pl1 < pl0
+
+
+def test_compare_wrong_types():
+ pl0 = message.ProtectionLevel(signed_by=['alice'])
+ with pytest.raises(TypeError):
+ assert pl0 > 1