Пример #1
0
 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/"))
Пример #2
0
 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)
Пример #3
0
 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/")