Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def CreateCO(s=""):
co = spade.content.ContentObject()
co["name"] = spade.AID.aid(name="aidname"+s).asContentObject()
co["lease-time"] = 1000
co["protocols"] = ["protocol1"+s,"sdprotocol1"+s]
co["ontologies"] = ["ontology1"+s,"sdontology1"+s]
co["languages"] = ["language1"+s, "sdlanguage1"+s]
co["scope"] = "scope1"+s
sdco = spade.content.ContentObject()
sdco["name"] = "servicename1"+s
sdco["type"] = "type1"+s
sdco["protocols"] = ["sdprotocol1"+s]
sdco["languages"] = ["sdlanguage1"+s]
sdco["ontologies"] = ["sdontology1"+s]
sdco["ownership"] = "agent1"+s
sdco["properties"] = spade.content.ContentObject()
sdco["properties"]["P"] = "valueP"+s
def setUp(self):
#self.rdf = """Tony BennWikipediaTony Benn"""
self.rdf = """Tony BennWikipediaTony BennPepe"""
self.nb = xmpp.simplexml.NodeBuilder(self.rdf)
self.co = spade.content.ContentObject()
self.co.addNamespace("http://xmlns.com/foaf/0.1/","foaf:")
self.co.addNamespace("http://purl.org/dc/elements/1.1/", "dc")
self.co["rdf:Description"] = spade.content.ContentObject()
self.co["rdf:Description"]["dc:title"] = "Tony Benn"
self.co["rdf:Description"]["dc:publisher"] = "Wikipedia"
self.co["rdf:Description"]["foaf:primaryTopic"] = spade.content.ContentObject()
self.co["rdf:Description"]["foaf:primaryTopic"]["foaf:Person"] = spade.content.ContentObject()
self.co["rdf:Description"].primaryTopic.Person["foaf:name"] = ["Tony Benn", "Pepe"]
def testContentObject(self):
aid1 = spade.AID.aid(name="name1",addresses=["addr1","addresses2"],resolvers=["resolver1"])
co = spade.content.ContentObject()
co["name"] ="name1"
co["addresses"] = ["addr1","addresses2"]
co["resolvers"] = ["resolver1"]
#co["properties"] = []
assert aid1.asContentObject() == co
def CreateCO(s=""):
co = spade.content.ContentObject()
co["name"] = spade.AID.aid(name="aidname"+s).asContentObject()
co["lease-time"] = 1000
co["protocols"] = ["protocol1"+s,"sdprotocol1"+s]
co["ontologies"] = ["ontology1"+s,"sdontology1"+s]
co["languages"] = ["language1"+s, "sdlanguage1"+s]
co["scope"] = "scope1"+s
sdco = spade.content.ContentObject()
sdco["name"] = "servicename1"+s
sdco["type"] = "type1"+s
sdco["protocols"] = ["sdprotocol1"+s]
sdco["languages"] = ["sdlanguage1"+s]
sdco["ontologies"] = ["sdontology1"+s]
sdco["ownership"] = "agent1"+s
sdco["properties"] = spade.content.ContentObject()
sdco["properties"]["P"] = "valueP"+s
sdco["properties"]["Q"] = "valueQ"+s
co["services"] = [sdco]
return co
def testGetData(self):
co = spade.content.ContentObject()
co["test1"] = spade.content.ContentObject()
co["test1"]["test2"]= "test3"
assert co.test1.test2 == "test3"
def setUp(self):
#self.rdf = """Tony BennWikipediaTony Benn"""
self.rdf = """Tony BennWikipediaTony BennPepe"""
self.nb = xmpp.simplexml.NodeBuilder(self.rdf)
self.co = spade.content.ContentObject()
self.co.addNamespace("http://xmlns.com/foaf/0.1/","foaf:")
self.co.addNamespace("http://purl.org/dc/elements/1.1/", "dc")
self.co["rdf:Description"] = spade.content.ContentObject()
self.co["rdf:Description"]["dc:title"] = "Tony Benn"
self.co["rdf:Description"]["dc:publisher"] = "Wikipedia"
self.co["rdf:Description"]["foaf:primaryTopic"] = spade.content.ContentObject()
self.co["rdf:Description"]["foaf:primaryTopic"]["foaf:Person"] = spade.content.ContentObject()
self.co["rdf:Description"].primaryTopic.Person["foaf:name"] = ["Tony Benn", "Pepe"]
co = spade.content.ContentObject()
co["name"] = spade.AID.aid(name="aidname"+s).asContentObject()
co["lease-time"] = 1000
co["protocols"] = ["protocol1"+s,"sdprotocol1"+s]
co["ontologies"] = ["ontology1"+s,"sdontology1"+s]
co["languages"] = ["language1"+s, "sdlanguage1"+s]
co["scope"] = "scope1"+s
sdco = spade.content.ContentObject()
sdco["name"] = "servicename1"+s
sdco["type"] = "type1"+s
sdco["protocols"] = ["sdprotocol1"+s]
sdco["languages"] = ["sdlanguage1"+s]
sdco["ontologies"] = ["sdontology1"+s]
sdco["ownership"] = "agent1"+s
sdco["properties"] = spade.content.ContentObject()
sdco["properties"]["P"] = "valueP"+s
sdco["properties"]["Q"] = "valueQ"+s
co["services"] = [sdco]
return co