コード例 #1
0
ファイル: test_admin.py プロジェクト: jonathanj/mantissa
    def doRendering(self, fragmentClass):
        """
        Verify that the given fragment class will render without raising an
        exception.
        """
        siteStore = Store()

        loginSystem = LoginSystem(store=siteStore)
        installOn(loginSystem, siteStore)
        p = Product(store=siteStore, types=["xmantissa.webadmin.LocalUserBrowser",
                                            "xmantissa.signup.SignupConfiguration"])
        account = loginSystem.addAccount(u'testuser', u'localhost', None)
        p.installProductOn(account.avatars.open())
        f = fragmentClass(None, u'testuser', account)

        p = LivePage(
            docFactory=stan(
                html[
                    head(render=directive('liveglue')),
                    body(render=lambda ctx, data: f)]))
        f.setFragmentParent(p)

        ctx = WovenContext()
        req = FakeRequest()
        ctx.remember(req, IRequest)

        d = p.renderHTTP(ctx)
        def rendered(ign):
            p.action_close(None)
        d.addCallback(rendered)
        return d
コード例 #2
0
def createDatabase(s):
    ls = LoginSystem(store=s)
    ls.installOn(s)
    acc = ls.addAccount(*CREDENTIALS)
    ss = acc.avatars.open()
    gph = GarbageProtocolHandler(store=ss, garbage=GARBAGE_LEVEL)
    gph.installOn(ss)
コード例 #3
0
def createDatabase(s):
    ls = LoginSystem(store=s)
    ls.installOn(s)
    acc = ls.addAccount('test', 'example.com', 'asdf')
    ss = acc.avatars.open()
    gph = GarbageProtocolHandler(store=ss, garbage=7)
    gph.installOn(ss)
コード例 #4
0
ファイル: test_fulltext.py プロジェクト: jonathanj/mantissa
    def setUp(self):
        """
        Make a store, an account/substore, an indexer, and call startService()
        on the superstore's IService so the batch process interactions that
        happen in fulltext.py work
        """
        self.dbdir = self.mktemp()
        self.path = u'index'

        superstore = store.Store(self.dbdir)

        loginSystem = LoginSystem(store=superstore)
        installOn(loginSystem, superstore)

        account = loginSystem.addAccount(u'testuser', u'example.com', None)
        substore = account.avatars.open()

        self.store = substore
        self.indexer = self.createIndexer()

        self.svc = IService(superstore)
        self.svc.startService()

        # Make sure the indexer is actually available
        writer = self.openWriteIndex()
        writer.close()
コード例 #5
0
 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])
コード例 #6
0
def createDatabase(s):
    """
    Create an account in the given store and install a MailTransferAgent on
    both the given store and the substore for that account.
    """
    loginSystem = LoginSystem(store=s)
    loginSystem.installOn(s)

    mta = MailTransferAgent(store=s)
    mta.installOn(s)
コード例 #7
0
ファイル: test_admin.py プロジェクト: jonathanj/mantissa
    def setUp(self):
        """
        Create a site store and a user store with a L{LocalUserBrowser}
        installed on it.
        """
        self.siteStore = Store()
        self.loginSystem = LoginSystem(store=self.siteStore)
        installOn(self.loginSystem, self.siteStore)

        self.userStore = Store()
        self.userStore.parent = self.siteStore
        self.browser = LocalUserBrowser(store=self.userStore)
コード例 #8
0
def createDatabase(store):
    """
    Instantiate a L{PrivateApplication} in C{store} and install it.
    """
    loginSystem = LoginSystem(store=store)
    installOn(loginSystem, store)
    account = loginSystem.addAccount(USERNAME, DOMAIN, None)
    subStore = account.avatars.open()

    app = PrivateApplication(
        store=subStore,
        preferredTheme=PREFERRED_THEME,
        privateKey=PRIVATE_KEY)
    installOn(app, subStore)
コード例 #9
0
 def setUp(self):
     """
     Set up some state.
     """
     self.s = Store()
     self.ls = LoginSystem(store=self.s)
     installOn(self.ls, self.s)
     acct = self.ls.addAccount(u'right',
                               u'host',
                               u'',
                               verified=True,
                               internal=True)
     acct.addLoginMethod(u'wrong', u'host', internal=False, verified=False)
     self.share = sharing.shareItem(self.ls, shareID=u'loginsystem')
コード例 #10
0
def createDatabase(s):
    """
    Create an account in the given store and install a MailTransferAgent on
    both the given store and the substore for that account.
    """
    Scheduler(store=s).installOn(s)

    loginSystem = LoginSystem(store=s)
    loginSystem.installOn(s)

    mta = MailTransferAgent(store=s)
    mta.installOn(s)

    account = loginSystem.addAccount(u'testuser', u'localhost', None)
    subStore = account.avatars.open()
    SubScheduler(store=subStore).installOn(subStore)
    mda = MailTransferAgent(store=subStore)
    mda.installOn(subStore)
コード例 #11
0
def createStore(testCase):
    location = testCase.mktemp()
    s = Store(location)
    da = DeliveryAgent(store=s)
    installOn(da, s)
    makeSomeMessages(testCase, da, location)
    installOn(POP3Up(store=s), s)
    ls = LoginSystem(store=s)
    installOn(ls, s)

    # Engage in some trickery to allow this to be used as its own user.
    la = LoginAccount(store=s, password=u'asdfjkl;', avatars=s, disabled=False)
    LoginMethod(store=s,
                account=la,
                localpart=u'user',
                domain=u'example.com',
                protocol=u'email',
                internal=True,
                verified=True)
    return s
コード例 #12
0
def createDatabase(s):
    LoginSystem(store=s).installOn(s)
    POP3Listener(store=s).installOn(s)
コード例 #13
0
ファイル: test_util.py プロジェクト: z3n71n3l/entropy
 def setUp(self):
     self.siteStore = Store(self.mktemp())
     installOn(LoginSystem(store=self.siteStore), self.siteStore)
     offering = entropyoff.plugin
     IOfferingTechnician(self.siteStore).installOffering(offering)