def test_group(self):
     request = GroupRequest()
     request.namePrefix = '/'
     handler = MasterHandler(EphemeralStore())
     response = handler.group(request)
     self.assertEqual(1, len(response.counts))
     self.assertEqual(1, response.counts.values()[0])
Exemple #2
0
 def test_group(self):
     request = GroupRequest()
     request.namePrefix = '/'
     handler = MasterHandler(EphemeralStore())
     response = handler.group(request)
     self.assertEqual(1, len(response.counts))
     self.assertEqual(1, response.counts.values()[0])
 def test_query(self):
     query = Query()
     query.namePrefix = ''
     query.maxTokens = 10
     request = QueryRequest()
     request.queries = [query]
     handler = MasterHandler(EphemeralStore())
     response = handler.query(request)
     self.assertEqual(1, len(response.tokens))
Exemple #4
0
 def test_query(self):
     query = Query()
     query.namePrefix = ''
     query.maxTokens = 10
     request = QueryRequest()
     request.queries = [query]
     handler = MasterHandler(EphemeralStore())
     response = handler.query(request)
     self.assertEqual(1, len(response.tokens))
 def test_query_and_own(self):
     query = Query()
     query.namePrefix = ''
     query.maxTokens = 10
     request = QueryAndOwnRequest()
     request.owner = 'some_owner'
     request.expirationTime = sys.maxint
     request.query = query
     handler = MasterHandler(EphemeralStore())
     response = handler.query_and_own(request)
     self.assertEqual(0, len(response.tokens))
Exemple #6
0
 def test_query_and_own(self):
     query = Query()
     query.namePrefix = ''
     query.maxTokens = 10
     request = QueryAndOwnRequest()
     request.owner = 'some_owner'
     request.expirationTime = sys.maxint
     request.query = query
     handler = MasterHandler(EphemeralStore())
     response = handler.query_and_own(request)
     self.assertEqual(0, len(response.tokens))
Exemple #7
0
    def create_master(self, store):
        """Create a local master.

        Args:
            store: The store where the master persists tokens.
        """
        self._master_handler = MasterHandler(store)
 def test_archive(self):
     handler = MasterHandler(EphemeralStore())
     token = self._insert_token(handler)
     request = ArchiveRequest()
     request.tokens = [token]
     handler.archive(request)
Exemple #9
0
 def test_modify(self):
     handler = MasterHandler(EphemeralStore())
     self._insert_token(handler)
Exemple #10
0
 def test_archive(self):
     handler = MasterHandler(EphemeralStore())
     token = self._insert_token(handler)
     request = ArchiveRequest()
     request.tokens = [token]
     handler.archive(request)