def test_parse_and_serialize(self): inputs = [ '{"username": "******", "password": "******"}', '{"password": "******", "username": "******"}', ] for json_input in inputs: _dict = parameters.DictParameter()._p.parse_from_str(json_input) assert json.loads(json_input) == _dict
def test_parse_invalid_input(self): with pytest.raises(ValueError): parameters.DictParameter()._p.parse_from_str('{"invalid"}')
def test_parse(self): d = parameters.DictParameter()._p.parse_from_str( json.dumps(TestDictParameter._dict)) assert d == TestDictParameter._dict
class DictParameterTask(TTask): param = parameters.DictParameter()