예제 #1
0
    def testWarnForSourceInstanceTemplateLimitationsNoTrigger(self):
        def IsSpecified(name):
            return name not in ['source_instance_template']

        args = argparse.Namespace()
        args.IsSpecified = IsSpecified

        write_mock = self.StartObjectPatch(log.status, 'write')

        flags.WarnForSourceInstanceTemplateLimitations(args)

        write_mock.assert_not_called()
예제 #2
0
    def testWarnForSourceInstanceTemplateLimitationsPositive(self):
        def IsSpecified(name):
            return name in ['source_instance_template', 'unsupperted_flag']

        def GetSpecifiedArgNames():
            return ['--source-instance-template', '--unsupported-flag']

        args = argparse.Namespace()
        args.IsSpecified = IsSpecified
        args.GetSpecifiedArgNames = GetSpecifiedArgNames

        write_mock = self.StartObjectPatch(log.status, 'write', autospec=True)

        flags.WarnForSourceInstanceTemplateLimitations(args)

        write_mock.assert_called()
예제 #3
0
    def testWarnForSourceInstanceTemplateLimitationsNegative(self):
        def IsSpecified(name):
            return name in [
                'source_instance_template', 'machine_type', 'custom_cpu',
                'custom-memory', 'labels'
            ]

        def GetSpecifiedArgNames():
            return [
                '--source-instance-template', '--machine-type', '--custom-cpu',
                '--custom-memory', '--labels'
            ]

        args = argparse.Namespace()
        args.IsSpecified = IsSpecified
        args.GetSpecifiedArgNames = GetSpecifiedArgNames

        write_mock = self.StartObjectPatch(log.status, 'write')

        flags.WarnForSourceInstanceTemplateLimitations(args)

        write_mock.assert_not_called()
 def WarnForSourceInstanceTemplateLimitations(self, args):
     instances_flags.WarnForSourceInstanceTemplateLimitations(args)