Esempio n. 1
0
 def test_generate_url_path_not_allow_errors(self):
     try:
         generate_url_path("/path/to/{id}/{lang}/{format}/",
                           format_suffix='json',
                           lang='es',
                           allow_key_errors=False)
         self.assertTrue(False)
     except KeyError:
         pass
Esempio n. 2
0
 def test_generate_url_path_format_suffix(self):
     url_path = generate_url_path("/path/to/{id}/{lang}/{format}/", format_suffix='json', lang='es')
     self.assertEqual("/path/to/{id}/es/{format}/.json", url_path)
Esempio n. 3
0
 def test_generate_url_path_multiples_missing_param(self):
     url_path = generate_url_path("/path/to/{id}/{lang}/{format}/", lang='es')
     self.assertEqual("/path/to/{id}/es/{format}/", url_path)
Esempio n. 4
0
 def test_generate_url_path_extra_param(self):
     url_path = generate_url_path("/path/to/{lang}/", lang='es', invented='hello')
     self.assertEqual("/path/to/es/", url_path)
Esempio n. 5
0
 def test_generate_url_path_with_multiple_params(self):
     url_path = generate_url_path("/path/to/{id}/{lang}/", id=1, lang='es')
     self.assertEqual("/path/to/1/es/", url_path)
Esempio n. 6
0
 def test_generate_url_path_with_prefix(self):
     url_path = generate_url_path("/path/to/{id}/", prefix="/example", id=1)
     self.assertEqual("/example/path/to/1/", url_path)
Esempio n. 7
0
 def test_generate_url_path_format_suffix(self):
     url_path = generate_url_path("/path/to/{id}/{lang}/{format}/",
                                  format_suffix='json',
                                  lang='es')
     self.assertEqual("/path/to/{id}/es/{format}/.json", url_path)
Esempio n. 8
0
 def test_generate_url_path_multiples_missing_param(self):
     url_path = generate_url_path("/path/to/{id}/{lang}/{format}/",
                                  lang='es')
     self.assertEqual("/path/to/{id}/es/{format}/", url_path)
Esempio n. 9
0
 def test_generate_url_path_extra_param(self):
     url_path = generate_url_path("/path/to/{lang}/",
                                  lang='es',
                                  invented='hello')
     self.assertEqual("/path/to/es/", url_path)
Esempio n. 10
0
 def test_generate_url_path_with_multiple_params(self):
     url_path = generate_url_path("/path/to/{id}/{lang}/", id=1, lang='es')
     self.assertEqual("/path/to/1/es/", url_path)
Esempio n. 11
0
 def test_generate_url_path_with_prefix(self):
     url_path = generate_url_path("/path/to/{id}/", prefix="/example", id=1)
     self.assertEqual("/example/path/to/1/", url_path)