2
from OpenSSL.crypto import FILETYPE_PEM
4
from twisted.internet.ssl import PrivateCertificate, KeyPair
1
6
from axiom.item import Item
2
7
from axiom.attributes import text
8
from axiom.dependency import installOn
3
9
from axiom.test.historic.stubloader import saveStub
5
11
from xmantissa.port import TCPPort, SSLPort
6
12
from xmantissa.website import WebSite
10
def createDatabase(s):
14
# Unfortunately, the test module for this store binds ports. So pick some
15
# improbably port numbers and hope they aren't bound. If they are, the test
16
# will fail. Hooray! -exarkun
20
def createDatabase(siteStore):
12
22
Populate the given Store with a TCPPort and SSLPort.
14
factory = WebSite(store=s)
15
TCPPort(store=s, portNumber=80, factory=factory)
16
SSLPort(store=s, portNumber=443,
17
certificatePath=s.newFilePath('certificate'), factory=factory)
24
factory = WebSite(store=siteStore)
25
installOn(factory, siteStore)
27
TCPPort(store=siteStore, portNumber=TCP_PORT, factory=factory),
29
certificatePath = siteStore.newFilePath('certificate')
31
key = KeyPair.generate()
32
cert = key.selfSignedCert(1)
33
certificatePath.setContent(
34
cert.dump(FILETYPE_PEM) +
35
key.dump(FILETYPE_PEM))
38
SSLPort(store=siteStore, portNumber=SSL_PORT,
39
certificatePath=certificatePath,