Browse Source

test infrastructure

pull/4/head
heck 11 months ago
parent
commit
e6f6a1f6ab
21 changed files with 438 additions and 277 deletions
  1. +1
    -1
      pyproject.toml
  2. +29
    -49
      tests/conftest.py
  3. +1
    -17
      tests/constants.py
  4. +24
    -0
      tests/data/1A97F263D8319D6885F638C5AA81E1B5457A2B40.pub.asc
  5. +26
    -0
      tests/data/1A97F263D8319D6885F638C5AA81E1B5457A2B40.sec.asc
  6. +24
    -0
      tests/data/2D35731B9C754564CBAD15D2D18F7444594F2283.pub.asc
  7. +26
    -0
      tests/data/2D35731B9C754564CBAD15D2D18F7444594F2283.sec.asc
  8. +24
    -0
      tests/data/3E45175EE953EBBEB948F11A6A03DB2A17FB9D15.pub.asc
  9. +26
    -0
      tests/data/3E45175EE953EBBEB948F11A6A03DB2A17FB9D15.sec.asc
  10. +24
    -0
      tests/data/6A9835699EF1215F1558A496D9C1D4B0984094E5.pub.asc
  11. +26
    -0
      tests/data/6A9835699EF1215F1558A496D9C1D4B0984094E5.sec.asc
  12. +0
    -2
      tests/data/README.md
  13. +0
    -14
      tests/data/alice@openpgp.example.pub.asc
  14. +0
    -16
      tests/data/alice@openpgp.example.sec.asc
  15. +0
    -42
      tests/data/bob@openpgp.example.pub.asc
  16. +0
    -82
      tests/data/bob@openpgp.example.sec.asc
  17. +125
    -0
      tests/model.py
  18. +28
    -0
      tests/test_basic.py
  19. +32
    -41
      tests/test_identity.py
  20. +13
    -13
      tests/test_message.py
  21. +9
    -0
      tests/utils.py

+ 1
- 1
pyproject.toml View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-sv --forked"
addopts = "-rP --forked"
testpaths = [
"tests",
]


+ 29
- 49
tests/conftest.py View File

@ -1,43 +1,7 @@
# -*- coding: utf-8 -*-
"""pytest configuration for the unit tests."""
import os
import pytest
from . import constants
# Static Data
@pytest.fixture()
def datadir(request):
"""Get, read, open test files from the tests "data" directory."""
class D:
def __init__(self, basepath):
self.basepath = basepath
def open(self, name, mode="r"):
return self.basepath.join(name).open(mode)
def join(self, name):
return self.basepath.join(name).strpath
def read(self, name):
with self.open(name, "r") as f:
return f.read()
def readlines(self, name):
with self.open(name, "r") as f:
return f.readlines()
return D(request.fspath.dirpath("data"))
@pytest.fixture()
def alice_key_sec(datadir):
key_data = datadir.read('alice@openpgp.example.sec.asc')
return key_data
@pytest.fixture()
def bob_key_pub(datadir):
key_data = datadir.read('bob@openpgp.example.pub.asc')
return key_data
from .model import *
# Init
@pytest.fixture()
@ -50,32 +14,48 @@ def env_init(tmpdir_factory, request):
os.environ["PEP_HOME"] = str(bn)
os.environ["HOME"] = str(bn)
@pytest.fixture()
def pEp(env_init):
import pEp
return pEp
# Identities
@pytest.fixture()
def alice_myself(pEp, model):
alice = pEp.Identity(
model.alice.addr,
model.alice.name,
model.alice.user_id
)
pEp.myself(alice)
return alice
@pytest.fixture()
def import_ident_alice(pEp, alice_key_sec):
pEp.import_key(alice_key_sec)
def alice_imported(pEp, model):
pEp.import_key(model.alice.key_sec)
alice = pEp.Identity(
constants.ALICE_ADDRESS, constants.ALICE_NAME,
constants.ALICE_NAME_ADDR, constants.ALICE_FPR, 0, ''
model.alice.addr,
model.alice.name,
model.alice.user_id
)
return alice
@pytest.fixture()
def import_ident_alice_as_own_ident(pEp, import_ident_alice):
alice = import_ident_alice
pEp.set_own_key(alice, constants.ALICE_FPR)
def import_ident_alice_as_own_ident(pEp, model, alice_imported):
alice = alice_imported
pEp.set_own_key(alice, model.alice.fpr)
return alice
@pytest.fixture()
def import_ident_bob(pEp, bob_key_pub):
pEp.import_key(bob_key_pub)
def import_ident_bob(pEp, model):
pEp.import_key(model.bob.key_pub)
bob = pEp.Identity(
constants.BOB_ADDRESS, constants.BOB_NAME, '',
constants.BOB_FPR, 56, ''
model.bob.addr,
model.bob.name,
)
bob.update()
return bob

+ 1
- 17
tests/constants.py View File

@ -1,25 +1,9 @@
# -*- coding: utf-8 -*-
"""Constants for unit tests."""
DATADIR = "data"
# XXX: Create these first constants as part of the adapter
OUTGOING_MSG = 1
INCOMING_MSG = 2
ANGLE_ADDR = "<{}>"
NAME_ADDR = "{} {}"
ALICE_USERNAME = "Alice Lovelace"
ALICE_ADDRESS = "alice@openpgp.example"
ALICE_ID = 23
ALICE_FPR = "EB85BB5FA33A75E15E944E63F231550C4F47E38E"
ALICE_NAME_ADDR = NAME_ADDR.format(ALICE_USERNAME, ANGLE_ADDR.format(ALICE_ADDRESS))
BOB_USERNAME = "Bob Babagge"
BOB_ADDRESS = "bob@openpgp.example"
BOB_ID = 23
BOB_FPR = "D1A66E1A23B182C9980F788CFBFCC82A015E7330"
BOB_NAME_ADDR = NAME_ADDR.format(BOB_USERNAME, ANGLE_ADDR.format(BOB_ADDRESS))
SUBJECT = "This is a subject"
BODY = "Hi world!\n"

