summaryrefslogtreecommitdiff
path: root/trove/tests/unittests/common/test_utils.py
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-09-16 02:30:50 +0000
committerGerrit Code Review <review@openstack.org>2022-09-16 02:30:50 +0000
commit71d8400db5403e37f17340bc05b2a22324d334cd (patch)
treeb8ff6c65a78b3655dd8d36448e558d44ed36e764 /trove/tests/unittests/common/test_utils.py
parent40191dd5be192a9a0b70f884e0a110cb0a18b669 (diff)
parentd3d7fe95c58c25a2ab405112b25ad265c76eb5b2 (diff)
downloadtrove-stable/xena.tar.gz
Merge "Fix illegal shell characters" into stable/xenaxena-em16.0.1stable/xena
Diffstat (limited to 'trove/tests/unittests/common/test_utils.py')
-rw-r--r--trove/tests/unittests/common/test_utils.py16
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)