def test_dict_contains_contains_call(mocker): dct_contains = {'test_key': 'test_value'} keys_list_dct_contains = ['test_key'] utils.dict_contains(dct_contains, keys_list_dct_contains) mocker.assert_called_once_with(dct_contains.keys(), keys_list_dct_contains)
def _validate_model_config(req, resp, resource, params): """ :param resp: :param resource: :param params: :return: """ doc = req.params mandatory_fields = ["data"] assert dict_contains(doc, mandatory_fields) is True, Predict._bad_request()
def _validate_model_config(req, resp, resource, params): """ :param resp: :param resource: :param params: :return: """ doc = req.context['doc'] mandatory_fields = ['service_id'] assert dict_contains(doc, mandatory_fields) is True, Status._bad_request()
def test_dict_contains_not_types_keys(): try: utils.dict_contains({}, 1.2) except AssertionError as exc: assert str( exc) == "dict_contains: keys should be of type list or string "
def test_dict_contains_not_dict(): try: utils.dict_contains([], []) except AssertionError as exc: assert str(exc) == "dict_contains: dct should be of type dict "