+ 24
- 0
tests/data/1A97F263D8319D6885F638C5AA81E1B5457A2B40.pub.asc View File

@ -0,0 +1,24 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: 1A97 F263 D831 9D68 85F6 38C5 AA81 E1B5 457A 2B40
Comment: bob_work@peptest.org
xjMEXyp4RRYJKwYBBAHaRw8BAQdAdA0qiUaazZJrnWAtqQ+V/XevsZkNHyspsD8M
jWv69i3ChAQfFgoAFQWCXyp4RQWJBaSPvQIVCgKbAQIeAQAhCRCqgeG1RXorQBYh
BBqX8mPYMZ1ohfY4xaqB4bVFeitA1j0BAONtcJp4KI4CTjVJps7udMFPRqAPDXU6
0YJzHWXK0mspAQCA2kZ2mJKFvMiKl3mY79N08eF2QE4zOVHYQYR+GZrtAc0UYm9i
X3dvcmtAcGVwdGVzdC5vcmfChAQTFgoAFQWCXyp4RQWJBaSPvQIVCgKbAQIeAQAh
CRCqgeG1RXorQBYhBBqX8mPYMZ1ohfY4xaqB4bVFeitA0NsA/i+jZZ8jVJVjTN9d
OPlCSg2rgMoW4CMudbvCeJ05HBGgAQDfpHv0mceDpw0Xb7JvSCZGpcnx7JvnrijO
o7s0km1fB84zBF8qeEUWCSsGAQQB2kcPAQEHQCqxykiuw5mJk7ulNeeS9ZRmNMh+
A5Za3/Mqwr8neCElwsA7BBgWCgAVBYJfKnhFBYkFpI+9AhUKApsCAh4BAJgJEKqB
4bVFeitAdqAEGRYKAAYFgl8qeEUAIQkQZIW7NIu2E2oWIQQjjCvzjFveMgb5MvZk
hbs0i7YTav2zAQCDuIDQu3vO31HUiGvSc2/ZYRKUAHJsVfnCovZSFiBaHwD+MNgr
QYydV0jkx2hyaQV7GGml132sKCVmHW6t+8+B8AYWIQQal/Jj2DGdaIX2OMWqgeG1
RXorQI6IAP0RuRRGJV8zg9ax3HSpBYsqQCTjq/Kswiskrzlda77RrwD9EnohAaPF
0yd5MrZ0H01+RJseLhF20mznjYX4ucKckQrOOARfKnhFEgorBgEEAZdVAQUBAQdA
/QOYQ28riHwdqlzL1SS89+sK52RUSGJ+z2jMEGZXrg4DAQgJwoQEGBYKABUFgl8q
eEUFiQWkj70CCwkCmwwCHgEAIQkQqoHhtUV6K0AWIQQal/Jj2DGdaIX2OMWqgeG1
RXorQAI/AQCVdZqaCPSHI8KQ75SmjCHOrizFJ5OvRQIxLcgFYnbf4QD/RK8/na7X
t3H5zFD9yjCeNtTKuBubz8wnlV48V6F8NQk=
=71Mh
-----END PGP PUBLIC KEY BLOCK-----

+ 26
- 0
tests/data/1A97F263D8319D6885F638C5AA81E1B5457A2B40.sec.asc View File

@ -0,0 +1,26 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
Comment: 1A97 F263 D831 9D68 85F6 38C5 AA81 E1B5 457A 2B40
Comment: bob_work@peptest.org
xVgEXyp4RRYJKwYBBAHaRw8BAQdAdA0qiUaazZJrnWAtqQ+V/XevsZkNHyspsD8M
jWv69i0AAP9vlqqd0FjnC219hFfUH3NWDyNkE+qLncgL8iauLJJW2xApwoQEHxYK
ABUFgl8qeEUFiQWkj70CFQoCmwECHgEAIQkQqoHhtUV6K0AWIQQal/Jj2DGdaIX2
OMWqgeG1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uBubz8wnlV48V6F8NQk=
=Yzdu
-----END PGP PRIVATE KEY BLOCK-----

+ 24
- 0
tests/data/2D35731B9C754564CBAD15D2D18F7444594F2283.pub.asc View File

