示例#1
0
    def test_get_reachable_context_loop(self):
        context = "my_context"
        included_context = "second_ctx"
        looping_context = "third_ctx"

        ctx = ContextInclude()
        ctx.context = context
        ctx.include = included_context

        ctx_include = ContextInclude()
        ctx_include.context = included_context
        ctx_include.include = looping_context

        ctx_loop = ContextInclude()
        ctx_loop.context = looping_context
        ctx_loop.include = context

        map(self.add_me, [ctx, ctx_include, ctx_loop])

        user_line = self.add_user_line_with_exten(context=context)

        result = user_dao.get_reachable_contexts(user_line.user.id)

        for context in [context, included_context, looping_context]:
            self.assertTrue(context in result)
示例#2
0
    def test_get_reachable_context_loop(self):
        context = 'my_context'
        included_context = 'second_ctx'
        looping_context = 'third_ctx'

        ctx = ContextInclude()
        ctx.context = context
        ctx.include = included_context

        ctx_include = ContextInclude()
        ctx_include.context = included_context
        ctx_include.include = looping_context

        ctx_loop = ContextInclude()
        ctx_loop.context = looping_context
        ctx_loop.include = context

        map(self.add_me, [ctx, ctx_include, ctx_loop])

        user_line = self.add_user_line_with_exten(context=context)

        result = user_dao.get_reachable_contexts(user_line.user.id)

        for context in [context, included_context, looping_context]:
            self.assertTrue(context in result)
示例#3
0
    def test_get_reachable_context_included_ctx(self):
        context = "my_context"
        included_context = "second_ctx"

        ctx_include = ContextInclude()
        ctx_include.context = context
        ctx_include.include = included_context

        self.add_me(ctx_include)

        user_line = self.add_user_line_with_exten(context=context)

        result = user_dao.get_reachable_contexts(user_line.user.id)

        self.assertEqual(result, [context, included_context])
示例#4
0
    def test_get_reachable_context_included_ctx(self):
        context = 'my_context'
        included_context = 'second_ctx'

        ctx_include = ContextInclude()
        ctx_include.context = context
        ctx_include.include = included_context

        self.add_me(ctx_include)

        user_line = self.add_user_line_with_exten(context=context)

        result = user_dao.get_reachable_contexts(user_line.user.id)

        self.assertEqual(result, [context, included_context])
示例#5
0
    def test_get_reachable_context_included_ctx(self):
        context = 'my_context'
        included_context = 'second_ctx'

        ctx_include = ContextInclude()
        ctx_include.context = context
        ctx_include.include = included_context

        self.add_me(ctx_include)

        user_line = self.add_user_line_with_exten(context=context)

        result = user_dao.get_reachable_contexts(user_line.user.id)

        assert_that(result, contains_inanyorder(context, included_context))