Exemple #1
0
 def test_band_by_name_not_superuser(self):
     client = graphQLClient(schema)
     self.context_value.user = self.joeuser
     executed = client.execute("""{ bandByName(name:"test band") {
         name,
         hometown
         } }""",
                               context_value=self.context_value)
     assert "errors" in executed
Exemple #2
0
    def test_all_bands_not_superuser(self):
        client = graphQLClient(schema)
        self.context_value.user = self.joeuser

        executed = client.execute("""{ allBands {
                    band {
                        name,
                        hometown
                    }
                } }""",
                                  context_value=self.context_value)
        assert executed == {"data": {'allBands': []}}
Exemple #3
0
 def test_band_by_name_superuser(self):
     client = graphQLClient(schema)
     self.context_value.user = self.super
     executed = client.execute("""{ bandByName(name:"test band") {
         name,
         hometown
         } }""",
                               context_value=self.context_value)
     assert executed == {
         "data": {
             "bandByName": {
                 "name": "test band",
                 "hometown": "Seattle"
             }
         }
     }
Exemple #4
0
    def test_all_bands_superuser(self):
        client = graphQLClient(schema)
        self.context_value.user = self.super

        executed = client.execute("""{ allBands {
                    band {
                        name,
                        hometown
                    }
                } }""",
                                  context_value=self.context_value)

        assert executed == {
            "data": {
                'allBands': [{
                    'band': {
                        'name': 'test band',
                        'hometown': 'Seattle'
                    }
                }]
            }
        }