示例#1
0
 def test_sameLocalpartAndUsername(self):
     """
     Test that L{xmantissa.websharing._storeFromUsername} doesn't get
     confused when the username it is passed is the same as the localpart
     of that user's email address
     """
     self.signup.createUser(
         u'', u'username', u'localhost', u'', u'username@internet')
     self.assertIdentical(
         websharing._storeFromUsername(self.siteStore, u'username'),
         self.loginSystem.accountByAddress(
             u'username', u'localhost').avatars.open())
示例#2
0
 def test_sameLocalpartAndUsername(self):
     """
     Test that L{xmantissa.websharing._storeFromUsername} doesn't get
     confused when the username it is passed is the same as the localpart
     of that user's email address
     """
     self.signup.createUser(u'', u'username', u'localhost', u'',
                            u'username@internet')
     self.assertIdentical(
         websharing._storeFromUsername(self.siteStore, u'username'),
         self.loginSystem.accountByAddress(u'username',
                                           u'localhost').avatars.open())
示例#3
0
 def setUp(self):
     """
     Create an additional user for UserIndexPage, and share a single item with a
     shareID of the empty string.
     """
     _UserIdentificationMixin.setUp(self)
     self.magicValue = 123412341234
     self.signup.createUser(
         u'', self.username, self.domain, u'', u'username@internet')
     self.userStore = websharing._storeFromUsername(
         self.siteStore, self.username)
     self.shareable = Shareable(store=self.userStore,
                                magicValue=self.magicValue)
     self.share = sharing.shareItem(self.shareable, shareID=self.shareID)
示例#4
0
 def setUp(self):
     """
     Create an additional user for UserIndexPage, and share a single item with a
     shareID of the empty string.
     """
     _UserIdentificationMixin.setUp(self)
     self.magicValue = 123412341234
     self.signup.createUser(u'', self.username, self.domain, u'',
                            u'username@internet')
     self.userStore = websharing._storeFromUsername(self.siteStore,
                                                    self.username)
     self.shareable = Shareable(store=self.userStore,
                                magicValue=self.magicValue)
     self.share = sharing.shareItem(self.shareable, shareID=self.shareID)
示例#5
0
    def test_locateChild(self):
        """
        L{websharing.UserIndexPage.locateChild} should return the named user's
        L{websharing.SharingIndex} (and any remaining segments), or
        L{rend.NotFound}.
        """
        # Test against at least one other valid user.
        self.signup.createUser(
            u'Andr\xe9', u'andr\xe9', u'localhost', u'', u'andr\xe9@internet')
        userStore2 = websharing._storeFromUsername(self.siteStore, u'andr\xe9')
        index = websharing.UserIndexPage(self.loginSystem, FakeShellFactory(None))

        for _username, _store in [(self.username, self.userStore),
                                  (u'andr\xe9', userStore2)]:
            (found, remaining) = index.locateChild(
                None, [_username.encode('utf-8'), 'x', 'y', 'z'])

            self.assertTrue(isinstance(found, websharing.SharingIndex))
            self.assertIdentical(found.userStore, _store)
            self.assertEquals(remaining, ['x', 'y', 'z'])

        self.assertIdentical(index.locateChild(None, ['bogus', 'username']),
                             rend.NotFound)
示例#6
0
    def test_locateChild(self):
        """
        L{websharing.UserIndexPage.locateChild} should return the named user's
        L{websharing.SharingIndex} (and any remaining segments), or
        L{rend.NotFound}.
        """
        # Test against at least one other valid user.
        self.signup.createUser(u'Andr\xe9', u'andr\xe9', u'localhost', u'',
                               u'andr\xe9@internet')
        userStore2 = websharing._storeFromUsername(self.siteStore, u'andr\xe9')
        index = websharing.UserIndexPage(self.loginSystem,
                                         FakeShellFactory(None))

        for _username, _store in [(self.username, self.userStore),
                                  (u'andr\xe9', userStore2)]:
            (found, remaining) = index.locateChild(
                None, [_username.encode('utf-8'), 'x', 'y', 'z'])

            self.assertTrue(isinstance(found, websharing.SharingIndex))
            self.assertIdentical(found.userStore, _store)
            self.assertEquals(remaining, ['x', 'y', 'z'])

        self.assertIdentical(index.locateChild(None, ['bogus', 'username']),
                             rend.NotFound)