summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-07-07 16:48:46 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2016-07-07 16:48:46 +0200
commit1bf85b44bcf97f13e2e63dfe35cc1ec2fe80c80a (patch)
tree05f05de41276fe120dc71c9a0ebbc1ecf48cd4a5 /tests
parent65814f87d5fff167528455e29edc8bf99c2e3575 (diff)
ProtectionLevel object
Diffstat (limited to 'tests')
-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