Пример #1
0
    def test_get_by_number_context(self, user_dao_get):
        number, context = '9876', 'default'
        user_id = 123
        expected_result = User(id=user_id)
        user_dao_get.return_value = User(id=user_id)

        result = user_services.get_by_number_context(number, context)

        user_dao_get.assert_called_once_with(number, context)
        assert_that(result, equal_to(expected_result))
Пример #2
0
    def test_get_by_number_context(self, user_dao_get):
        number, context = '9876', 'default'
        user_id = 123
        expected_result = User(id=user_id)
        user_dao_get.return_value = User(id=user_id)

        result = user_services.get_by_number_context(number, context)

        user_dao_get.assert_called_once_with(number, context)
        assert_that(result, equal_to(expected_result))
Пример #3
0
def get_by_exten_context(exten, context):
    try:
        user = user_services.get_by_number_context(exten, context)
    except ElementNotExistsError:
        return None
    return user
Пример #4
0
def get_by_exten_context(exten, context):
    try:
        user = user_services.get_by_number_context(exten, context)
    except NotFoundError:
        return None
    return user
Пример #5
0
def get_by_exten_context(exten, context):
    try:
        user = user_services.get_by_number_context(exten, context)
    except ElementNotExistsError:
        return None
    return user