From 1bf85b44bcf97f13e2e63dfe35cc1ec2fe80c80a Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Thu, 7 Jul 2016 16:48:46 +0200 Subject: ProtectionLevel object --- tests/test_message.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/test_message.py (limited to 'tests') 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 -- cgit v1.2.3