def testCrypto(self): # First time there should not be anything, so load and save 0 r = Utility.initCrypto(self.path) self.assert_(r == 0, 'First time crypto init should return 0, got %d' % r) r = Utility.stopCrypto(self.path) self.assert_(r == 0, 'First time crypto stop should return 0, got %d' % r) # Trick us into thinking we have initialized entropy from osaf.framework.certstore import utils utils.entropyInitialized = True # Now we should save 1k on stop, after that loading and saving 1k r = Utility.initCrypto(self.path) self.assert_(r == 0, 'Entropy initialized, crypto init should return 0 first time, got %d' % r) # Note: the most likely reason why these would fail is if the entropy # file was not created, for example if we failed to create the # directory in setUp() r = Utility.stopCrypto(self.path) self.assert_(r == 1024, 'Entropy initialized, should save 1024 entropy first time, got %d' % r) r = Utility.initCrypto(self.path) self.assert_(r == 1024, 'Entropy initialized, should load 1024 entropy, got %d' % r) r = Utility.stopCrypto(self.path) self.assert_(r == 1024, 'Entropy initialized, should save 1024 entropy, got %d' % r)
def testCrypto(self): # First time there should not be anything, so load and save 0 r = Utility.initCrypto(self.path) self.assert_(r == 0, 'First time crypto init should return 0, got %d' % r) r = Utility.stopCrypto(self.path) self.assert_(r == 0, 'First time crypto stop should return 0, got %d' % r) # Trick us into thinking we have initialized entropy from osaf.framework.certstore import utils utils.entropyInitialized = True # Now we should save 1k on stop, after that loading and saving 1k r = Utility.initCrypto(self.path) self.assert_( r == 0, 'Entropy initialized, crypto init should return 0 first time, got %d' % r) # Note: the most likely reason why these would fail is if the entropy # file was not created, for example if we failed to create the # directory in setUp() r = Utility.stopCrypto(self.path) self.assert_( r == 1024, 'Entropy initialized, should save 1024 entropy first time, got %d' % r) r = Utility.initCrypto(self.path) self.assert_( r == 1024, 'Entropy initialized, should load 1024 entropy, got %d' % r) r = Utility.stopCrypto(self.path) self.assert_( r == 1024, 'Entropy initialized, should save 1024 entropy, got %d' % r)
def shutdown(): Utility.stopWakeup() Utility.stopTwisted() Utility.stopRepository(view) Utility.stopCrypto(Globals.options.profileDir)
def tearDown(self): super(TestSSL, self).tearDown() Utility.stopCrypto(self.profileDir)
parcelPath = Utility.initParcelEnv(Globals.options, Globals.chandlerDirectory) pluginEnv, pluginEggs = Utility.initPluginEnv(Globals.options, Globals.options.pluginPath) view = Utility.initRepository(profileDir, Globals.options) verify, repoVersion, schemaVersion = Utility.verifySchema(view) Utility.initCrypto(Globals.options.profileDir) Utility.initParcels(Globals.options, view, parcelPath) Utility.initPlugins(Globals.options, view, pluginEnv, pluginEggs) Utility.initTimezone(Globals.options, view) outputDir = os.path.join(Globals.chandlerDirectory, 'docs') if os.path.isfile('Chandler.py'): if not os.path.isdir(outputDir): _mkdirs(outputDir) generateModelDocs(Globals.chandlerDirectory, view, outputDir) generateDocs(outputDir) else: print "Error: Currently gen_docs.py assumes it is running in the chandler/ directory" Utility.stopWakeup() Utility.stopTwisted() Utility.stopRepository(view, False) Utility.stopCrypto(Globals.options.profileDir)
def shutdown(): Utility.stopWakeup() Utility.stopTwisted() Utility.stopRepository(view, commitOnExit) Utility.stopCrypto(Globals.options.profileDir)