def test_get_and_set_service_properties(self):

        class IFoo(Interface):
            price = Int

        @provides(IFoo)
        class Foo(HasTraits):
            price = Int

        # Register two services.
        #
        # This one has no properties.
        foo = Foo(price=100)
        foo_id = self.service_registry.register_service(IFoo, foo)

        # This one has properties.
        goo = Foo(price=10)
        goo_id = self.service_registry.register_service(
            IFoo, goo, {'price' : 200}
        )

        # Get the properties.
        foo_properties = self.service_registry.get_service_properties(foo_id)
        self.assertEqual({}, foo_properties)

        goo_properties = self.service_registry.get_service_properties(goo_id)
        self.assertEqual(200, goo_properties['price'])

        # Update the properties.
        foo_properties['price'] = 300
        goo_properties['price'] = 500

        # Set the properties.
        self.service_registry.set_service_properties(foo_id, foo_properties)
        self.service_registry.set_service_properties(goo_id, goo_properties)

        # Get the properties again.
        foo_properties = self.service_registry.get_service_properties(foo_id)
        self.assertEqual(300, foo_properties['price'])

        goo_properties = self.service_registry.get_service_properties(goo_id)
        self.assertEqual(500, goo_properties['price'])

        # Try to get the properties of a non-existent service.
        self.failUnlessRaises(
            ValueError, self.service_registry.get_service_properties, -1
        )

        # Try to set the properties of a non-existent service.
        self.failUnlessRaises(
            ValueError, self.service_registry.set_service_properties, -1, {}
        )

        return
get and set service properties
dataset/ETHPy150Open enthought/envisage/envisage/tests/service_registry_test_case.py/ServiceRegistryTestCase.test_get_and_set_service_properties