Exemple #1
0
    def test_sanitary_should_return_url(self):
        """
        Verify that dashes and / are considered sanitary characters
        :return:
        """
        url = "this-is-a-valid-name"
        self.assertEqual(url, go.sanitary(url))

        url = "this-is-a-valid-name/"
        self.assertEqual(url, go.sanitary(url))
Exemple #2
0
    def test_sanitary_should_return_url(self):
        """
        Verify that dashes and / are considered sanitary characters
        :return:
        """
        url = "this-is-a-valid-name"
        self.assertEqual(url, go.sanitary(url))

        url = "this-is-a-valid-name/"
        self.assertEqual(url, go.sanitary(url))
Exemple #3
0
    def test_sanitary_should_return_None(self):
        """
        Verify that underscores are marked as unsanitary charachters
        :return:
        """
        # While in theory underscores are fine, we block them as unsanitary
        url = "this_is_an_invalid_name"
        self.assertEqual(None, go.sanitary(url))

        # There's a branch that specifically checks the last character is valid or /
        url = "this-is-an-invalid-name_"
        self.assertEqual(None, go.sanitary(url))
Exemple #4
0
    def test_sanitary_should_return_None(self):
        """
        Verify that underscores are marked as unsanitary charachters
        :return:
        """
        # While in theory underscores are fine, we block them as unsanitary
        url = "this_is_an_invalid_name"
        self.assertEqual(None, go.sanitary(url))

        # There's a branch that specifically checks the last character is valid or /
        url = "this-is-an-invalid-name_"
        self.assertEqual(None, go.sanitary(url))