Skip to content
Snippets Groups Projects
Select Git revision
  • bfcdcf2fa2bb2eabfaff7cf0b540853ff79d3eb3
  • master default protected
  • dependabot/pip/py-1.10.0
  • dependabot/pip/django-2.2.13
  • dependabot/pip/bleach-3.1.4
5 results

snap_test_search_reports.py

Blame
  • snap_test_search_reports.py 8.50 KiB
    # -*- coding: utf-8 -*-
    # snapshottest: v1 - https://goo.gl/zC4yUc
    from __future__ import unicode_literals
    
    from snapshottest import Snapshot
    
    
    snapshots = Snapshot()
    
    snapshots['test_all 1'] = {
        'data': {
            'searchReports': {
                'edges': [
                    {
                        'cursor': 'MQ==',
                        'node': {
                            'author': {
                                'extra': None,
                                'firstName': 'Spongebob',
                                'id': 'QXV0aG9yOjI=',
                                'lastName': 'Squarepants'
                            },
                            'body': 'Another long story.',
                            'date': '2018-01-05 00:00:00+00:00',
                            'extra': '{"rings": 1}',
                            'id': 'UmVwb3J0OjI=',
                            'otherParticipants': 'Saruman, Sauron',
                            'ourParticipants': 'Frodo, Gimli, Legolas',
                            'providedBenefit': '',
                            'published': '2018-01-10 00:00:00+00:00',
                            'receivedBenefit': 'Mithrill Jacket',
                            'title': 'The Two Towers'
                        }
                    },
                    {
                        'cursor': 'Mg==',
                        'node': {
                            'author': {
                                'extra': None,
                                'firstName': 'Winston',
                                'id': 'QXV0aG9yOjE=',
                                'lastName': 'Wolfe'
                            },
                            'body': 'Aragorn is the King. And we have lost the Ring.',
                            'date': '2018-01-07 00:00:00+00:00',
                            'extra': None,
                            'id': 'UmVwb3J0OjM=',
                            'otherParticipants': 'Sauron',
                            'ourParticipants': 'Aragorn',
                            'providedBenefit': 'The Ring',
                            'published': '2018-01-08 00:00:00+00:00',
                            'receivedBenefit': '',
                            'title': 'The Return of the King'
                        }
                    },
                    {
                        'cursor': 'Mw==',
                        'node': {
                            'author': {
                                'extra': None,
                                'firstName': 'Winston',
                                'id': 'QXV0aG9yOjE=',
                                'lastName': 'Wolfe'
                            },
                            'body': 'Long story short: we got the Ring!',
                            'date': '2018-01-01 00:00:00+00:00',
                            'extra': None,
                            'id': 'UmVwb3J0OjE=',
                            'otherParticipants': 'Saruman',
                            'ourParticipants': 'Frodo, Gandalf',
                            'providedBenefit': '',
                            'published': '2018-01-02 00:00:00+00:00',
                            'receivedBenefit': 'The Ring',
                            'title': 'The Fellowship of the Ring'
                        }
                    }
                ],
                'pageInfo': {
                    'endCursor': 'Mw==',
                    'hasNextPage': False,
                    'hasPreviousPage': False,
                    'startCursor': 'MQ=='
                },
                'totalCount': 3
            }
        }
    }
    
    snapshots['test_query 1'] = {
        'data': {
            'searchReports': {
                'edges': [
                    {
                        'cursor': 'MQ==',
                        'node': {
                            'author': {
                                'extra': None,
                                'firstName': 'Spongebob',
                                'id': 'QXV0aG9yOjI=',
                                'lastName': 'Squarepants'
                            },
                            'body': 'Another long story.',
                            'date': '2018-01-05 00:00:00+00:00',
                            'extra': '{"rings": 1}',
                            'id': 'UmVwb3J0OjI=',
                            'otherParticipants': 'Saruman, Sauron',
                            'ourParticipants': 'Frodo, Gimli, Legolas',
                            'providedBenefit': '',
                            'published': '2018-01-10 00:00:00+00:00',
                            'receivedBenefit': 'Mithrill Jacket',
                            'title': 'The Two Towers'
                        }
                    }
                ],
                'totalCount': 1
            }
        }
    }
    
    snapshots['test_highlight 1'] = {
        'data': {
            'searchReports': {
                'edges': [
                    {
                        'cursor': 'MQ==',
                        'node': {
                            'author': {
                                'extra': None,
                                'firstName': 'Winston',
                                'id': 'QXV0aG9yOjE=',
                                'lastName': 'Wolfe'
                            },
                            'body': 'Aragorn is the King. And we have lost the <mark>Ring</mark>.',
                            'date': '2018-01-07 00:00:00+00:00',
                            'extra': None,
                            'id': 'UmVwb3J0OjM=',
                            'otherParticipants': 'Sauron',
                            'ourParticipants': 'Aragorn',
                            'providedBenefit': 'The <mark>Ring</mark>',
                            'published': '2018-01-08 00:00:00+00:00',
                            'receivedBenefit': '',
                            'title': 'The Return of the King'
                        }
                    },
                    {
                        'cursor': 'Mg==',
                        'node': {
                            'author': {
                                'extra': None,
                                'firstName': 'Winston',
                                'id': 'QXV0aG9yOjE=',
                                'lastName': 'Wolfe'
                            },
                            'body': 'Long story short: we got the <mark>Ring</mark>!',
                            'date': '2018-01-01 00:00:00+00:00',
                            'extra': None,
                            'id': 'UmVwb3J0OjE=',
                            'otherParticipants': 'Saruman',
                            'ourParticipants': 'Frodo, Gandalf',
                            'providedBenefit': '',
                            'published': '2018-01-02 00:00:00+00:00',
                            'receivedBenefit': 'The <mark>Ring</mark>',
                            'title': 'The Fellowship of the <mark>Ring</mark>'
                        }
                    }
                ],
                'totalCount': 2
            }
        }
    }
    
    snapshots['test_first 1'] = {
        'data': {
            'searchReports': {
                'edges': [
                    {
                        'cursor': 'MQ==',
                        'node': {
                            'id': 'UmVwb3J0OjI=',
                            'title': 'The Two Towers'
                        }
                    }
                ],
                'pageInfo': {
                    'endCursor': 'MQ==',
                    'hasNextPage': True,
                    'hasPreviousPage': False,
                    'startCursor': 'MQ=='
                },
                'totalCount': 3
            }
        }
    }
    
    snapshots['test_first_after 1'] = {
        'data': {
            'searchReports': {
                'edges': [
                    {
                        'cursor': 'Mg==',
                        'node': {
                            'id': 'UmVwb3J0OjM=',
                            'title': 'The Return of the King'
                        }
                    }
                ],
                'pageInfo': {
                    'endCursor': 'Mg==',
                    'hasNextPage': True,
                    'hasPreviousPage': True,
                    'startCursor': 'Mg=='
                },
                'totalCount': 3
            }
        }
    }
    
    snapshots['test_last 1'] = {
        'data': {
            'searchReports': None
        },
        'errors': [
            {
                'locations': [
                    {
                        'column': 9,
                        'line': 3
                    }
                ],
                'message': 'Pagination "last" works only in combination with "before" argument.'
            }
        ]
    }
    
    snapshots['test_last_before 1'] = {
        'data': {
            'searchReports': {
                'edges': [
                    {
                        'cursor': 'Mg==',
                        'node': {
                            'id': 'UmVwb3J0OjM=',
                            'title': 'The Return of the King'
                        }
                    }
                ],
                'pageInfo': {
                    'endCursor': 'Mg==',
                    'hasNextPage': True,
                    'hasPreviousPage': True,
                    'startCursor': 'Mg=='
                },
                'totalCount': 3
            }
        }
    }