@ -0,0 +1,24 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: 2D35 731B 9C75 4564 CBAD 15D2 D18F 7444 594F 2283
Comment: alice@peptest.org
xjMEXxFT2hYJKwYBBAHaRw8BAQdA/q3RICIqQ4FHd6RfqP6QY1gd2trvJn0DBg/1
jIfdpKfChAQfFgoAFQWCXxFT2gWJBaSPvQIVCgKbAQIeAQAhCRDRj3REWU8igxYh
BC01cxucdUVky60V0tGPdERZTyKDUnYBAMT6z+rJ6HvoAhE531BWhsSU9X0QKLC7
UYLQ3/ZGBVAbAQC14aJX1sODCKCPK6eivyhfd8l6W69vCBpPa55TgQ3GD80RYWxp
Y2VAcGVwdGVzdC5vcmfChAQTFgoAFQWCXxFT2gWJBaSPvQIVCgKbAQIeAQAhCRDR
j3REWU8igxYhBC01cxucdUVky60V0tGPdERZTyKDQlMBAPhingJLnqAjx+DnEWdu
nPRwnhxWSgY31GRAD8LG36zlAP94BN2pRvv6sPSCSla+yUvVcYQt927MvI1B3mOI
2jnlAM4zBF8RU9oWCSsGAQQB2kcPAQEHQCxlXfe9mHyk7Z9Cd+/12i5kYm6ljyKV
Jsst1oxMj/CnwsA7BBgWCgAVBYJfEVPaBYkFpI+9AhUKApsCAh4BAJgJENGPdERZ
TyKDdqAEGRYKAAYFgl8RU9oAIQkQYvLo9HBcHrAWIQTnCIjW7qTg/Ju3h6Ni8uj0
cFwesAy3AP4uHp91sH/DWv5Ac7jppfEXpg+CW/RoKdJ32N5S6BnWZQEAn5jtnve2
cBx2jgUQEKkGZ6AprrrdCnPgH8AOxNOWbAYWIQQtNXMbnHVFZMutFdLRj3REWU8i
g9JRAQCHR0PJVrsyy91jLA0oAYaEyf743XlrJY8yhM3H4HKKzQEAishD4vi9cpCj
tx4EXIwoqxy2wfLbwfkGulENJS38DAbOOARfEVPaEgorBgEEAZdVAQUBAQdAo7WR
Up2ZLQbkUhTB9Aqw3Z6uKGNUUiOp7GsVu3fpAScDAQgJwoQEGBYKABUFgl8RU9oF
iQWkj70CCwkCmwwCHgEAIQkQ0Y90RFlPIoMWIQQtNXMbnHVFZMutFdLRj3REWU8i
g1QJAP9l9Xyw8j22fFUa6iKzD68SP7zLb4LbGpHdKXcBd86kigD+O0zwJp7S/Ogq
LpOoJOD6xX50+0JnlPnIxZWwhgYPrAs=
=S7O4
-----END PGP PUBLIC KEY BLOCK-----

+ 26
- 0
tests/data/2D35731B9C754564CBAD15D2D18F7444594F2283.sec.asc View File

@ -0,0 +1,26 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
Comment: 2D35 731B 9C75 4564 CBAD 15D2 D18F 7444 594F 2283
Comment: alice@peptest.org
xVgEXxFT2hYJKwYBBAHaRw8BAQdA/q3RICIqQ4FHd6RfqP6QY1gd2trvJn0DBg/1
jIfdpKcAAP0W8bWDwzy2kpwqa5gx9T/DWt4kDCoa7tGzMU+dv0FBnBCMwoQEHxYK
ABUFgl8RU9oFiQWkj70CFQoCmwECHgEAIQkQ0Y90RFlPIoMWIQQtNXMbnHVFZMut
FdLRj3REWU8ig1J2AQDE+s/qyeh76AIROd9QVobElPV9ECiwu1GC0N/2RgVQGwEA
teGiV9bDgwigjyunor8oX3fJeluvbwgaT2ueU4ENxg/NEWFsaWNlQHBlcHRlc3Qu
b3JnwoQEExYKABUFgl8RU9oFiQWkj70CFQoCmwECHgEAIQkQ0Y90RFlPIoMWIQQt
NXMbnHVFZMutFdLRj3REWU8ig0JTAQD4Yp4CS56gI8fg5xFnbpz0cJ4cVkoGN9Rk
QA/Cxt+s5QD/eATdqUb7+rD0gkpWvslL1XGELfduzLyNQd5jiNo55QDHWARfEVPa
FgkrBgEEAdpHDwEBB0AsZV33vZh8pO2fQnfv9douZGJupY8ilSbLLdaMTI/wpwAA
/RU5lcZzjrlWdEh95e12IjqpCKt1VpwQhT617pSZyYpqELbCwDsEGBYKABUFgl8R
U9oFiQWkj70CFQoCmwICHgEAmAkQ0Y90RFlPIoN2oAQZFgoABgWCXxFT2gAhCRBi
8uj0cFwesBYhBOcIiNbupOD8m7eHo2Ly6PRwXB6wDLcA/i4en3Wwf8Na/kBzuOml
8RemD4Jb9Ggp0nfY3lLoGdZlAQCfmO2e97ZwHHaOBRAQqQZnoCmuut0Kc+AfwA7E
05ZsBhYhBC01cxucdUVky60V0tGPdERZTyKD0lEBAIdHQ8lWuzLL3WMsDSgBhoTJ
/vjdeWsljzKEzcfgcorNAQCKyEPi+L1ykKO3HgRcjCirHLbB8tvB+Qa6UQ0lLfwM
BsddBF8RU9oSCisGAQQBl1UBBQEBB0CjtZFSnZktBuRSFMH0CrDdnq4oY1RSI6ns
axW7d+kBJwMBCAkAAP9kY8sKTIAbQiR7PVRDPfI49ccZmoDSjNG6nPBeT7JwEA/h
woQEGBYKABUFgl8RU9oFiQWkj70CCwkCmwwCHgEAIQkQ0Y90RFlPIoMWIQQtNXMb
nHVFZMutFdLRj3REWU8ig1QJAP9l9Xyw8j22fFUa6iKzD68SP7zLb4LbGpHdKXcB
d86kigD+O0zwJp7S/OgqLpOoJOD6xX50+0JnlPnIxZWwhgYPrAs=
=uIGP
-----END PGP PRIVATE KEY BLOCK-----

+ 24
- 0
tests/data/3E45175EE953EBBEB948F11A6A03DB2A17FB9D15.pub.asc View File

