コード例 #1
0
ファイル: test_validator.py プロジェクト: jaunis/xivo-dao
    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))
コード例 #2
0
    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))
コード例 #3
0
ファイル: validator.py プロジェクト: jlebleu/xivo-dao
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')
コード例 #4
0
ファイル: validator.py プロジェクト: jaunis/xivo-dao
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)
コード例 #5
0
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)