Exemplo n.º 1
0
 def test_identifierFromSharedItemMulti(self):
     """
     L{sharing.Identifier.fromSharedItem} should identify a shared Item's
     shareID even if it is shared multiple times.
     """
     t = PrivateThing(store=self.store)
     sharing.getEveryoneRole(self.store).shareItem(t, shareID=u'asdf')
     sharing.getAuthenticatedRole(self.store).shareItem(t, shareID=u'jkl;')
     sid = sharing.Identifier.fromSharedItem(t)
     self.assertIn(sid.shareID, [u'asdf', u'jkl;'])
     self.assertEquals(sid.localpart, u'username')
     self.assertEquals(sid.domain, u'domain.example.com')
Exemplo n.º 2
0
 def test_roleInSomebodyElsesStoreWhoDoesntKnowMe(self):
     """
     L{_AuthenticatedWebViewer} should return the authenticated role for
     users with no specific role to map.
     """
     someStore = self.loginSystem.addAccount(
         u'someguy', u'localhost', u'asdf').avatars.open()
     role = getAuthenticatedRole(someStore)
     self.assertIdentical(self.pageFactory.roleIn(someStore),
                          role)
Exemplo n.º 3
0
 def test_getSelfRole(self):
     """
     The self-role of a store should be determined by its L{LoginMethod}s.
     """
     self.assertEquals(list(self.store.query(sharing.Role)), [])
     me = sharing.getSelfRole(self.store)
     self.assertEquals(me.externalID, u'*****@*****.**')
     self.assertEquals(me.store, self.store)
     self.assertEquals(list(me.allRoles()),
                       [me,
                        sharing.getAuthenticatedRole(self.store),
                        sharing.getEveryoneRole(self.store)])