def testUserBaseInstall(self): dbdir = self.mktemp() axiomatic.main(['-d', dbdir, 'userbase', 'install']) s = Store(dbdir) IRealm(s) ICredentialsChecker(s) s.close()
def setUp(self): """ Create a store with a LoginSystem and a portal wrapped around it. """ store = Store() installOn(LoginSystem(store=store), store) realm = IRealm(store) checker = ICredentialsChecker(store) self.portal = Portal(realm, [checker])
def testUpgrade(self): p = Portal(IRealm(self.store), [ICredentialsChecker(self.store)]) def loggedIn((interface, avatarAspect, logout)): # if we can login, i guess everything is fine self.assertEquals(avatarAspect.garbage, GARBAGE_LEVEL) creds = UsernamePassword('@'.join(CREDENTIALS[:-1]), CREDENTIALS[-1]) d = p.login(creds, None, IGarbage) return d.addCallback(loggedIn)
def _speedup(): l = userbase.LoginSystem(store=s) l.installOn(s) s.checkpoint() p = Portal(IRealm(s), [ICredentialsChecker(s)]) a = l.addAccount(username, 'localhost', SECRET) gph = GarbageProtocolHandler(store=a.avatars.open(), garbage=0) gph.installOn(gph.store) return p, gph
def testUpgrade(self): p = Portal(IRealm(self.store), [ICredentialsChecker(self.store)]) def loggedIn((ifc, av, lgo)): assert av.garbage == 7 # Bug in cooperator? this triggers an exception. # return svc.stopService() d = p.login(UsernamePassword('*****@*****.**', SECRET), None, IGarbage) return d.addCallback(loggedIn)
def getFactory(self): """ Create an L{SSHFactory} which allows access to Mantissa accounts. """ privateKey = Key.fromString(data=self.hostKey) public = privateKey.public() factory = SSHFactory() factory.publicKeys = {'ssh-rsa': public} factory.privateKeys = {'ssh-rsa': privateKey} factory.portal = Portal(IRealm(self.store), [ICredentialsChecker(self.store)]) return factory
def testUserCreation(self): dbdir = self.mktemp() axiomatic.main( ['-d', dbdir, 'userbase', 'create', 'alice', 'localhost', SECRET]) s = Store(dbdir) cc = ICredentialsChecker(s) p = Portal(IRealm(s), [cc]) def cb((interface, avatar, logout)): logout() return p.login(UsernamePassword('alice@localhost', SECRET), None, lambda orig, default: orig).addCallback(cb)
def _login(self, avatarId, password): cc = ICredentialsChecker(self.store) p = Portal(IRealm(self.store), [cc]) return p.login(UsernamePassword(avatarId, password), None, lambda orig, default: orig)
def setUp(self): self.store = getPristineStore(self, createStore) self.mailbox = self.store.findUnique(POP3Up) realm = IRealm(self.store) checker = ICredentialsChecker(self.store) self.portal = Portal(realm, [checker])