コード例 #1
0
ファイル: subscribers_test.py プロジェクト: bZichett/h
def test_transform_annotation(ann, nipsa, has_nipsa):
    event = FakeEvent(annotation_dict=ann)
    has_nipsa.return_value = nipsa
    subscribers.transform_annotation(event)
    if nipsa:
        assert ann["nipsa"] is True
    else:
        assert "nipsa" not in ann
コード例 #2
0
ファイル: subscribers_test.py プロジェクト: ackermann/h
def test_transform_annotation(ann, nipsa, has_nipsa):
    event = FakeEvent(annotation=ann)
    has_nipsa.return_value = nipsa
    subscribers.transform_annotation(event)
    if nipsa:
        assert ann["nipsa"] is True
    else:
        assert "nipsa" not in ann
コード例 #3
0
ファイル: subscribers_test.py プロジェクト: ssin122/test-h
def test_transform_annotation(ann, flagged, nipsa_service, pyramid_request):
    nipsa_service.is_flagged.return_value = flagged
    event = FakeEvent(request=pyramid_request, annotation_dict=ann)

    subscribers.transform_annotation(event)

    if flagged:
        assert ann["nipsa"] is True
    else:
        assert "nipsa" not in ann
コード例 #4
0
ファイル: subscribers_test.py プロジェクト: djcun95/h
def test_transform_annotation(ann, flagged, nipsa_service, pyramid_request):
    nipsa_service.is_flagged.return_value = flagged
    event = FakeEvent(request=pyramid_request,
                      annotation_dict=ann)

    subscribers.transform_annotation(event)

    if flagged:
        assert ann["nipsa"] is True
    else:
        assert "nipsa" not in ann
コード例 #5
0
ファイル: subscribers_test.py プロジェクト: chinmaygghag/h
    def test_with_moderated_annotation(self, ann, moderated, moderation_service, pyramid_request):
        moderation_service.hidden.return_value = moderated
        event = FakeEvent(request=pyramid_request,
                          annotation=ann,
                          annotation_dict=ann.data)

        subscribers.transform_annotation(event)

        if moderated:
            assert ann.data['nipsa'] is True
        else:
            assert 'nipsa' not in ann.data
コード例 #6
0
ファイル: subscribers_test.py プロジェクト: chinmaygghag/h
    def test_with_user_nipsa(self, ann, flagged, nipsa_service, pyramid_request):
        nipsa_service.is_flagged.return_value = flagged
        event = FakeEvent(request=pyramid_request,
                          annotation=ann,
                          annotation_dict=ann.data)

        subscribers.transform_annotation(event)

        if flagged:
            assert ann.data['nipsa'] is True
        else:
            assert 'nipsa' not in ann.data
コード例 #7
0
    def test_with_user_nipsa(self, ann, flagged, nipsa_service,
                             pyramid_request):
        nipsa_service.is_flagged.return_value = flagged
        event = FakeEvent(request=pyramid_request,
                          annotation=ann,
                          annotation_dict=ann.data)

        subscribers.transform_annotation(event)

        if flagged:
            assert ann.data['nipsa'] is True
        else:
            assert 'nipsa' not in ann.data
コード例 #8
0
    def test_with_moderated_annotation(self, ann, moderated,
                                       moderation_service, pyramid_request):
        moderation_service.hidden.return_value = moderated
        event = FakeEvent(request=pyramid_request,
                          annotation=ann,
                          annotation_dict=ann.data)

        subscribers.transform_annotation(event)

        if moderated:
            assert "nipsa" not in ann.data
        else:
            assert "nipsa" not in ann.data
コード例 #9
0
    def test_with_moderated_annotation(self, ann, moderated,
                                       enable_hidden_filter,
                                       moderation_service, pyramid_request):
        moderation_service.hidden.return_value = moderated
        event = FakeEvent(request=pyramid_request,
                          annotation=ann,
                          annotation_dict=ann.data)
        pyramid_request.feature.flags[
            'replace_nipsa_with_hidden_filter'] = enable_hidden_filter

        subscribers.transform_annotation(event)

        if enable_hidden_filter:
            if moderated:
                assert 'nipsa' not in ann.data
            else:
                assert 'nipsa' not in ann.data
        else:
            if moderated:
                assert ann.data['nipsa'] is True
            else:
                assert 'nipsa' not in ann.data