def test_is_existing_context(self, mock_find): expected_return = mock_find.return_value = Mock() result = validator.is_existing_context("abcd") mock_find.assert_called_once_with("abcd") assert_that(result, same_instance(expected_return))
def test_is_existing_context(self, mock_find): expected_return = mock_find.return_value = Mock() result = validator.is_existing_context('abcd') mock_find.assert_called_once_with('abcd') assert_that(result, same_instance(expected_return))
def _check_parameter_references(voicemail): if not validator.is_existing_context(voicemail.context): raise errors.param_not_found('context', 'Context') if voicemail.language is not None and voicemail.language not in language_dao.find_all(): raise errors.param_not_found('language', 'Language') if voicemail.timezone is not None and voicemail.timezone not in voicemail_dao.find_all_timezone(): raise errors.param_not_found('timezone', 'Timezone')
def _check_nonexistent_parameters(voicemail): nonexistent_parameters = {} if not validator.is_existing_context(voicemail.context): nonexistent_parameters["context"] = voicemail.context if voicemail.language is not None and voicemail.language not in language_dao.find_all(): nonexistent_parameters["language"] = voicemail.language if voicemail.timezone is not None and voicemail.timezone not in voicemail_dao.find_all_timezone(): nonexistent_parameters["timezone"] = voicemail.timezone if nonexistent_parameters: raise NonexistentParametersError(**nonexistent_parameters)
def _check_nonexistent_parameters(voicemail): nonexistent_parameters = {} if not validator.is_existing_context(voicemail.context): nonexistent_parameters['context'] = voicemail.context if voicemail.language is not None and voicemail.language not in language_dao.find_all(): nonexistent_parameters['language'] = voicemail.language if voicemail.timezone is not None and voicemail.timezone not in voicemail_dao.find_all_timezone(): nonexistent_parameters['timezone'] = voicemail.timezone if nonexistent_parameters: raise NonexistentParametersError(**nonexistent_parameters)