예제 #1
0
def test_make_and_parse_header_errors():
    addr, keydata = "[email protected]", "123"
    h = mime.make_ac_header_value(addr=addr,
                                  keydata=keydata,
                                  prefer_encrypt="nopreference",
                                  keytype="9")
    assert "prefer-encrypt" not in h, h
    d = mime.parse_ac_headervalue(h)
    assert "unknown key type" in mime.verify_ac_dict(d)[0]
    assert d == make_ac_dict(addr=addr, keydata=keydata, type="9")
예제 #2
0
 def test_unknown_type(self, datadir):
     d = datadir.parse_ac_header_from_email("unknown-type.eml")
     l = mime.verify_ac_dict(d)
     assert len(l) == 1
     assert "unknown key type '7'" in l[0]
예제 #3
0
 def test_rsa2048_unknown_critical(self, datadir):
     d = datadir.parse_ac_header_from_email("rsa2048-unknown-critical.eml")
     l = mime.verify_ac_dict(d)
     assert len(l) == 1
     assert "unknown critical attr 'danger'" in l[0]
예제 #4
0
def test_make_and_parse_header_value():
    addr, keydata = "[email protected]", "123"
    h = mime.make_ac_header_value(addr=addr, keydata=keydata)
    d = mime.parse_ac_headervalue(h)
    assert not mime.verify_ac_dict(d)
    assert d == make_ac_dict(addr=addr, keydata=keydata)