Example #1
0
 def testIgnoreProperty(self):
     properties.VALUES.compute.zone.Set('test-zone-1')
     args = argparse.Namespace()
     with self.assertRaises(exceptions.MinimumArgumentException):
         # Although property is set, it's not used so function raises exception.
         container_command_util.GetZone(args, ignore_property=True)
Example #2
0
 def testNotRequired(self):
     properties.VALUES.compute.zone.Set(None)
     args = argparse.Namespace()
     output = container_command_util.GetZone(args, required=False)
     self.assertIsNone(output)
Example #3
0
 def testProperty(self):
     properties.VALUES.compute.zone.Set('test-zone-1')
     args = argparse.Namespace()
     result = container_command_util.GetZone(args)
     self.assertEqual(result, 'test-zone-1')
Example #4
0
 def testRequired(self):
     properties.VALUES.compute.zone.Set(None)
     args = argparse.Namespace()
     with self.assertRaises(exceptions.MinimumArgumentException):
         container_command_util.GetZone(args, required=True)
Example #5
0
 def testZone(self):
     args = argparse.Namespace(zone='test-zone-2')
     result = container_command_util.GetZone(args)
     self.assertEqual(result, 'test-zone-2')