def test_01_createBundle(self): enum_bundle = EnumBundle() enum_bundle.name = "TestEnumBundle" enum_bundle.values = [] value_names = ["first", "second", "third"] for vn in value_names : element = EnumField() element.name = vn element.description = vn + " description" enum_bundle.values.append(element) response = self.con.createBundle(enum_bundle) self.assertTrue(response.find("http://unit-258.labs.intellij.net:8080/charisma/rest/admin/customfield/bundle/" + enum_bundle.name) != -1)
def test_05_addDeleteValue(self): enum_bundle = self.con.getBundle("enum", "TestEnumBundleNew") value = EnumField() value.name = "Added" value.description = "description" self.con.addValueToBundle(enum_bundle, value) enum_bundle = self.con.getBundle("enum", "TestEnumBundleNew") self.assertEquals(len(enum_bundle.values), 4) new_value = "" for v in enum_bundle.values: if v.name == "Added": new_value = v self.assertEquals(new_value.description, "description") self.con.removeValueFromBundle(enum_bundle, new_value) enum_bundle = self.con.getBundle("enum", "TestEnumBundleNew") self.assertFalse("Added" in [elem.name for elem in enum_bundle.values])
def test_05_addDeleteValue(self): enum_bundle = self.con.getBundle("enum", "TestEnumBundleNew") value = EnumField() value.name = "Added" value.description = "description" self.con.addValueToBundle(enum_bundle, value) enum_bundle = self.con.getBundle("enum", "TestEnumBundleNew") self.assertEquals(len(enum_bundle.values), 4) new_value = "" for v in enum_bundle.values : if v.name == "Added" : new_value = v self.assertEquals(new_value.description, "description") self.con.removeValueFromBundle(enum_bundle, new_value) enum_bundle = self.con.getBundle("enum", "TestEnumBundleNew") self.assertFalse("Added" in [elem.name for elem in enum_bundle.values])