Upstream version 8.36.161.0
[platform/framework/web/crosswalk.git] / src / third_party / chromite / cros / commands / cros_image_unittest.py
1 #!/usr/bin/python
2
3 # Copyright (c) 2012 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
7 """This module tests the cros image command."""
8
9 import argparse
10 import os
11 import sys
12
13 sys.path.insert(0, os.path.abspath('%s/../../..' % os.path.dirname(__file__)))
14 from chromite.cros.commands import cros_image
15 from chromite.lib import cros_test_lib
16
17
18 class ImageCommandTest(cros_test_lib.TestCase):
19   """Test class for our ImageCommand class."""
20
21   def testParser(self):
22     """Tests that our example parser works as expected."""
23     fake_parser = argparse.ArgumentParser()
24     fake_subparser = fake_parser.add_subparsers()
25     image_parser = fake_subparser.add_parser('image')
26     cros_image.ImageCommand.AddParser(image_parser)
27
28     options = fake_parser.parse_args(['image', '--myoption=awesome'])
29     instance = options.cros_class(options)
30     self.assertEqual(instance.options.myoption, 'awesome')
31
32
33 if __name__ == '__main__':
34   cros_test_lib.main()