| cmtice | 6367e17 | 2014-06-17 16:30:45 -0700 | [diff] [blame] | 1 | #!/usr/bin/python | 
| cmtice | 2fca8ce | 2014-05-07 13:22:37 -0700 | [diff] [blame] | 2 | # | 
|  | 3 | # Copyright 2014 Google Inc. All Rights Reserved. | 
|  | 4 |  | 
|  | 5 | import test_flag | 
|  | 6 |  | 
|  | 7 | import unittest | 
|  | 8 |  | 
|  | 9 | class FlagTestCase(unittest.TestCase): | 
|  | 10 |  | 
|  | 11 | def test_test_flag(self): | 
|  | 12 | # Verify that test_flag._is_test exists, that it is a list, | 
|  | 13 | # and that it contains 1 element. | 
|  | 14 | self.assertTrue(type(test_flag._is_test) is list) | 
|  | 15 | self.assertEqual(len(test_flag._is_test), 1) | 
|  | 16 |  | 
|  | 17 |  | 
|  | 18 | # Verify that the getting the flag works and that the flag | 
|  | 19 | # contains False, its starting value. | 
|  | 20 | save_flag = test_flag.GetTestMode() | 
|  | 21 | self.assertFalse(save_flag) | 
|  | 22 |  | 
|  | 23 | # Verify that setting the flat to True, then getting it, works. | 
|  | 24 | test_flag.SetTestMode(True) | 
|  | 25 | self.assertTrue(test_flag.GetTestMode()) | 
|  | 26 |  | 
|  | 27 | # Verify that setting the flag to False, then getting it, works. | 
|  | 28 | test_flag.SetTestMode(save_flag) | 
|  | 29 | self.assertFalse(test_flag.GetTestMode()) | 
|  | 30 |  | 
|  | 31 | # Verify that test_flag._is_test still exists, that it still is a | 
|  | 32 | # list, and that it still contains 1 element. | 
|  | 33 | self.assertTrue(type(test_flag._is_test) is list) | 
|  | 34 | self.assertEqual(len(test_flag._is_test), 1) | 
|  | 35 |  | 
|  | 36 |  | 
|  | 37 | if __name__ == '__main__': | 
|  | 38 | unittest.main() |