def test_parse_two_keys_dict_none_value(self): """ Given - json object When - the json object is None Then - raise a TypeError Exception """ with pytest.raises(TypeError): json_obj = None parse_two_keys_dict(json_obj)
def test_parse_two_keys_dict_unexpected_format(self): """ Given - json object When - the json object has unexpected format Then - raise a KeyError Exception """ with pytest.raises(KeyError): json_obj = {'not_key': ' ', 'not_val': ' '} parse_two_keys_dict(json_obj)
def test_parse_two_keys_dict_expected_format(self): """ Given - json object When - the json object has the expected format Then - return a new dictionary with correct key and value """ json_obj = {'KEY': 'a key', 'VALUE': 'a value'} res = parse_two_keys_dict(json_obj) assert res['a key'] == 'a value'