test/python_tests/test_1.py
changeset 2358 a40432f11e35
parent 2357 5d93322dfd2e
child 2359 a7ff871066a7
     1.1 --- a/test/python_tests/test_1.py	Fri Jan 05 21:36:23 2018 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,100 +0,0 @@
     1.4 -# -*- coding: utf-8 -*-
     1.5 -
     1.6 -# this file is under GNU General Public License 3.0
     1.7 -# Copyleft 2017, p≡p foundation
     1.8 -
     1.9 -
    1.10 -from transport import *
    1.11 -
    1.12 -
    1.13 -def setup_gnupg():
    1.14 -    assert os.environ["GNUPGHOME"] != ""
    1.15 -
    1.16 -
    1.17 -mydir = os.path.dirname(os.path.realpath(__file__))
    1.18 -
    1.19 -
    1.20 -class Test1:
    1.21 -
    1.22 -    def setup_method(self):
    1.23 -        arthome = "test1"
    1.24 -
    1.25 -        os.environ["HOME"] = os.path.join(mydir, arthome)
    1.26 -        os.environ["GNUPGHOME"] = os.path.join(mydir, arthome, '.gnupg')
    1.27 -
    1.28 -        os.chdir(os.path.join(mydir, arthome))
    1.29 -
    1.30 -    @property
    1.31 -    def me(self):
    1.32 -        # because of flaws of py.test these two statements are necessary
    1.33 -        setup_gnupg()   # work around a bug with initializing os.environ
    1.34 -        import pEp      # after that import pEp module, not before
    1.35 -
    1.36 -        i = pEp.Identity()
    1.37 -        i.address = "test1@peptest.ch"
    1.38 -        i.username = "Alice One"
    1.39 -        pEp.myself(i)
    1.40 -        return i
    1.41 -
    1.42 -    @property
    1.43 -    def you(self):
    1.44 -        setup_gnupg() ; import pEp
    1.45 -
    1.46 -        i = pEp.Identity()
    1.47 -        i.address = "test2@peptest.ch"
    1.48 -        i.username = "Bob Two"
    1.49 -        pEp.update_identity(i)
    1.50 -        return i
    1.51 -
    1.52 -    def test_send_message(self):
    1.53 -        setup_gnupg() ; import pEp
    1.54 -
    1.55 -        msg = pEp.Message()
    1.56 -        msg.from_ = self.me
    1.57 -        msg.to = [self.you]
    1.58 -        msg.shortmsg = "Subject line"
    1.59 -        msg.longmsg = "Message Text\n"
    1.60 -
    1.61 -        enc = msg.encrypt()
    1.62 -        send_message("test2", str(enc))
    1.63 -
    1.64 -class Test2:
    1.65 -
    1.66 -    def setup_method(self):
    1.67 -        arthome = "test2"
    1.68 -
    1.69 -        os.environ["HOME"] = os.path.join(mydir, arthome)
    1.70 -        os.environ["GNUPGHOME"] = os.path.join(mydir, arthome, '.gnupg')
    1.71 -
    1.72 -        os.chdir(os.path.join(mydir, arthome))
    1.73 -
    1.74 -    @property
    1.75 -    def me(self):
    1.76 -        # because of flaws of py.test these two statements are necessary
    1.77 -        setup_gnupg()   # work around a bug with initializing os.environ
    1.78 -        import pEp      # after that import pEp module, not before
    1.79 -
    1.80 -        i = pEp.Identity()
    1.81 -        i.address = "test2@peptest.ch"
    1.82 -        i.username = "Bob Two"
    1.83 -        pEp.myself(i)
    1.84 -        return i
    1.85 -
    1.86 -    @property
    1.87 -    def you(self):
    1.88 -        setup_gnupg() ; import pEp
    1.89 -
    1.90 -        i = pEp.Identity()
    1.91 -        i.address = "test1@peptest.ch"
    1.92 -        i.username = "Alice One"
    1.93 -        pEp.update_identity(i)
    1.94 -        return i
    1.95 -
    1.96 -    def test_receive_message(self):
    1.97 -        setup_gnupg() ; import pEp
    1.98 -
    1.99 -        txt = wait_for_message()
   1.100 -        msg = pEp.Message(txt)
   1.101 -        msg.decrypt()
   1.102 -        assert msg.from_.address == self.you.address
   1.103 -