xref: /aosp_15_r20/external/autotest/utils/gslib_unittest.py (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1#!/usr/bin/python3
2
3# Copyright 2017 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7import unittest
8
9import common
10from autotest_lib.utils import gslib
11
12
13class EscapeTestCase(unittest.TestCase):
14    """Tests for basic KeyvalLabel functions."""
15
16    def test_escape_printable(self):
17        """Test escaping printable characters."""
18        got = gslib.escape('foo[]*?#')
19        self.assertEqual(got, 'foo%5b%5d%2a%3f%23')
20
21    def test_escape_control(self):
22        """Test escaping control characters by hex."""
23        got = gslib.escape('foo\x88')
24        self.assertEqual(got, 'foo%88')
25
26
27if __name__ == '__main__':
28    unittest.main()
29