def test_withdraw(self):
        """
        Check that withdrawn services are no longer visible in BROKER.
        """
        response = register("testService1", 12311)
        self.assertEqual(response, "OK")

        svcs = list(broker("testService1"))
        self.assertEqual(len(svcs), 1)

        withdraw("testService1", 12311)

        svcs = list(broker("testService1"))
        self.assertEqual(len(svcs), 0)
    def test_withdraw(self):
        """
        Check that withdrawn services are no longer visible in BROKER.
        """
        response = register("testService1", 12311)
        self.assertEqual(response, "OK")

        svcs = list(broker("testService1"))
        self.assertEqual(len(svcs), 1)

        withdraw("testService1", 12311)

        svcs = list(broker("testService1"))
        self.assertEqual(len(svcs), 0)
Exemple #3
0
 def test_cmd_invalidates(self):
     """
         Check that the command invalidates everything previously
         registered and that nothing is returned for previously
         valid command.
     """
     response = register("clearTestService", 1101)
     if response != "OK":
         raise ValueError(response)
     svcs = list(broker("clearTestService"))
     if len(svcs) != 1:
         raise ValueError(len(svcs))
     self.assertEqual(clearall(), "OK")
     svcs = list(broker("clearTestService"))
     self.assertEqual(len(svcs), 0)
 def test_cmd_invalidates(self):
     """
         Check that the command invalidates everything previously
         registered and that nothing is returned for previously
         valid command.
     """
     response = register("clearTestService", 1101)
     if response != "OK":
         raise ValueError(response)
     svcs = list(broker("clearTestService"))
     if len(svcs) != 1:
         raise ValueError(len(svcs))
     self.assertEqual(clearall(), "OK")
     svcs = list(broker("clearTestService"))
     self.assertEqual(len(svcs), 0)
 def test_cmd_multi(self):
     """
     Tests that BROKER can correctly return multiple results.
     """
     svcs = list(broker("MultiReservedTestService"))
     self.assertEqual(len(svcs), 2)
     self.assertEqual(svcs[0][0], socket.gethostname())
     self.assertEqual(svcs[1][0], socket.gethostname())
 def test_cmd_2(self):
     """
     Tests that BROKER can correctly distinguish between services.
     """
     svcs = list(broker("AnotherReservedTestService"))
     self.assertEqual(len(svcs), 1)
     self.assertEqual(svcs[0][0], socket.gethostname())
     self.assertEqual(svcs[0][1], 11820)
 def test_cmd_1(self):
     """
     Tests that the ReservedTestService created in setUp can be found.
     """
     svcs = list(broker("ReservedTestService"))
     self.assertEqual(len(svcs), 1)
     self.assertEqual(svcs[0][0], socket.gethostname())
     self.assertEqual(svcs[0][1], 11819)
    def test_withdraw_altport(self):
        """
        Withdrawing services on other ports should not affect this one,
        even if they have the same name.
        """
        response = register("testService1", 12311)
        self.assertEqual(response, "OK")

        response = register("testService1", 12312)
        self.assertEqual(response, "OK")

        svcs = list(broker("testService1"))
        self.assertEqual(len(svcs), 2)

        withdraw("testService1", 12312)

        svcs = list(broker("testService1"))
        self.assertEqual(len(svcs), 1)
    def test_withdraw_altport(self):
        """
        Withdrawing services on other ports should not affect this one,
        even if they have the same name.
        """
        response = register("testService1", 12311)
        self.assertEqual(response, "OK")

        response = register("testService1", 12312)
        self.assertEqual(response, "OK")

        svcs = list(broker("testService1"))
        self.assertEqual(len(svcs), 2)

        withdraw("testService1", 12312)

        svcs = list(broker("testService1"))
        self.assertEqual(len(svcs), 1)