Exemple #1
0
def validate_context_type_on_association(line_extension):
    context = context_dao.get_by_extension_id(line_extension.extension_id)
    if context.type == ContextType.internal:
        validate_not_associated_to_extension(line_extension)
    elif context.type == ContextType.incall:
        validate_associated_to_user(line_extension)
    else:
        msg = "extension with a context of type '%s' cannot be associated to a line"
        raise InvalidParametersError([msg % context.type])
Exemple #2
0
    def test_given_extension_exists_then_returns_associated_context(self):
        context_row = self.add_context()
        extension_row = self.add_extension(context=context_row.name)

        expected_context = Context(name=context_row.name,
                                   display_name=context_row.displayname,
                                   type=context_row.contexttype,
                                   description=context_row.description)

        result = context_dao.get_by_extension_id(extension_row.id)

        assert_that(result, equal_to(expected_context))
Exemple #3
0
def _create_association(line_extension):
    context = context_dao.get_by_extension_id(line_extension.extension_id)
    if context.type == ContextType.internal:
        _create_internal_association(line_extension)
    elif context.type == ContextType.incall:
        _create_incall_association(line_extension)
Exemple #4
0
def _create_association(line_extension):
    context = context_dao.get_by_extension_id(line_extension.extension_id)
    if context.type == ContextType.internal:
        _create_internal_association(line_extension)
    elif context.type == ContextType.incall:
        _create_incall_association(line_extension)
Exemple #5
0
def validate_context_type_on_dissociation(line_extension):
    context = context_dao.get_by_extension_id(line_extension.extension_id)
    if context.type == ContextType.internal:
        ule_helper.validate_no_device(line_extension.line_id)