def test_to_dict_basic(self): """Method to test the ConfigPropertyObject class""" a = ConfigPropertyObject("propA", { "a": 2, "b": "asdf" }, { "a": "This is an A thing", "b": "This is a B thing" }) props = a.to_dict() assert props["propA"]["a"] == 2 assert props["propA"]["b"] == "asdf"
def test_adding_property_object(self): """Method to test the ConfigPropertyObject class""" cpo = ConfigPropertyObject("client", { "a": 2, "b": "asdf" }, "This is a thing") cpo.add_property_object( ConfigPropertyObject("intro", { "a": 5, "b": "fdsa" }, "This is a thing 2")) assert cpo.a == 2 assert cpo.b == "asdf" assert cpo.intro.a == 5 assert cpo.intro.b == "fdsa"
def test_helpers(self): """Method to test the ConfigPropertyObject class""" a = ConfigPropertyObject("propA", { "a": 2, "b": "asdf" }, { "a": "This is an A thing", "b": "This is a B thing" }) props = a.get_properties() assert len(props) == 2 assert "a" in props assert "b" in props assert a.get_name() == "propA" assert a.get_help_str("a") == "This is an A thing" assert a.get_help_str("b") == "This is a B thing"
def test_basic(self): """Method to test the ConfigPropertyObject class""" a = ConfigPropertyObject("propA", { "a": 2, "b": "asdf" }, { "a": "This is an A thing", "b": "This is a B thing" }) assert a.a == 2 assert a.b == "asdf"
def test_to_dict_compound(self): """Method to test the ConfigPropertyObject class""" cpo = ConfigPropertyObject("client", { "a": 2, "b": "asdf" }, "This is a thing") cpo.add_property_object( ConfigPropertyObject("intro", { "a": 5, "b": "fdsa" }, "This is a thing 2")) props = cpo.to_dict() assert props["client"]["a"] == 2 assert props["client"]["b"] == "asdf" assert props["client"]["intro"]["a"] == 5 assert props["client"]["intro"]["b"] == "fdsa"
def test_adding_property(self): """Method to test the ConfigPropertyObject class""" a = ConfigPropertyObject("propA", { "a": 2, "b": "asdf" }, { "a": "This is an A thing", "b": "This is a B thing" }) a.add_property("c", [2, 3, 4], "this is a C thing") props = a.get_properties() assert len(props) == 3 assert "a" in props assert "b" in props assert "c" in props assert a.get_help_str("a") == "This is an A thing" assert a.get_help_str("b") == "This is a B thing" assert a.get_help_str("c") == "this is a C thing" assert a.c == [2, 3, 4]