1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
import testutils, arc, unittest
class EndpointTest(testutils.ARCClientTestCase):
def test_the_class_exists(self):
self.expect(arc.Endpoint).to_be_an_instance_of(type)
def test_the_constructor(self):
registry = arc.Endpoint()
self.expect(registry).to_be_an_instance_of(arc.Endpoint)
def test_default_attributes_are_empty(self):
registry = arc.Endpoint()
self.expect(registry.URLString).to_be("")
self.expect(registry.Capability).to_have(0).capabilities()
self.expect(registry.InterfaceName).to_be("")
def test_constructor_with_values(self):
registry = arc.Endpoint("test.nordugrid.org", ["information.discovery.registry"], "org.nordugrid.sertest")
self.expect(registry.URLString).to_be("test.nordugrid.org")
self.expect(registry.Capability[0]).to_be("information.discovery.registry")
self.expect(registry.InterfaceName).to_be("org.nordugrid.sertest")
def test_constructor_with_enum_registry(self):
registry = arc.Endpoint("test.nordugrid.org", arc.Endpoint.REGISTRY)
self.expect(registry.URLString).to_be("test.nordugrid.org")
self.expect(registry.Capability[0]).to_be("information.discovery.registry")
self.expect(registry.InterfaceName).to_be("")
def test_constructor_with_enum_computing(self):
endpoint = arc.Endpoint("test.nordugrid.org", arc.Endpoint.COMPUTINGINFO)
self.expect(endpoint.URLString).to_be("test.nordugrid.org")
self.expect(endpoint.Capability[0]).to_be("information.discovery.resource")
self.expect(endpoint.InterfaceName).to_be("")
def test_has_capability_with_enum(self):
registry = arc.Endpoint("test.nordugrid.org", arc.Endpoint.REGISTRY)
self.expect(registry.HasCapability(arc.Endpoint.REGISTRY)).to_be(True);
def test_has_capability_with_string(self):
registry = arc.Endpoint("test.nordugrid.org", arc.Endpoint.REGISTRY)
self.expect(registry.HasCapability("information.discovery.registry")).to_be(True);
def test_string_representation(self):
registry = arc.Endpoint("test.nordugrid.org", ["information.discovery.registry"], "org.nordugrid.sertest")
self.expect(registry.str()).to_be("test.nordugrid.org (org.nordugrid.sertest, capabilities: information.discovery.registry)")
if __name__ == '__main__':
unittest.main()
|