def compareTraversal(self, domain, expected):
     traversal = traverse(
         self.source.root,
         self.source.load_user,
         domain
     )
     self.assertEqual(
         [x["selector"] for x in traversal],
         expected
     )
Beispiel #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 []
Beispiel #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 []
Beispiel #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)