Exemple #1
0
def test_reply_to_other():
    """Send reply notification when somebody replies to you"""
    annotation = {"permissions": {"read": ["group:__world__"]}, "user": "******"}

    request = DummyRequest()
    with patch("h.notifier.parent_values") as mock_parent_fn:
        mock_parent_fn.return_value = {"user": "******"}
        annotation["parent"] = notifier.parent_values(annotation, request)
        actual = notifier.ReplyTemplate.check_conditions(annotation, {})
        assert actual is True
Exemple #2
0
def test_reply_to_self():
    """Don't send reply notification to yourself"""
    annotation = {"permissions": {"read": ["group:__world__"]}, "user": "******"}

    request = DummyRequest()
    with patch("h.notifier.parent_values") as mock_parent_fn:
        mock_parent_fn.return_value = {"user": "******"}
        annotation["parent"] = notifier.parent_values(annotation, request)
        actual = notifier.ReplyTemplate.check_conditions(annotation, {})
        assert actual is False
Exemple #3
0
def test_reply_to_other():
    """Send reply notification when somebody replies to you"""
    annotation = {
        'permissions': {
            'read': ['group:__world__']
        },
        'user': '******'
    }

    request = DummyRequest()
    with patch('h.notifier.parent_values') as mock_parent_fn:
        mock_parent_fn.return_value = {'user': '******'}
        annotation['parent'] = notifier.parent_values(annotation, request)
        actual = notifier.ReplyTemplate.check_conditions(annotation, {})
        assert actual is True
Exemple #4
0
def test_reply_to_self():
    """Don't send reply notification to yourself"""
    annotation = {
        'permissions': {
            'read': ['group:__world__']
        },
        'user': '******'
    }

    request = DummyRequest()
    with patch('h.notifier.parent_values') as mock_parent_fn:
        mock_parent_fn.return_value = {'user': '******'}
        annotation['parent'] = notifier.parent_values(annotation, request)
        actual = notifier.ReplyTemplate.check_conditions(annotation, {})
        assert actual is False