def test_insertOneCert_Success(self):
     sslcert = SSLCert("test1999.com", 19720009)
     sslcert.selfSignThisCert()
     self.failUnless(insertOneCert(self.datastore, sslcert))
 def test_insertOneSelfSignedCert_Success(self):
     sslCert = SSLCert("booger.com", 30720009)
     sslCert.selfSignThisCert()
     self.failUnless(insertOneCert(self.datastore, sslCert))
                ssllog.log.main_logger.error("Houston, we have a problem with connecting to the database.")
                exit(1)
        except mdb.Error, e:
            ssllog.log.main_logger.error("Error %d: %s" % (e.args[0],e.args[1]))
        finally:
            for each in range(1, random.randrange(1, 10+1)):
                # Define a cert and generate it
                domain = "test%05d.com" % ctr
                ssllog.log.main_logger.warning("Creating %s - # %d" % (domain, ctr))
                sslcert = SSLCert(domain, ctr)
                if not sslcert:
                    ssllog.log.main_logger.error("Houston, we have a problem with setting up the SSL \
                            certificate for %s." % domain)
                    exit(1)

                if not sslcert.selfSignThisCert():
                    ssllog.log.main_logger.error("Houston, we have a problem with creating the SSL \
                            certificate for %s." % domain)
                    exit(1)

                if not sslcertdatabase.insertOneCert(datastore, sslcert):
                    ssllog.log.main_logger.error("Houston, we have a problem with insertting the SSL \
                            certificate for %s into the database." % domain)
                    exit(1)
                ctr += 1
                sslserverdatabase.updateServerChangedFlag(datastore, myHostname , 1)
            datastore.close()
        time.sleep(random.randrange(1, 15+1))

if __name__ == '__main__':
    main()