Forking what is left of ZeroNet and hopefully adding an AT Proto Frontend/Proxy
1import os
2
3from Config import config
4from Crypt import CryptConnection
5
6
7class TestCryptConnection:
8 def testSslCert(self):
9 # Remove old certs
10 if os.path.isfile("%s/cert-rsa.pem" % config.data_dir):
11 os.unlink("%s/cert-rsa.pem" % config.data_dir)
12 if os.path.isfile("%s/key-rsa.pem" % config.data_dir):
13 os.unlink("%s/key-rsa.pem" % config.data_dir)
14
15 # Generate certs
16 CryptConnection.manager.loadCerts()
17
18 assert "tls-rsa" in CryptConnection.manager.crypt_supported
19 assert CryptConnection.manager.selectCrypt(["tls-rsa", "unknown"]) == "tls-rsa" # It should choose the known crypt
20
21 # Check openssl cert generation
22 assert os.path.isfile("%s/cert-rsa.pem" % config.data_dir)
23 assert os.path.isfile("%s/key-rsa.pem" % config.data_dir)