예제 #1
0
    def testInvalidNames(self):
        parser = argparse.ArgumentParser()
        request_name.Args(parser)

        for n in [
                '', 'projects//approvalRequests/1',
                'folders/1/approvalRequest/',
                'prefix/organizations/9/approvalRequests/a'
        ]:
            args = parser.parse_args([n])
            with self.assertRaises(exceptions.InvalidArgumentException):
                request_name.GetName(args)
예제 #2
0
    def testValidNames(self):
        parser = argparse.ArgumentParser()
        request_name.Args(parser)

        for n in [
                'projects/123/approvalRequests/abc123',
                'projects/my-proj-123/approvalRequests/1',
                'folders/123/approvalRequests/abc123',
                'organizations/9/approvalRequests/a'
        ]:
            args = parser.parse_args([n])
            self.assertEqual(request_name.GetName(args), n)
예제 #3
0
 def Args(parser):
     """Add command-specific args."""
     request_name.Args(parser)