def testParseInvalid(self, args, expected_exception): self.get_client_instance = self.StartObjectPatch( apis, 'GetClientInstance') parser = calliope_util.ArgumentParser() parser.add_argument('--project', help='The project.') util.AddIapIamResourceArgs(parser) with self.assertRaises(expected_exception): parsed_args = parser.parse_args(args) util.ParseIapResource(self.track, parsed_args)
def testParse(self, args, expected_type): self.get_client_instance = self.StartObjectPatch( apis, 'GetClientInstance') parser = calliope_util.ArgumentParser() parser.add_argument('--project', help='The project.') util.AddIapIamResourceArgs(parser) parsed_args = parser.parse_args(args) resource = util.ParseIapResource(self.track, parsed_args) self.assertEqual(type(resource), expected_type)
def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this command invocation. Returns: The specified function with its description and configured filter. """ iap_ref = iap_util.ParseIapResource(self.ReleaseTrack(), args) return iap_ref.Enable(args.oauth2_client_id, args.oauth2_client_secret)