def __init__(self, **kwargs): """ Init the class with fuzzer name (command), a boolean that represent whenever the fuzzer accept arguments form stdin, otherwise specify a command line. The special keyword "@@" will be replaced with the content of argument to fuzz """ self.config = JsonFactory(kwargs) if not ["fuzzer", "stdin", "commandline"] in self.config: raise PJFMissingArgument()
def test_object_setitem(self): json = JsonFactory({"a": False}) json["a"] = True self.assertTrue(json["a"])
def test_object_representation(self): json = JsonFactory({"a": 1}) self.assertTrue(str(json) == "{'a': 1}") self.assertTrue(type(str(json)) == str)
def test_object_contains(self): json = JsonFactory({"a": 1}) self.assertTrue(["a"] in json) self.assertFalse(["A"] in json)
def test_object_equal(self): json = JsonFactory({"a": 1}) self.assertEquals(json, {"a": 1}) self.assertNotEqual(json, {"a": 0})
def test_object_addition(self): json = JsonFactory({"a": 1}) json += {"foo": True} self.assertTrue(json["foo"])
def test_object_subtraction(self): json = JsonFactory({"test": 1, "test2": {"nested": 1}}) json["test2"] = json["test2"] - ["nested"] self.assertTrue(json == {"test": 1, "test2": {}}) self.assertFalse(json == {"test": 1, "test2": {"nested": 1}})
def test_nested_object(self): self.assertTrue(JsonFactory({"t": 1, "foo": {"cow": True}}))