def test_createSSLPort(self): """ If a given valid strport description of an SSL port and the storeID of an extant factory, I{axiomatic port create} creates a new L{SSLPort} with the specified configuration and referring to that factory. The certificate file specified is copied to a path inside the Store's files directory. The port is also powered up on the store for L{IService}. """ pemPath = FilePath(self.mktemp()) pemPath.setContent(CERTIFICATE_DATA + PRIVATEKEY_DATA) store = Store(filesdir=self.mktemp()) factory = DummyFactory(store=store) self.assertSuccessStatus( self._makeConfig(store), ["create", "--strport", "ssl:8443:certKey=" + pemPath.path + ":privateKey=" + pemPath.path, "--factory-identifier", str(factory.storeID)]) self.assertEqual("Created.\n", sys.stdout.getvalue()) [ssl] = list(store.query(SSLPort)) self.assertEqual(ssl.portNumber, 8443) self.assertEqual( ssl.certificatePath.getContent(), CERTIFICATE_DATA + PRIVATEKEY_DATA) self.assertIdentical(ssl.factory, factory) self.assertEqual( pemPath.getContent(), CERTIFICATE_DATA + PRIVATEKEY_DATA) self.assertEqual(list(store.interfacesFor(ssl)), [IService])
def test_createSSLPort(self): """ If a given valid strport description of an SSL port and the storeID of an extant factory, I{axiomatic port create} creates a new L{SSLPort} with the specified configuration and referring to that factory. The certificate file specified is copied to a path inside the Store's files directory. The port is also powered up on the store for L{IService}. """ pemPath = FilePath(self.mktemp()) pemPath.setContent(CERTIFICATE_DATA + PRIVATEKEY_DATA) store = Store(filesdir=self.mktemp()) factory = DummyFactory(store=store) self.assertSuccessStatus(self._makeConfig(store), [ "create", "--strport", "ssl:8443:certKey=" + pemPath.path + ":privateKey=" + pemPath.path, "--factory-identifier", str(factory.storeID) ]) self.assertEqual("Created.\n", sys.stdout.getvalue()) [ssl] = list(store.query(SSLPort)) self.assertEqual(ssl.portNumber, 8443) self.assertEqual(ssl.certificatePath.getContent(), CERTIFICATE_DATA + PRIVATEKEY_DATA) self.assertIdentical(ssl.factory, factory) self.assertEqual(pemPath.getContent(), CERTIFICATE_DATA + PRIVATEKEY_DATA) self.assertEqual(list(store.interfacesFor(ssl)), [IService])
def test_createPort(self): """ I{axiomatic port create} creates a new L{xmantissa.port.StringEndpointPort} with the specified description, referring to the specified factory. The port is also powered up on the store for L{IService}. """ store = Store() factory = DummyFactory(store=store) self.assertSuccessStatus( self._makeConfig(store), ["create", "--strport", "tcp:8080", "--factory-identifier", str(factory.storeID)] ) self.assertEqual("Created.\n", sys.stdout.getvalue()) [port] = list(store.query(StringEndpointPort)) self.assertEqual(u"tcp:8080", port.description) self.assertEqual(list(store.interfacesFor(port)), [IService])
def test_createPort(self): """ I{axiomatic port create} creates a new L{xmantissa.port.StringEndpointPort} with the specified description, referring to the specified factory. The port is also powered up on the store for L{IService}. """ store = Store() factory = DummyFactory(store=store) self.assertSuccessStatus( self._makeConfig(store), ["create", "--strport", "tcp:8080", "--factory-identifier", str(factory.storeID)]) self.assertEqual("Created.\n", sys.stdout.getvalue()) [port] = list(store.query(StringEndpointPort)) self.assertEqual(u'tcp:8080', port.description) self.assertEqual(list(store.interfacesFor(port)), [IService])
def test_createTCPPort(self): """ If given a valid strport description of a TCP port and the storeID of an extant factory, I{axiomatic port create} creates a new L{TCPPort} with the specified configuration and referring to that factory. The port is also powered up on the store for L{IService}. """ store = Store() factory = DummyFactory(store=store) self.assertSuccessStatus( self._makeConfig(store), ["create", "--strport", "tcp:8080", "--factory-identifier", str(factory.storeID)]) self.assertEqual("Created.\n", sys.stdout.getvalue()) [tcp] = list(store.query(TCPPort)) self.assertEqual(tcp.portNumber, 8080) self.assertIdentical(tcp.factory, factory) self.assertEqual(list(store.interfacesFor(tcp)), [IService])
def test_createTCPPort(self): """ If given a valid strport description of a TCP port and the storeID of an extant factory, I{axiomatic port create} creates a new L{TCPPort} with the specified configuration and referring to that factory. The port is also powered up on the store for L{IService}. """ store = Store() factory = DummyFactory(store=store) self.assertSuccessStatus(self._makeConfig(store), [ "create", "--strport", "tcp:8080", "--factory-identifier", str(factory.storeID) ]) self.assertEqual("Created.\n", sys.stdout.getvalue()) [tcp] = list(store.query(TCPPort)) self.assertEqual(tcp.portNumber, 8080) self.assertIdentical(tcp.factory, factory) self.assertEqual(list(store.interfacesFor(tcp)), [IService])