@ -0,0 +1,24 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: 3E45 175E E953 EBBE B948 F11A 6A03 DB2A 17FB 9D15
Comment: alice_work@peptest.org
xjMEXxFT7BYJKwYBBAHaRw8BAQdAToI/CRX5M3LjPpSCfmJtOngHTos502W02e4e
I1CyNE/ChAQfFgoAFQWCXxFT7AWJBaSPvQIVCgKbAQIeAQAhCRBqA9sqF/udFRYh
BD5FF17pU+u+uUjxGmoD2yoX+50VV9cA/1HmBlEd6SVkhAK7dP46yGQtEJLix5x+
Z14COnk/EKETAP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QEHQLQjH5nyr42ZDtbrhsBnB/WVhsMj
KSa2aHik4K739cZ1AwEICQAA/2iRtG/26b2MEAaxszNxbwdaeE39GU5HvdLmnuVQ
kTwgENbChAQYFgoAFQWCXxFT7AWJBaSPvQILCQKbDAIeAQAhCRBqA9sqF/udFRYh
BD5FF17pU+u+uUjxGmoD2yoX+50VvKMBAOHyhqD60oJJpA1G116lL7LjKjnFuJG/
6tG4xfvFi2fPAQCxPM+NPm5OZkyuDqsmY1RkrsbPCMOer3nrCNaKWYBcCg==
=Vrqy
-----END PGP PRIVATE KEY BLOCK-----

+ 24
- 0
tests/data/6A9835699EF1215F1558A496D9C1D4B0984094E5.pub.asc View File

@ -0,0 +1,24 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: 6A98 3569 9EF1 215F 1558 A496 D9C1 D4B0 9840 94E5
Comment: bob@peptest.org
xjMEXxFT+xYJKwYBBAHaRw8BAQdAAYt8QUG+i4GQyfwaUQL+cmGKUcWHkcWX87IC
qmNpm//ChAQfFgoAFQWCXxFT+wWJBaSPvQIVCgKbAQIeAQAhCRDZwdSwmECU5RYh
BGqYNWme8SFfFVikltnB1LCYQJTlle4A/3Xl+WA2cHvE5pYsuhxZGqwABxaOmIx8
AMxj0TBpuObXAP9y/flFpkK15Et/wl/T7iwAn2HAbQWRaPMoX694iQGjB80PYm9i
QHBlcHRlc3Qub3JnwoQEExYKABUFgl8RU/sFiQWkj70CFQoCmwECHgEAIQkQ2cHU
sJhAlOUWIQRqmDVpnvEhXxVYpJbZwdSwmECU5cmFAQDNarwFonE0e3rmjt1eI6CK
e8VjWgMpOYRa05xPdONVsQD/cejxjE+vsMlw3xVprNbKeJeXN+ZPJjNI4LIcw1B/
igrOMwRfEVP7FgkrBgEEAdpHDwEBB0DdURvGONC+G8dZa0Q1vFGp5WVnrtahfJ0T
PRx5LPdvC8LAOwQYFgoAFQWCXxFT+wWJBaSPvQIVCgKbAgIeAQCYCRDZwdSwmECU
5XagBBkWCgAGBYJfEVP7ACEJENwMujbE/mf1FiEEvRHaDz+iRkPLimpN3Ay6NsT+
Z/VX8QD/eKyJ/O2yF4jaNDDjzNrEzOZg7pvqiKZolV2WMlA4msUBANdN8PkKCH5G
HPo/T3mWl+xYkOVqZuw90Ay6npS6++wJFiEEapg1aZ7xIV8VWKSW2cHUsJhAlOUQ
UwEAhWLV69mEyxA1FrixumNan7vulofahcc7ox5cfZAANbEA/jBNmTPtROEaSeuU
IPyQ0lO+DS+Gmh9FYIfa35uAaQYKzjgEXxFT+xIKKwYBBAGXVQEFAQEHQL3nDAFV
lgBfUmw5C9OEv0txcP98NUgtADUmr5p9MdswAwEICcKEBBgWCgAVBYJfEVP7BYkF
pI+9AgsJApsMAh4BACEJENnB1LCYQJTlFiEEapg1aZ7xIV8VWKSW2cHUsJhAlOWl
CQD+O3xgfil6wkuenJEEWOWRHm0ft2u50DeP3/mJiRRdefoBAOwurevk+Ky1ZGqo
gpTmsS/1vAf/fz2DLWWN61hIyOEM
=/DS+
-----END PGP PUBLIC KEY BLOCK-----

+ 26
- 0
tests/data/6A9835699EF1215F1558A496D9C1D4B0984094E5.sec.asc View File

