Skip to content
Snippets Groups Projects
Select Git revision
  • aac6d1d3cb6ab603ac90ef62253fe11ace92db8a
  • master default protected
  • feat/new-image-formats
  • clickable-select-chevron
  • 2.20.0
  • 2.19.0
  • 2.18.0
  • 2.17.0
  • 2.16.1
  • 2.16.0
  • 2.15.0
  • 2.14.0
  • 2.13.0
  • 2.12.1
  • 2.11.0
  • 2.10.0
  • 2.9.1
  • 2.9.0
  • 2.8.0
  • 2.7.1
  • 2.7.0
  • 2.6.0
  • 2.5.2
  • 2.5.1
24 results

loading-button.mustache

Blame
  • test_authors.py 3.13 KiB
    import pytest
    
    from openlobby.core.models import User
    
    
    pytestmark = pytest.mark.django_db
    
    
    @pytest.fixture(autouse=True)
    def setup():
        User.objects.create(id=1, is_author=True, username='a', openid_uid='first',
            first_name='Winston', last_name='Wolfe', extra={'x': 1})
        User.objects.create(id=2, is_author=False, username='b')
        User.objects.create(id=3, is_author=True, username='c', openid_uid='second',
            first_name='Captain', last_name='Obvious')
        User.objects.create(id=4, is_author=True, username='d', openid_uid='third',
            first_name='Shaun', last_name='Sheep')
        yield
    
    
    def test_all(client, snapshot):
        res = client.post('/graphql', {'query': """
        query {
            authors {
                totalCount
                edges {
                    cursor
                    node {
                        id
                        firstName
                        lastName
                        openidUid
                        extra
                    }
                }
                pageInfo {
                    hasPreviousPage
                    hasNextPage
                    startCursor
                    endCursor
                }
            }
        }
        """})
        snapshot.assert_match(res.json())
    
    
    def test_first(client, snapshot):
        res = client.post('/graphql', {'query': """
        query {
            authors (first: 2) {
                totalCount
                edges {
                    cursor
                    node {
                        openidUid
                    }
                }
                pageInfo {
                    hasPreviousPage
                    hasNextPage
                    startCursor
                    endCursor
                }
            }
        }
        """})
        snapshot.assert_match(res.json())
    
    
    def test_first_after(client, snapshot):
        res = client.post('/graphql', {'query': """
        query {
            authors (first: 1, after: "MQ==") {
                totalCount
                edges {
                    cursor
                    node {
                        openidUid
                    }
                }
                pageInfo {
                    hasPreviousPage
                    hasNextPage
                    startCursor
                    endCursor
                }
            }
        }
        """})
        snapshot.assert_match(res.json())
    
    
    def test_last(client, snapshot):
        res = client.post('/graphql', {'query': """
        query {
            authors (last: 2) {
                totalCount
                edges {
                    cursor
                    node {
                        openidUid
                    }
                }
                pageInfo {
                    hasPreviousPage
                    hasNextPage
                    startCursor
                    endCursor
                }
            }
        }
        """})
        snapshot.assert_match(res.json())
    
    
    def test_last_before(client, snapshot):
        res = client.post('/graphql', {'query': """
        query {
            authors (last: 1, before: "Mw==") {
                totalCount
                edges {
                    cursor
                    node {
                        openidUid
                    }
                }
                pageInfo {
                    hasPreviousPage
                    hasNextPage
                    startCursor
                    endCursor
                }
            }
        }
        """})
        snapshot.assert_match(res.json())