Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / chromite / cros / commands / cros_image_unittest.py
1 #!/usr/bin/python
2 # Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """This module tests the cros image command."""
7
8 from __future__ import print_function
9
10 import argparse
11 import os
12 import sys
13
14 sys.path.insert(0, os.path.abspath('%s/../../..' % os.path.dirname(__file__)))
15 from chromite.cros.commands import cros_image
16 from chromite.lib import cros_test_lib
17
18
19 class ImageCommandTest(cros_test_lib.TestCase):
20   """Test class for our ImageCommand class."""
21
22   def testParser(self):
23     """Tests that our example parser works as expected."""
24     fake_parser = argparse.ArgumentParser()
25     fake_subparser = fake_parser.add_subparsers()
26     image_parser = fake_subparser.add_parser('image')
27     cros_image.ImageCommand.AddParser(image_parser)
28
29     options = fake_parser.parse_args(['image', '--myoption=awesome'])
30     instance = options.cros_class(options)
31     self.assertEqual(instance.options.myoption, 'awesome')
32
33
34 if __name__ == '__main__':
35   cros_test_lib.main()