@ -0,0 +1,26 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
Comment: 6A98 3569 9EF1 215F 1558 A496 D9C1 D4B0 9840 94E5
Comment: bob@peptest.org
xVgEXxFT+xYJKwYBBAHaRw8BAQdAAYt8QUG+i4GQyfwaUQL+cmGKUcWHkcWX87IC
qmNpm/8AAQCrGsb0A0+Vfxn13bwcs9cotQzf4f8gP4AN6oX3wiMgQxB1woQEHxYK
ABUFgl8RU/sFiQWkj70CFQoCmwECHgEAIQkQ2cHUsJhAlOUWIQRqmDVpnvEhXxVY
pJbZwdSwmECU5ZXuAP915flgNnB7xOaWLLocWRqsAAcWjpiMfADMY9Ewabjm1wD/
cv35RaZCteRLf8Jf0+4sAJ9hwG0FkWjzKF+veIkBowfND2JvYkBwZXB0ZXN0Lm9y
Z8KEBBMWCgAVBYJfEVP7BYkFpI+9AhUKApsBAh4BACEJENnB1LCYQJTlFiEEapg1
aZ7xIV8VWKSW2cHUsJhAlOXJhQEAzWq8BaJxNHt65o7dXiOginvFY1oDKTmEWtOc
T3TjVbEA/3Ho8YxPr7DJcN8VaazWyniXlzfmTyYzSOCyHMNQf4oKx1gEXxFT+xYJ
KwYBBAHaRw8BAQdA3VEbxjjQvhvHWWtENbxRqeVlZ67WoXydEz0ceSz3bwsAAPsF
YmCVyg8ega1rLrOGVRhphlUGpGwiAvUd8C56L/ZGlg3kwsA7BBgWCgAVBYJfEVP7
BYkFpI+9AhUKApsCAh4BAJgJENnB1LCYQJTldqAEGRYKAAYFgl8RU/sAIQkQ3Ay6
NsT+Z/UWIQS9EdoPP6JGQ8uKak3cDLo2xP5n9VfxAP94rIn87bIXiNo0MOPM2sTM
5mDum+qIpmiVXZYyUDiaxQEA103w+QoIfkYc+j9PeZaX7FiQ5Wpm7D3QDLqelLr7
7AkWIQRqmDVpnvEhXxVYpJbZwdSwmECU5RBTAQCFYtXr2YTLEDUWuLG6Y1qfu+6W
h9qFxzujHlx9kAA1sQD+ME2ZM+1E4RpJ65Qg/JDSU74NL4aaH0Vgh9rfm4BpBgrH
XQRfEVP7EgorBgEEAZdVAQUBAQdAvecMAVWWAF9SbDkL04S/S3Fw/3w1SC0ANSav
mn0x2zADAQgJAAD/cLLc4Gss5eq6v0PO/sCLyyA69hsz5FAyDFX7F3nMBygRzMKE
BBgWCgAVBYJfEVP7BYkFpI+9AgsJApsMAh4BACEJENnB1LCYQJTlFiEEapg1aZ7x
IV8VWKSW2cHUsJhAlOWlCQD+O3xgfil6wkuenJEEWOWRHm0ft2u50DeP3/mJiRRd
efoBAOwurevk+Ky1ZGqogpTmsS/1vAf/fz2DLWWN61hIyOEM
=4nOw
-----END PGP PRIVATE KEY BLOCK-----

+ 0
- 2
tests/data/README.md View File

@ -1,2 +0,0 @@
The data in this directory comes from:
https://datatracker.ietf.org/doc/draft-bre-openpgp-samples/

+ 0
- 14
tests/data/alice@openpgp.example.pub.asc View File

@ -1,14 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: Alice's OpenPGP certificate
mDMEXEcE6RYJKwYBBAHaRw8BAQdArjWwk3FAqyiFbFBKT4TzXcVBqPTB3gmzlC/U
b7O1u120JkFsaWNlIExvdmVsYWNlIDxhbGljZUBvcGVucGdwLmV4YW1wbGU+iJAE
ExYIADgCGwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AWIQTrhbtfozp14V6UTmPy
MVUMT0fjjgUCXaWfOgAKCRDyMVUMT0fjjukrAPoDnHBSogOmsHOsd9qGsiZpgRnO
dypvbm+QtXZqth9rvwD9HcDC0tC+PHAsO7OTh1S1TC9RiJsvawAfCPaQZoed8gK4
OARcRwTpEgorBgEEAZdVAQUBAQdAQv8GIa2rSTzgqbXCpDDYMiKRVitCsy203x3s
E9+eviIDAQgHiHgEGBYIACAWIQTrhbtfozp14V6UTmPyMVUMT0fjjgUCXEcE6QIb
DAAKCRDyMVUMT0fjjlnQAQDFHUs6TIcxrNTtEZFjUFm1M0PJ1Dng/cDW4xN80fsn
0QEA22Kr7VkCjeAEC08VSTeV+QFsmz55/lntWkwYWhmvOgE=
=iIGO
-----END PGP PUBLIC KEY BLOCK-----

+ 0
- 16
tests/data/alice@openpgp.example.sec.asc View File

@ -1,16 +0,0 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
Comment: Alice's OpenPGP Transferable Secret Key
lFgEXEcE6RYJKwYBBAHaRw8BAQdArjWwk3FAqyiFbFBKT4TzXcVBqPTB3gmzlC/U
b7O1u10AAP9XBeW6lzGOLx7zHH9AsUDUTb2pggYGMzd0P3ulJ2AfvQ4RtCZBbGlj
ZSBMb3ZlbGFjZSA8YWxpY2VAb3BlbnBncC5leGFtcGxlPoiQBBMWCAA4AhsDBQsJ
CAcCBhUKCQgLAgQWAgMBAh4BAheAFiEE64W7X6M6deFelE5j8jFVDE9H444FAl2l
nzoACgkQ8jFVDE9H447pKwD6A5xwUqIDprBzrHfahrImaYEZzncqb25vkLV2arYf
a78A/R3AwtLQvjxwLDuzk4dUtUwvUYibL2sAHwj2kGaHnfICnF0EXEcE6RIKKwYB
BAGXVQEFAQEHQEL/BiGtq0k84Km1wqQw2DIikVYrQrMttN8d7BPfnr4iAwEIBwAA
/3/xFPG6U17rhTuq+07gmEvaFYKfxRB6sgAYiW6TMTpQEK6IeAQYFggAIBYhBOuF
u1+jOnXhXpROY/IxVQxPR+OOBQJcRwTpAhsMAAoJEPIxVQxPR+OOWdABAMUdSzpM
hzGs1O0RkWNQWbUzQ8nUOeD9wNbjE3zR+yfRAQDbYqvtWQKN4AQLTxVJN5X5AWyb
Pnn+We1aTBhaGa86AQ==
=n8OM
-----END PGP PRIVATE KEY BLOCK-----

