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)
def testNotRequired(self): properties.VALUES.compute.zone.Set(None) args = argparse.Namespace() output = container_command_util.GetZone(args, required=False) self.assertIsNone(output)
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')
def testRequired(self): properties.VALUES.compute.zone.Set(None) args = argparse.Namespace() with self.assertRaises(exceptions.MinimumArgumentException): container_command_util.GetZone(args, required=True)
def testZone(self): args = argparse.Namespace(zone='test-zone-2') result = container_command_util.GetZone(args) self.assertEqual(result, 'test-zone-2')