Ejemplo n.º 1
0
 def compareTraversal(self, domain, expected):
     traversal = traverse(
         self.source.root,
         self.source.load_user,
         domain
     )
     self.assertEqual(
         [x["selector"] for x in traversal],
         expected
     )
Ejemplo n.º 2
0
    def get_user(self, name, root=None):
        '''
        Returns EJTP IdentityCache.
        '''
        root = root or self.root
        user, domain = name.split('@', 1)

        for branch in traverse(root, self.load_user, domain):
            if 'users' in branch:
                cache = IdentityCache()
                cache.deserialize(branch['users'])
                return cache.filter_by_name(name)
        return []
Ejemplo n.º 3
0
 def get(self, request, root = None):
     root = root or self.root
     for branch in traverse(root, self.load, request.name):
         if isinstance(branch, Resolver):
             results = branch.get(request)
         else:
             results = [
                 toRecord(x, branch['selector'])
                 for x in branch['records']
             ]
         if results:
             return results
     return []
Ejemplo n.º 4
0
 def compareTraversal(self, domain, expected):
     traversal = traverse(self.source.root, self.source.load_user, domain)
     self.assertEqual([x["selector"] for x in traversal], expected)