+ 0
- 42
tests/data/bob@openpgp.example.pub.asc View File

@ -1,42 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: Bob's OpenPGP certificate
mQGNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv
/seOXpgecTdOcVttfzC8ycIKrt3aQTiwOG/ctaR4Bk/t6ayNFfdUNxHWk4WCKzdz
/56fW2O0F23qIRd8UUJp5IIlN4RDdRCtdhVQIAuzvp2oVy/LaS2kxQoKvph/5pQ/
5whqsyroEWDJoSV0yOb25B/iwk/pLUFoyhDG9bj0kIzDxrEqW+7Ba8nocQlecMF3
X5KMN5kp2zraLv9dlBBpWW43XktjcCZgMy20SouraVma8Je/ECwUWYUiAZxLIlMv
9CurEOtxUw6N3RdOtLmYZS9uEnn5y1UkF88o8Nku890uk6BrewFzJyLAx5wRZ4F0
qV/yq36UWQ0JB/AUGhHVPdFf6pl6eaxBwT5GXvbBUibtf8YI2og5RsgTWtXfU7eb
SGXrl5ZMpbA6mbfhd0R8aPxWfmDWiIOhBufhMCvUHh1sApMKVZnvIff9/0Dca3wb
vLIwa3T4CyshfT0AEQEAAbQhQm9iIEJhYmJhZ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UnkCaEkOtl1mr2JpQi5nTU+gTX4IeInC7E+1a9UDF/Y85ybUz8XV8rUnR76U
qVC7KidNepdHbZjjXCt8/Zo+Tec9JNbYNQB/e9ExmDntmlHEsSEQzFwzj8sxH48A
EQEAAYkBtgQYAQoAIBYhBNGmbhojsYLJmA94jPv8yCoBXnMwBQJdpZzyAhsMAAoJ
EPv8yCoBXnMw6f8L/26C34dkjBffTzMj5Bdzm8MtF67OYneJ4TQMw7+41IL4rVcS
KhIhk/3Ud5knaRtP2ef1+5F66h9/RPQOJ5+tvBwhBAcUWSupKnUrdVaZQanYmtSx
cVV2PL9+QEiNN3tzluhaWO//rACxJ+K/ZXQlIzwQVTpNhfGzAaMVV9zpf3u0k14i
tcv6alKY8+rLZvO1wIIeRZLmU0tZDD5HtWDvUV7rIFI1WuoLb+KZgbYn3OWjCPHV
dTrdZ2CqnZbG3SXw6awH9bzRLV9EXkbhIMez0deCVdeo+wFFklh8/5VK2b0vk/+w
qMJxfpa1lHvJLobzOP9fvrswsr92MA2+k901WeISR7qEzcI0Fdg8AyFAExaEK6Vy
jP7SXGLwvfisw34OxuZr3qmx1Sufu4toH3XrB7QJN8XyqqbsGxUCBqWif9RSK4xj
zRTe56iPeiSJJOIciMP9i2ldI+KgLycyeDvGoBj0HCLO3gVaBe4ubVrj5KjhX2PV
NEJd3XZRzaXZE2aAMQ==
=NXei
-----END PGP PUBLIC KEY BLOCK-----

+ 0
- 82
tests/data/bob@openpgp.example.sec.asc View File

@ -1,82 +0,0 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
Comment: Bob's OpenPGP Transferable Secret Key
lQVYBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv
/seOXpgecTdOcVttfzC8ycIKrt3aQTiwOG/ctaR4Bk/t6ayNFfdUNxHWk4WCKzdz
/56fW2O0F23qIRd8UUJp5IIlN4RDdRCtdhVQIAuzvp2oVy/LaS2kxQoKvph/5pQ/
5whqsy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uzmJ3ieE0DMO/uNSC+K1XEioSIZP91HeZJ2kbT9nn9fuReuoff0T0Dief
rbwcIQQHFFkrqSp1K3VWmUGp2JrUsXFVdjy/fkBIjTd7c5boWljv/6wAsSfiv2V0
JSM8EFU6TYXxswGjFVfc6X97tJNeIrXL+mpSmPPqy2bztcCCHkWS5lNLWQw+R7Vg
71Fe6yBSNVrqC2/imYG2J9zlowjx1XU63Wdgqp2Wxt0l8OmsB/W80S1fRF5G4SDH
s9HXglXXqPsBRZJYfP+VStm9L5P/sKjCcX6WtZR7yS6G8zj/X767MLK/djANvpPd
NVniEke6hM3CNBXYPAMhQBMWhCulcoz+0lxi8L34rMN+Dsbma96psdUrn7uLaB91
6we0CTfF8qqm7BsVAgalon/UUiuMY80U3ueoj3okiSTiHIjD/YtpXSPioC8nMng7
xqAY9Bwizt4FWgXuLm1a4+So4V9j1TRCXd12Uc2l2RNmgDE=
=miES
-----END PGP PRIVATE KEY BLOCK-----

+ 125
- 0
tests/model.py View File

