Example #1
0
class ActionsTestCase(TestCase):
    """
    Tests to verify that actions behave as expected.

    @ivar siteStore: A site store containing an administrative user's account.

    @ivar siteAccount: The L{axiom.userbase.LoginAccount} for the
    administrator, in the site store.

    @ivar siteMethod: The single L{axiom.userbase.LoginMethod} for the
    administrator, in the site store.

    @ivar localUserBrowserFragment: A L{LocalUserBrowserFragment} examining the
    administrator's L{LocalUserBrowser} powerup.
    """

    def setUp(self):
        """
        Construct a site and user store with an administrator that can invoke the
        web administrative tools, setting the instance variables described in
        this class's docstring.
        """
        self.siteStore = Store(filesdir=self.mktemp())
        Mantissa().installSite(self.siteStore, u"localhost", u"", False)
        Mantissa().installAdmin(self.siteStore, u'admin', u'localhost', u'asdf')

        self.siteMethod = self.siteStore.findUnique(
            LoginMethod, LoginMethod.localpart == u'admin')
        self.siteAccount = self.siteMethod.account
        userStore = self.siteAccount.avatars.open()
        lub = userStore.findUnique(LocalUserBrowser)
        self.localUserBrowserFragment = LocalUserBrowserFragment(lub)


    def test_actionTypes(self):
        """
        Verify that all the action methods expose the appropriate fragment
        objects, with their attributes set to indicate the correct objects to
        manipulate.
        """
        myRowID = self.localUserBrowserFragment.linkToItem(self.siteMethod)
        actionMap = [('installOn', EndowFragment),
                     ('uninstallFrom', DepriveFragment),
                     ('suspend', SuspendFragment),
                     ('unsuspend', UnsuspendFragment)]
        for action, fragmentType in actionMap:
            resultFragment = self.localUserBrowserFragment.performAction(
                action, myRowID)
            self.failUnless(isinstance(resultFragment, fragmentType),
                            "%s does not return a %s" %
                            (action, fragmentType))
            self.assertEquals(resultFragment.fragmentParent,
                              self.localUserBrowserFragment)
            self.assertEquals(resultFragment.account, self.siteAccount)
Example #2
0
class ActionsTestCase(TestCase):
    """
    Tests to verify that actions behave as expected.

    @ivar siteStore: A site store containing an administrative user's account.

    @ivar siteAccount: The L{axiom.userbase.LoginAccount} for the
    administrator, in the site store.

    @ivar siteMethod: The single L{axiom.userbase.LoginMethod} for the
    administrator, in the site store.

    @ivar localUserBrowserFragment: A L{LocalUserBrowserFragment} examining the
    administrator's L{LocalUserBrowser} powerup.
    """

    def setUp(self):
        """
        Construct a site and user store with an administrator that can invoke the
        web administrative tools, setting the instance variables described in
        this class's docstring.
        """
        self.siteStore = Store(filesdir=self.mktemp())
        Mantissa().installSite(self.siteStore, u"localhost", u"", False)
        Mantissa().installAdmin(self.siteStore, u"admin", u"localhost", u"asdf")

        self.siteMethod = self.siteStore.findUnique(LoginMethod, LoginMethod.localpart == u"admin")
        self.siteAccount = self.siteMethod.account
        userStore = self.siteAccount.avatars.open()
        lub = userStore.findUnique(LocalUserBrowser)
        self.localUserBrowserFragment = LocalUserBrowserFragment(lub)

    def test_actionTypes(self):
        """
        Verify that all the action methods expose the appropriate fragment
        objects, with their attributes set to indicate the correct objects to
        manipulate.
        """
        myRowID = self.localUserBrowserFragment.linkToItem(self.siteMethod)
        actionMap = [
            ("installOn", EndowFragment),
            ("uninstallFrom", DepriveFragment),
            ("suspend", SuspendFragment),
            ("unsuspend", UnsuspendFragment),
        ]
        for action, fragmentType in actionMap:
            resultFragment = self.localUserBrowserFragment.performAction(action, myRowID)
            self.failUnless(
                isinstance(resultFragment, fragmentType), "%s does not return a %s" % (action, fragmentType)
            )
            self.assertEquals(resultFragment.fragmentParent, self.localUserBrowserFragment)
            self.assertEquals(resultFragment.account, self.siteAccount)
Example #3
0
    def setUp(self):
        """
        Construct a site and user store with an administrator that can invoke the
        web administrative tools, setting the instance variables described in
        this class's docstring.
        """
        self.siteStore = Store(filesdir=self.mktemp())
        Mantissa().installSite(self.siteStore, u"localhost", u"", False)
        Mantissa().installAdmin(self.siteStore, u'admin', u'localhost', u'asdf')

        self.siteMethod = self.siteStore.findUnique(
            LoginMethod, LoginMethod.localpart == u'admin')
        self.siteAccount = self.siteMethod.account
        userStore = self.siteAccount.avatars.open()
        lub = userStore.findUnique(LocalUserBrowser)
        self.localUserBrowserFragment = LocalUserBrowserFragment(lub)
Example #4
0
    def setUp(self):
        """
        Construct a site and user store with an administrator that can invoke the
        web administrative tools, setting the instance variables described in
        this class's docstring.
        """
        self.siteStore = Store(filesdir=self.mktemp())
        Mantissa().installSite(self.siteStore, u"localhost", u"", False)
        Mantissa().installAdmin(self.siteStore, u"admin", u"localhost", u"asdf")

        self.siteMethod = self.siteStore.findUnique(LoginMethod, LoginMethod.localpart == u"admin")
        self.siteAccount = self.siteMethod.account
        userStore = self.siteAccount.avatars.open()
        lub = userStore.findUnique(LocalUserBrowser)
        self.localUserBrowserFragment = LocalUserBrowserFragment(lub)