File size: 1,457 Bytes
2b06d1d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
from graphene.test import Client

from ..data import setup
from ..schema import schema

setup()

client = Client(schema)


def test_str_schema(snapshot):
    snapshot.assert_match(str(schema).strip())


def test_correctly_fetches_id_name_rebels(snapshot):
    query = """
      query RebelsQuery {
        rebels {
          id
          name
        }
      }
    """
    snapshot.assert_match(client.execute(query))


def test_correctly_refetches_rebels(snapshot):
    query = """
      query RebelsRefetchQuery {
        node(id: "RmFjdGlvbjox") {
          id
          ... on Faction {
            name
          }
        }
      }
    """
    snapshot.assert_match(client.execute(query))


def test_correctly_fetches_id_name_empire(snapshot):
    query = """
      query EmpireQuery {
        empire {
          id
          name
        }
      }
    """
    snapshot.assert_match(client.execute(query))


def test_correctly_refetches_empire(snapshot):
    query = """
      query EmpireRefetchQuery {
        node(id: "RmFjdGlvbjoy") {
          id
          ... on Faction {
            name
          }
        }
      }
    """
    snapshot.assert_match(client.execute(query))


def test_correctly_refetches_xwing(snapshot):
    query = """
      query XWingRefetchQuery {
        node(id: "U2hpcDox") {
          id
          ... on Ship {
            name
          }
        }
      }
    """
    snapshot.assert_match(client.execute(query))