示例#1
0
    def testUserBaseInstall(self):
        dbdir = self.mktemp()
        axiomatic.main(['-d', dbdir, 'userbase', 'install'])

        s = Store(dbdir)
        IRealm(s)
        ICredentialsChecker(s)
        s.close()
def createStore(testCase):
    dbpath = testCase.mktemp()
    axiomatic.main(['-d', dbpath, 'mantissa', '--admin-password', 'password'])

    store = Store(dbpath)

    _userbase = store.findUnique(userbase.LoginSystem)
    adminAccount = _userbase.accountByAddress(u'admin', u'localhost')
    adminStore = adminAccount.avatars.open()

    conf = adminStore.findUnique(offering.OfferingConfiguration)
    conf.installOffering(getQuotientOffering(), None)
    return store
示例#3
0
def createStore(testCase):
    dbpath = testCase.mktemp()
    axiomatic.main(['-d', dbpath, 'mantissa', '--admin-password', 'password'])

    store = Store(dbpath)

    _userbase = store.findUnique(userbase.LoginSystem)
    adminAccount = _userbase.accountByAddress(u'admin', u'localhost')
    adminStore = adminAccount.avatars.open()

    conf = adminStore.findUnique(offering.OfferingConfiguration)
    conf.installOffering(getQuotientOffering(), None)
    return store
示例#4
0
    def userbase(self, *args):
        """
        Run 'axiomatic userbase' with the given arguments on database at
        C{dbdir}.

        @return: A list of lines printed to stdout by the axiomatic command.
        """
        output = io.StringIO()
        sys.stdout, stdout = output, sys.stdout
        try:
            axiomatic.main(['-d', self.dbdir.path, 'userbase'] + list(args))
        finally:
            sys.stdout = stdout
        return output.getvalue().splitlines()
示例#5
0
    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)