blob: 8316e32e4abac9cd715a333e8b953d17f2ebe027 [file] [log] [blame]
Allen Lib41527d2017-06-22 17:28:00 -07001#!/usr/bin/python2.7
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()