@ -0,0 +1,125 @@
from . import utils
import pytest
@pytest.fixture()
def model():
"Returns the whole data model"
return Model()
identities = \
{
"alice": {
"name": "alice",
"user_id": "23",
"accounts":
{
"work": {
"addr": "alice_work@peptest.org",
"fpr": "3E45175EE953EBBEB948F11A6A03DB2A17FB9D15"
},
"home": {
"addr": "alice@peptest.org",
"fpr": "2D35731B9C754564CBAD15D2D18F7444594F2283"
}
}
},
"bob": {
"name": "bob",
"user_id": "uuid:1-2-3-4",
"accounts": \
{
"work": {
"addr": "bob_work@peptest.org",
"fpr": "1A97F263D8319D6885F638C5AA81E1B5457A2B40"
},
"home": {
"addr": "bob@peptest.org",
"fpr": "6A9835699EF1215F1558A496D9C1D4B0984094E5"
}
}
}
}
# An Identity class that is read-only (const)
class Identity:
__name = ""
__user_id = ""
__addr = ""
__fpr = ""
__key_sec = ""
__key_pub = ""
def __init__(self, name="", user_id="", addr="", fpr="", key_sec="", key_pub=""):
self.__name = name
self.__user_id = user_id
self.__addr = addr
self.__fpr = fpr
self.__key_sec = key_sec
self.__key_pub = key_pub
def get_name(self):
return self.__name
def get_user_id(self):
return self.__user_id
def get_addr(self):
return self.__addr
def get_fpr(self):
return self.__fpr
def get_key_sec(self):
return self.__key_sec
def get_key_pub(self):
return self.__key_pub
name = property(get_name)
user_id = property(get_user_id)
addr = property(get_addr)
fpr = property(get_fpr)
key_sec = property(get_key_sec)
key_pub = property(get_key_pub)
def debug(self) -> str:
ret = "name:" + self.__name
ret +="user_id:" + self.__user_id
ret +="addr:" + self.__addr
ret +="fpr:" + self.__fpr
ret +="key_sec:" + self.__key_sec[0:255]
ret +="key_pub:" + self.__key_pub[0:255]
return ret
def __str__(self):
return "{} {}".format(self.name, "<{}>".format(self.addr))
# The Data Model
class Model:
alice = None
alice_work = None
bob = None
bob_work = None
def getIdentity(self, name, account) -> Identity:
# fetch keys for ident from data folder
key_sec = utils.data_file_contents(identities[name]['accounts'][account]['fpr'] + ".sec.asc")
key_pub = utils.data_file_contents(identities[name]['accounts'][account]['fpr'] + ".pub.asc")
ident = Identity(name=identities[name]['name'],
user_id=identities[name]['user_id'],
addr=identities[name]['accounts'][account]['addr'],
fpr=identities[name]['accounts'][account]['fpr'],
key_pub=key_pub,
key_sec=key_sec
)
return ident
def __init__(self):
self.alice = self.getIdentity("alice", "home")
self.alice_work = self.getIdentity("alice", "work")
self.bob = self.getIdentity("bob", "home")
self.bob_work = self.getIdentity("bob", "work")

+ 28
- 0
tests/test_basic.py View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# from . import constants
import pytest
# @pytest.mark.skip()
# def test_basic():
# 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()
# assert(rating == pEp.rating.reliable)

+ 32
- 41
tests/test_identity.py View File

