Beispiel #1
0
def test_list_filter_user_and_group(note, user):
    """Test that list filter with group works."""
    # No user/group filter
    assert list(Notification.list()) == [note]

    # No user/group set on notification
    assert list(Notification.list(user=user)) == [note]

    # Invalid user set on notification
    note.user = '******'
    note.group = 'test-group'
    note.save()
    assert list(Notification.list(user=user)) == []

    # Invalid group set on notification
    note.user = '******'
    note.group = 'invalid-group'
    note.save()
    assert list(Notification.list(user=user)) == []

    # Valid user and group set on notification
    note.user = '******'
    note.group = 'test-group'
    note.save()
    assert list(Notification.list(user=user)) == [note]
Beispiel #2
0
def test_list_filter_group(note, user):
    """Test that list filter with group works."""
    # Invalid group set on notification
    note.group = 'invalid-group'
    note.save()
    assert list(Notification.list(user=user)) == []

    # Valid group set on notification
    note.group = 'test-group'
    note.save()
    assert list(Notification.list(user=user)) == [note]
Beispiel #3
0
def test_list_filter_user(note, user):
    """Test that list filter with user works."""
    # Invalid user set on notification
    note.user = '******'
    note.save()
    assert list(Notification.list(user=user)) == []

    # Valid user set on notification
    note.user = '******'
    note.save()
    assert list(Notification.list(user=user)) == [note]
Beispiel #4
0
def test_list_filter_dismissed(note):
    """Test that list filter with dismissed works."""
    assert list(Notification.list(dismissed=True)) == []
    assert list(Notification.list(dismissed=False)) == [note]
    assert list(Notification.list(dismissed=None)) == [note]
    note.dismiss()
    assert list(Notification.list(dismissed=True)) == [note]
    assert list(Notification.list(dismissed=False)) == []
    assert list(Notification.list(dismissed=None)) == [note]
Beispiel #5
0
def test_list_filter_app_id(note):
    """Test that list filter with app_id works."""
    assert list(Notification.list(app_id='invalid')) == []
    assert list(Notification.list(app_id='test-app')) == [note]
    assert list(Notification.list()) == [note]
Beispiel #6
0
def test_list_filter_key(note):
    """Test that list filter with key works."""
    assert list(Notification.list(key='invalid')) == []
    assert list(Notification.list(key='test-notification')) == [note]
    assert list(Notification.list()) == [note]