diff options
author | Zuul <zuul@review.opendev.org> | 2022-09-16 02:30:54 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-09-16 02:30:54 +0000 |
commit | df06873242f35e33dd873cd7076914cea1cf4058 (patch) | |
tree | be8aa1d1ee8939bcc3623d4d43ee20bf7811966b /trove/tests/unittests/common/test_utils.py | |
parent | b1bbc7d8d2d7dbbf4ae4b58493ba767bca58da70 (diff) | |
parent | 08e960d1296a34052e9335d3111707f3af81695d (diff) | |
download | trove-df06873242f35e33dd873cd7076914cea1cf4058.tar.gz |
Merge "Fix illegal shell characters" into stable/yogastable/yoga
Diffstat (limited to 'trove/tests/unittests/common/test_utils.py')
-rw-r--r-- | trove/tests/unittests/common/test_utils.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/trove/tests/unittests/common/test_utils.py b/trove/tests/unittests/common/test_utils.py index 4f31d08b..e8a3600e 100644 --- a/trove/tests/unittests/common/test_utils.py +++ b/trove/tests/unittests/common/test_utils.py @@ -186,3 +186,19 @@ class TestUtils(trove_testtools.TestCase): expected = ('GET / HTTP/1.0\r\nHost: localhost:80\r\n' 'X-Auth-Project-Id: \u6d4b\u8bd5') self.assertEqual(expected, utils.req_to_text(req)) + + def test_validate_command(self): + string1 = "hello_world" + string2 = "hello world" + string3 = "hello@world_123" + string4 = "example.com/databse/mysql:5.7" + string5 = 'test --db-user="$(touch /rce_successful.txt)"' + self.assertIsNone(utils.validate_command(string1)) + self.assertRaises(exception.InvalidValue, + utils.validate_command, + string2) + self.assertIsNone(utils.validate_command(string3)) + self.assertIsNone(utils.validate_command(string4)) + self.assertRaises(exception.InvalidValue, + utils.validate_command, + string5) |