
2 changed files with 49 additions and 78 deletions
@ -1,54 +0,0 @@ |
|||||
#!/usr/bin/env python3 |
|
||||
# -*- coding: utf-8 -*- |
|
||||
|
|
||||
from . import constants |
|
||||
import pytest |
|
||||
|
|
||||
# """ |
|
||||
# >>> import pEp |
|
||||
# >>> me = pEp.Identity("alice.smith@peptest.ch", "Alice Smith", "23") |
|
||||
# >>> me.username |
|
||||
# 'Alice Smith' |
|
||||
# >>> print(me) |
|
||||
# Alice Smith <alice.smith@peptest.ch> |
|
||||
# >>> you = pEp.Identity("bob.bourne@peptest.ch", "Bob Bourne", "42") |
|
||||
# >>> print(you) |
|
||||
# Bob Bourne <bob.bourne@peptest.ch> |
|
||||
# >>> m = pEp.outgoing_message(me) |
|
||||
# >>> m.to = [you] |
|
||||
# >>> m.shortmsg = "let's meet next week" |
|
||||
# >>> m.longmsg = "Please call me back" |
|
||||
# >>> m2 = m.encrypt() |
|
||||
# >>> print(m2) |
|
||||
# >>> m3, keys, rating, flags = m2.decrypt() |
|
||||
# >>> rating |
|
||||
# pEp.rating.reliable |
|
||||
# """ |
|
||||
# |
|
||||
# if __name__ == "__main__": |
|
||||
# import doctest |
|
||||
# doctest.testmod() |
|
||||
|
|
||||
def test_basic(pEp, model): |
|
||||
me = pEp.Identity( |
|
||||
model.alice.addr, |
|
||||
model.alice.name, |
|
||||
model.alice.user_id |
|
||||
) |
|
||||
assert me.username == model.alice.name |
|
||||
assert str(me) == str(model.alice) |
|
||||
you = pEp.Identity( |
|
||||
model.bob.addr, |
|
||||
model.bob.name, |
|
||||
model.bob.user_id |
|
||||
) |
|
||||
assert str(you) == str(model.bob) |
|
||||
#TODO: pEp.outgoing_message() needs to return type pEp.Message not None |
|
||||
m = pEp.outgoing_message(me) |
|
||||
m.to = [you] |
|
||||
m.shortmsg = constants.SUBJECT |
|
||||
m.longmsg = constants.BODY |
|
||||
#TODO: encrypt needs to return message type |
|
||||
m2 = m.encrypt() |
|
||||
m3, keys, rating, flags = m2.decrypt() |
|
||||
assert rating == pEp._pEp.rating.reliable |
|
@ -1,29 +1,54 @@ |
|||||
|
#!/usr/bin/env python3 |
||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
# This file is under GNU Affero General Public License 3.0 |
|
||||
# see LICENSE.txt |
|
||||
|
|
||||
# from . import constants |
from . import constants |
||||
import pytest |
import pytest |
||||
|
|
||||
|
# """ |
||||
|
# >>> import pEp |
||||
|
# >>> me = pEp.Identity("alice.smith@peptest.ch", "Alice Smith", "23") |
||||
|
# >>> me.username |
||||
|
# 'Alice Smith' |
||||
|
# >>> print(me) |
||||
|
# Alice Smith <alice.smith@peptest.ch> |
||||
|
# >>> you = pEp.Identity("bob.bourne@peptest.ch", "Bob Bourne", "42") |
||||
|
# >>> print(you) |
||||
|
# Bob Bourne <bob.bourne@peptest.ch> |
||||
|
# >>> m = pEp.outgoing_message(me) |
||||
|
# >>> m.to = [you] |
||||
|
# >>> m.shortmsg = "let's meet next week" |
||||
|
# >>> m.longmsg = "Please call me back" |
||||
|
# >>> m2 = m.encrypt() |
||||
|
# >>> print(m2) |
||||
|
# >>> m3, keys, rating, flags = m2.decrypt() |
||||
|
# >>> rating |
||||
|
# pEp.rating.reliable |
||||
|
# """ |
||||
|
# |
||||
|
# if __name__ == "__main__": |
||||
|
# import doctest |
||||
|
# doctest.testmod() |
||||
|
|
||||
# @pytest.mark.skip() |
def test_basic(pEp, model): |
||||
# def test_basic(): |
me = pEp.Identity( |
||||
# import pEp |
model.alice.addr, |
||||
# me = pEp.Identity("alice.smith@peptest.ch", "Alice Smith", "23") |
model.alice.name, |
||||
# me.username |
model.alice.user_id |
||||
# 'Alice Smith' |
) |
||||
# print(me) |
assert me.username == model.alice.name |
||||
# Alice Smith <alice.smith@peptest.ch> |
assert str(me) == str(model.alice) |
||||
# you = pEp.Identity("bob.bourne@peptest.ch", "Bob Bourne", "42") |
you = pEp.Identity( |
||||
# print(you) |
model.bob.addr, |
||||
# Bob Bourne <bob.bourne@peptest.ch> |
model.bob.name, |
||||
# m = pEp.outgoing_message(me) |
model.bob.user_id |
||||
# m.to = [you] |
) |
||||
# m.shortmsg = "let's meet next week" |
assert str(you) == str(model.bob) |
||||
# m.longmsg = "Please call me back" |
#TODO: pEp.outgoing_message() needs to return type pEp.Message not None |
||||
# m2 = m.encrypt() |
m = pEp.outgoing_message(me) |
||||
# print(m2) |
m.to = [you] |
||||
# m3, keys, rating, flags = m2.decrypt() |
m.shortmsg = constants.SUBJECT |
||||
# assert(rating == pEp.rating.reliable) |
m.longmsg = constants.BODY |
||||
|
#TODO: encrypt needs to return message type |
||||
|
m2 = m.encrypt() |
||||
|
m3, keys, rating, flags = m2.decrypt() |
||||
|
assert rating == pEp._pEp.rating.reliable |
||||
|
Loading…
Reference in new issue