def test_getservice(self): # test bundle empty self.assertRaises(BundleError, BundleParser, self.empty) # test bundle no service section bundle = BundleParser(self.noservice) self.assertRaises(BundleError, bundle.getservice, "fake") # test bundle service not found bundle = BundleParser(self.correct) self.assertRaises(BundleError, bundle.getservice, "fake") # test bundle service exists self.assertIsNotNone(bundle.getservice("mysql"))
def test_setservicename(self): # unknown service change requested bundle = BundleParser(self.correct) self.assertRaises(BundleError, bundle.setservicename, "fake", "even_more") # test name correctly changed bundle.setservicename("mysql", "database") # check service exists self.assertIsNotNone(bundle.getservice("database")) # check relation changed and : not affected # check : found = [True for relation in bundle.getrelations() if "database:db" in relation] self.assertTrue(found) # check without : found = [True for relation in bundle.getrelations() if "database" in relation] self.assertTrue(found)