示例#1
0
  def test_enabled(self):
    assert CONDITIONAL.enabled == True
    assert actions.for_category('cat_1') == [BASIC, CONDITIONAL]

    CONDITIONAL.enabled = False
    assert CONDITIONAL.enabled == False
    assert actions.for_category('cat_1') == [BASIC]
示例#2
0
    def test_enabled(self):
        assert CONDITIONAL.enabled == True
        assert actions.for_category('cat_1') == [BASIC, CONDITIONAL]

        CONDITIONAL.enabled = False
        assert CONDITIONAL.enabled == False
        assert actions.for_category('cat_1') == [BASIC]
示例#3
0
def test_for_category(app_context):
    setup_actions(app_context.app)

    cat_1 = actions.for_category("cat_1")
    assert cat_1 == [BASIC, CONDITIONAL]

    cat_2 = actions.for_category("cat_2:sub")
    assert cat_2 == [OTHER_CAT]
示例#4
0
def test_for_category(app_context: AppContext) -> None:
    setup_actions(app_context.app)

    cat_1 = actions.for_category("cat_1")
    assert cat_1 == [BASIC, CONDITIONAL]

    cat_2 = actions.for_category("cat_2:sub")
    assert cat_2 == [OTHER_CAT]
示例#5
0
def test_enabled(app_context):
    setup_actions(app_context.app)

    assert CONDITIONAL.enabled
    assert actions.for_category("cat_1") == [BASIC, CONDITIONAL]

    CONDITIONAL.enabled = False
    assert not CONDITIONAL.enabled
    assert actions.for_category("cat_1") == [BASIC]
示例#6
0
def test_enabled(app_context: AppContext) -> None:
    setup_actions(app_context.app)

    assert CONDITIONAL.enabled
    assert actions.for_category("cat_1") == [BASIC, CONDITIONAL]

    CONDITIONAL.enabled = False
    assert not CONDITIONAL.enabled
    assert actions.for_category("cat_1") == [BASIC]
示例#7
0
def test_enabled(app_context: AppContext) -> None:
    setup_actions(app_context.app)

    assert CONDITIONAL.enabled
    assert actions.for_category("cat_1") == [BASIC, CONDITIONAL]

    # pyre-fixme[8]: Attribute has type `Callable[[Optional[bool]], bool]`; used as
    #  `bool`.
    CONDITIONAL.enabled = False
    assert not CONDITIONAL.enabled
    assert actions.for_category("cat_1") == [BASIC]
示例#8
0
    def content(self):
        # type: () -> Text
        actions_for_template = []

        for category in actions.actions().keys():
            available_actions = actions.for_category(category)
            for action in available_actions:
                d = {
                    "category": action.category,
                    "title": action.title,
                    "class": action.__class__.__name__,
                }
                try:
                    d["endpoint"] = text_type(action.endpoint)
                except BaseException:
                    d["endpoint"] = "<Exception>"
                try:
                    d["url"] = text_type(action.url(g.action_context))
                except BaseException:
                    d["url"] = "<Exception>"
                actions_for_template.append(d)

        actions_for_template.sort(key=lambda x: (x["category"], x["title"]))

        ctx = {"actions": actions_for_template}

        jinja_env = current_app.jinja_env
        jinja_env.filters.update(self.jinja_env.filters)
        template = jinja_env.get_or_select_template("debug_panels/actions_panel.html")
        return template.render(ctx)
示例#9
0
    def content(self):
        actions_for_template = []

        for category in actions.actions().keys():
            available_actions = actions.for_category(category)
            for action in available_actions:
                d = {
                    'category': action.category,
                    'title': action.title,
                    'class': action.__class__.__name__,
                }
                try:
                    d['endpoint'] = text_type(action.endpoint)
                except:
                    d['endpoint'] = '<Exception>'
                try:
                    d['url'] = text_type(action.url(g.action_context))
                except:
                    d['url'] = '<Exception>'
                actions_for_template.append(d)

        actions_for_template.sort(key=lambda x: (x['category'], x['title']))

        ctx = {'actions': actions_for_template}

        jinja_env = current_app.jinja_env
        jinja_env.filters.update(self.jinja_env.filters)
        template = jinja_env.get_or_select_template(
            'debug_panels/actions_panel.html')
        return template.render(ctx)
示例#10
0
    def content(self):
        # type: () -> Text
        actions_for_template = []

        for category in actions.actions().keys():
            available_actions = actions.for_category(category)
            for action in available_actions:
                d = {
                    "category": action.category,
                    "title": action.title,
                    "class": action.__class__.__name__,
                }
                try:
                    d["endpoint"] = str(action.endpoint)
                except Exception:
                    d["endpoint"] = "<Exception>"
                try:
                    d["url"] = str(action.url(g.action_context))
                except Exception:
                    d["url"] = "<Exception>"
                actions_for_template.append(d)

        actions_for_template.sort(key=lambda x: (x["category"], x["title"]))

        ctx = {"actions": actions_for_template}

        jinja_env = current_app.jinja_env
        jinja_env.filters.update(self.jinja_env.filters)
        template = jinja_env.get_or_select_template("debug_panels/actions_panel.html")
        return template.render(ctx)
示例#11
0
 def test_conditional(self):
   actions.context['show_all'] = False
   assert actions.for_category('cat_1') == [BASIC]
示例#12
0
  def test_for_category(self):
    cat_1 = actions.for_category('cat_1')
    assert cat_1 == [BASIC, CONDITIONAL]

    cat_2 = actions.for_category('cat_2:sub')
    assert cat_2 == [OTHER_CAT]
示例#13
0
def test_conditional(app_context):
    setup_actions(app_context.app)

    actions.context["show_all"] = False
    assert actions.for_category("cat_1") == [BASIC]
示例#14
0
 def test_conditional(self):
     actions.context['show_all'] = False
     assert actions.for_category('cat_1') == [BASIC]
示例#15
0
    def test_for_category(self):
        cat_1 = actions.for_category('cat_1')
        assert cat_1 == [BASIC, CONDITIONAL]

        cat_2 = actions.for_category('cat_2:sub')
        assert cat_2 == [OTHER_CAT]
示例#16
0
def test_conditional(app_context: AppContext) -> None:
    setup_actions(app_context.app)

    actions.context["show_all"] = False
    assert actions.for_category("cat_1") == [BASIC]