@ -1,68 +1,58 @@
# -*- coding: utf-8 -*-
"""Identity unit tests."""
import os
import pytest
from . import constants
from . import model
def test_create_one_identity_succeed(pEp):
# It has to be imported here to get the management db initialized,
alice = pEp.Identity()
alice.address = constants.ALICE_ADDRESS
alice.username = constants.ALICE_NAME
alice.fpr = constants.ALICE_FPR
# TODO: test_get_identity_by_{name,addr,etc..}
# def test_create_ident_myself(pEp, alice_myself):
# def test_create_ident_import(pEp, alice_myself):
# def test_create_ident_nokey(pEp, alice_myself):
expected_alice = pEp.Identity(
constants.ALICE_ADDRESS, constants.ALICE_NAME, '',
constants.ALICE_FPR, 0, ''
def test_identity_constructor(pEp, model):
alice = pEp.Identity(
model.alice.addr,
model.alice.name,
model.alice.user_id
)
# XXX: Can't compare objects
# assert alice == expected_alice
assert str(alice) == constants.ALICE_NAME_ADDR
assert alice.address == expected_alice.address
assert alice.username == expected_alice.username
# Cause the key is created by pEp
assert alice.fpr == expected_alice.fpr
assert alice.user_id == expected_alice.user_id
assert alice.comm_type == expected_alice.comm_type
assert alice.flags == expected_alice.flags
assert alice.address == model.alice.addr
assert alice.username == model.alice.name
assert alice.user_id == model.alice.user_id
assert str(alice) == str(model.alice)
# Test that data after updating.
# If the db has not been initialized this would return PEP_GET_KEY_FAILED
alice.update()
assert str(alice) == constants.ALICE_NAME_ADDR
assert alice.address == expected_alice.address
assert alice.username == expected_alice.username
# XXX: shouldn't this be he fpr of the key generated by pEp?
assert alice.fpr == ''
# After updating this changed
assert alice.user_id == "TOFU_alice@openpgp.example"
# After updating this changed
assert alice.comm_type == 3
assert alice.flags == expected_alice.flags
# TODO:
# These here are actually plenty of individual tests
# Identity.update
# key_import
# set_own_key
def test_two_identities_succeed(pEp, bob_key_pub):
@pytest.mark.skip(reason="needs to be decomposed and migrated to new data model")
def test_two_identities_succeed(pEp, model):
alice = pEp.Identity(
constants.ALICE_ADDRESS, constants.ALICE_NAME, '',
constants.ALICE_ADDRESS, constants.ALICE_USERNAME, '',
constants.ALICE_FPR, 0, ''
)
assert alice.address == constants.ALICE_ADDRESS
assert alice.username == constants.ALICE_NAME
assert alice.username == constants.ALICE_USERNAME
assert alice.fpr == constants.ALICE_FPR
assert alice.user_id == ""
assert alice.comm_type == 0
assert alice.flags == 0
pEp.import_key(bob_key_pub)
pEp.import_key(model.bob.key_pub)
bob = pEp.Identity()
bob.address = constants.BOB_ADDRESS
bob.username = constants.BOB_NAME
bob.username = constants.BOB_USERNAME
bob.fpr = constants.BOB_FPR
expected_bob = pEp.Identity(
constants.BOB_ADDRESS, constants.BOB_NAME, '',
constants.BOB_ADDRESS, constants.BOB_USERNAME, '',
constants.BOB_FPR, 56, ''
)
@ -85,16 +75,17 @@ def test_two_identities_succeed(pEp, bob_key_pub):
assert bob.flags == 0
@pytest.mark.skip(reason="needs to be decomposed and migrated to new data model")
def test_set_own_key(pEp, alice_key_sec):
pEp.import_key(alice_key_sec)
alice = pEp.Identity()
alice.address = constants.ALICE_ADDRESS
alice.username = constants.ALICE_NAME
alice.username = constants.ALICE_USERNAME
alice.fpr = constants.ALICE_FPR
alice.user_id = constants.ALICE_NAME_ADDR
expected_alice = pEp.Identity(
constants.ALICE_ADDRESS, constants.ALICE_NAME, '',
constants.ALICE_ADDRESS, constants.ALICE_USERNAME, '',
constants.ALICE_FPR, 0, ''
)


+ 13
- 13
tests/test_message.py View File

@ -4,7 +4,7 @@
from . import constants
def test_msg_enc_dec_roundtrip(pEp, import_ident_alice_as_own_ident, import_ident_bob):
def test_msg_enc_dec_roundtrip(pEp, model, import_ident_alice_as_own_ident, import_ident_bob):
alice = import_ident_alice_as_own_ident
bob = import_ident_bob
@ -26,8 +26,8 @@ def test_msg_enc_dec_roundtrip(pEp, import_ident_alice_as_own_ident, import_iden
enc_msg = msg.encrypt()
assert enc_msg.enc_format == 3
assert str(enc_msg.from_) == constants.ALICE_NAME_ADDR
assert str(enc_msg.to[0]) == constants.BOB_NAME_ADDR
assert str(enc_msg.from_) == str(model.alice)
assert str(enc_msg.to[0]) == str(model.bob)
assert enc_msg.shortmsg == "p≡p"
assert enc_msg.longmsg == "this message was encrypted with p≡p https://pEp-project.org"
@ -41,8 +41,8 @@ def test_msg_enc_dec_roundtrip(pEp, import_ident_alice_as_own_ident, import_iden
assert rating == pEp._pEp.rating.reliable
# The first 2 keys are Alice's ones, the last is Bob's one.
assert key_list[0] == key_list[1] == constants.ALICE_FPR
assert key_list[-1] == constants.BOB_FPR
assert key_list[0] == key_list[1] == model.alice.fpr
assert key_list[-1] == model.bob.fpr
assert dec_msg.shortmsg == constants.SUBJECT
assert dec_msg.longmsg.replace("\r", "") == msg.longmsg
dec_lines = str(dec_msg).replace("\r", "").split("\n")
@ -53,13 +53,13 @@ def test_msg_enc_dec_roundtrip(pEp, import_ident_alice_as_own_ident, import_iden
# Content-Disposition: is not present anymore.
# `!` is not replaced by `=21` anymore.
expected_dec_lines = \
"""From: Alice Lovelace <alice@openpgp.example>
To: Bob Babagge <bob@openpgp.example>
"""From: alice <alice@peptest.org>
To: bob <bob@peptest.org>
Subject: This is a subject
X-pEp-Version: 2.1
X-EncStatus: reliable
X-KeyList:
X,X,D1A66E1A23B182C9980F788CFBFCC82A015E7330
X,X,6A9835699EF1215F1558A496D9C1D4B0984094E5
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
@ -125,13 +125,13 @@ def test_dec_msg_len(pEp, import_ident_alice_as_own_ident, import_ident_bob):
assert dec_msg.longmsg.replace("\r", "") == constants.BODY # msg.longmsg
expected_dec_msg = \
"""From: Alice Lovelace <alice@openpgp.example>\r
To: Bob Babagge <bob@openpgp.example>\r
"""From: alice <alice@peptest.org>\r
To: bob <bob@peptest.org>\r
Subject: This is a subject\r
X-pEp-Version: 2.1\r
X-EncStatus: reliable\r
X-KeyList: \r
EB85BB5FA33A75E15E944E63F231550C4F47E38E,EB85BB5FA33A75E15E944E63F231550C4F47E38E,D1A66E1A23B182C9980F788CFBFCC82A015E7330\r
2D35731B9C754564CBAD15D2D18F7444594F2283,2D35731B9C754564CBAD15D2D18F7444594F2283,6A9835699EF1215F1558A496D9C1D4B0984094E5\r
MIME-Version: 1.0\r
Content-Type: text/plain\r
Content-Transfer-Encoding: 7bit\r
@ -148,9 +148,9 @@ Hi world!\r
print("len_extra_headers", len_extra_headers)
assert dec_msg_len - len_extra_headers == msg_len
#@pytest.mark.skip(reason="PYADAPT-91")
def test_null_char_rmed(pEp, import_ident_alice_as_own_ident, import_ident_bob):
"""Test that null characters and anything after them is removed."""
"""Test that null characters and anything after them are not removed."""
alice = import_ident_alice_as_own_ident
bob = import_ident_bob


+ 9
- 0
tests/utils.py View File

@ -0,0 +1,9 @@
from . import constants
import pathlib
def data_file_contents(name) -> str:
"""grab the contents of a file in the data folder"""
path = pathlib.Path(__file__).parent / constants.DATADIR / name
with path.open(mode='r') as fid:
return fid.read()

Loading…
Cancel
Save