def test_validate_json_fails(self): url = URL({"url": "posts/"}) with captured_stdout() as s: url.validate_json({ "url": "posts/", "gets": { "#meta": "oauth2,optional", "response": { "200+": "$postResponse" } } }) self.assertEqual(s.getvalue().rstrip("\n"), colorize_string("yellow", "Found unsupported attribute, gets, for url: posts/"))
def test_init_url(self): url = URL({ "url": "posts/", "get": { "#meta": "oauth2,optional", "response": { "200+": "$postResponse" } } }) self.assertEqual(url.url_path, "posts/") self.assertIsNone(url.documentation) self.assertIsNone(url.post) self.assertIsNotNone(url.get)
def test_parse_apis(self): url = URL({"url": "posts/"}) self.assertIsNone(url.get) url.parse_apis({ "url": "posts/", "get": { "#meta": "oauth2,optional", "response": { "200+": "$postResponse" } } }) self.assertIsNotNone(url.get) self.assertEqual(url.get.url_path, "posts/")