Example #1
0
def get_by_extension_id(extension_id):
    context = context_dao.find_by_extension_id(extension_id)
    if not context:
        raise ElementNotExistsError('Extension', id=extension_id)

    line_extension = _find_line_extension_by_type(context, extension_id)
    if not line_extension:
        raise LineExtensionNotExistsError.from_extension_id(extension_id)

    return line_extension
Example #2
0
def get_by_extension_id(extension_id):
    context = context_dao.find_by_extension_id(extension_id)
    if not context:
        raise ElementNotExistsError('Extension', id=extension_id)

    line_extension = _find_line_extension_by_type(context, extension_id)
    if not line_extension:
        raise LineExtensionNotExistsError.from_extension_id(extension_id)

    return line_extension
Example #3
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.find_by_extension_id(extension_row.id)

        assert_that(result, equal_to(expected_context))
Example #4
0
def find_by_extension_id(extension_id):
    context = context_dao.find_by_extension_id(extension_id)
    if not context:
        return None

    return _find_line_extension_by_type(context, extension_id)
Example #5
0
def find_by_extension_id(extension_id):
    context = context_dao.find_by_extension_id(extension_id)
    if not context:
        return None

    return _find_line_extension_by_type(context, extension_id)
Example #6
0
    def test_given_no_extension_then_returns_nothing(self):
        result = context_dao.find_by_extension_id(1)

        assert_that(result, none())