(self)
| 81 | assert response == self.expected(base_url) |
| 82 | |
| 83 | def testNode(self): |
| 84 | requester = self.g._Github__requester |
| 85 | headers, data = requester.graphql_node("D_kwDOADYVqs4ATJZD", "title", "Discussion") |
| 86 | self.assertTrue(headers) |
| 87 | self.assertEqual( |
| 88 | data.get("data", {}).get("node", {}).get("title"), |
| 89 | "Is there a way to search if a string present in default branch?", |
| 90 | ) |
| 91 | |
| 92 | # non-existing node should throw a NOT FOUND exception |
| 93 | with self.assertRaises(github.UnknownObjectException) as e: |
| 94 | requester.graphql_node("D_abcdefgh", "title", "Discussion") |
| 95 | self.assertEqual(e.exception.status, 404) |
| 96 | self.assertEqual( |
| 97 | e.exception.data, |
| 98 | { |
| 99 | "data": {"node": None}, |
| 100 | "errors": [ |
| 101 | { |
| 102 | "type": "NOT_FOUND", |
| 103 | "path": ["node"], |
| 104 | "locations": [{"line": 3, "column": 15}], |
| 105 | "message": "Could not resolve to a node with the global id of 'D_abcdefgh'", |
| 106 | } |
| 107 | ], |
| 108 | }, |
| 109 | ) |
| 110 | self.assertEqual(e.exception.message, "Could not resolve to a node with the global id of 'D_abcdefgh'") |
| 111 | |
| 112 | # wrong type should throw an exception |
| 113 | with self.assertRaises(github.GithubException) as e: |
| 114 | requester.graphql_node("D_kwDOADYVqs4ATJZD", "login", "User") |
| 115 | self.assertEqual(e.exception.message, "Retrieved User object is of different type: Discussion") |
| 116 | self.assertEqual(e.exception.status, 400) |
| 117 | self.assertEqual(e.exception.data, {"data": {"node": {"__typename": "Discussion"}}}) |
| 118 | |
| 119 | def testNodeClass(self): |
| 120 | requester = self.g._Github__requester |
nothing calls this directly
no test coverage detected