Exemple #1
0
 def test_handle_spaces(self):
     """
         Assert that unnecessary spaces will be removed and all
         other spaces correctly substituted.
     """
     assert (clean_url('   /hello you/wonderful/person ') ==
             '/hello_you/wonderful/person')
Exemple #2
0
    def test_clean_simple_url(self):
        """
            Assert a simple URL remains unchanged.
        """
        simple_url = '/test'

        assert clean_url(simple_url) == simple_url
Exemple #3
0
    def test_clean_deep_url(self):
        """
            Assert a deep URL remains unchanged.
        """
        deep_url = '/test/two/three/yo'

        assert clean_url(deep_url) == deep_url
Exemple #4
0
 def test_handle_spaces(self):
     """
         Assert that unnecessary spaces will be removed and all
         other spaces correctly substituted.
     """
     assert (clean_url('   /hello you/wonderful/person ')
                 == '/hello_you/wonderful/person')
Exemple #5
0
    def test_clean_deep_url(self):
        """
            Assert a deep URL remains unchanged.
        """
        deep_url = '/test/two/three/yo'

        assert clean_url(deep_url) == deep_url
Exemple #6
0
    def test_clean_simple_url(self):
        """
            Assert a simple URL remains unchanged.
        """
        simple_url = '/test'

        assert clean_url(simple_url) == simple_url
Exemple #7
0
 def validate_url(form, field):
     sanitized_url = clean_url(field.data)
     system_urls_lead_parts = get_app_routes_leading_elements()
     # Disallow create already used urls.
     # NOTE I'm not sure whether Windows slashes do not need to be
     # sanitized later. At least space to underscore is necessary to check
     # now - or maybe in the Wiki object itself.
     # Leading url part (before slash) must not equals to system urls
     # leading parts (/create/, /edit/ and so on).
     if (current_wiki.exists(sanitized_url)
             or sanitized_url.split('/')[0] in system_urls_lead_parts):
         raise ValidationError('The URL "%s" exists already.' %
                               sanitized_url)
Exemple #8
0
 def clean_url(self, url):
     return clean_url(url)
Exemple #9
0
 def test_handle_uppercase(self):
     """
         Assert that uppercase characters will be substituted.
     """
     assert clean_url("HELLo") == "hello"
Exemple #10
0
 def clean_url(self, url):
     return clean_url(url)
Exemple #11
0
 def test_handle_uppercase(self):
     """
         Assert that uppercase characters will be substituted.
     """
     assert clean_url("HELLo") == "hello"