def CheckCert(cert, after):
            self.assertEqual(name, cert.name)
            self.assertEqual(
                self.messages.SslCertificate.TypeValueValuesEnum.SELF_MANAGED,
                cert.type)
            self.assertEqual(description, cert.description)

            creation_timestamp = time_util.Strptime(cert.creationTimestamp)
            self.assertLessEqual(self.start_time - 1, creation_timestamp)
            self.assertGreaterEqual(after + 1, creation_timestamp)

            expire_time = time_util.Strptime(cert.expireTime)
            self.assertLessEqual(self.start_time + 364 * 24 * 3600,
                                 expire_time)
            self.assertGreaterEqual(after + 366 * 24 * 3600, expire_time)
Exemple #2
0
        def CheckCert(cert, after):
            self.assertEqual(name, cert.name)
            self.assertEqual(
                self.messages.SslCertificate.TypeValueValuesEnum.MANAGED,
                cert.type)
            self.assertEqual(description, cert.description)

            creation_timestamp = time_util.Strptime(cert.creationTimestamp)
            self.assertLessEqual(self.start_time - 1, creation_timestamp)
            self.assertGreaterEqual(after + 1, creation_timestamp)
            self.assertEqual([domains], result_list[0].managed.domains)
Exemple #3
0
        def CheckCert(cert, after):
            self.assertEqual(name, cert.name)
            self.assertEqual(
                self.messages.SslCertificate.TypeValueValuesEnum.MANAGED,
                cert.type)

            creation_timestamp = time_util.Strptime(cert.creationTimestamp)
            self.assertLessEqual(self.start_time - 1, creation_timestamp)
            self.assertGreaterEqual(after + 1, creation_timestamp)
            self.assertEqual(domains, cert.managed.domains)
            self.assertEqual(self.managed.StatusValueValuesEnum.PROVISIONING,
                             cert.managed.status)
def ParseAndValidateMessage(input_str):
    """Validate that yaml string or object is a valid OutputMessage."""
    try:
        yaml_object = yaml.load(input_str)
        _MSG_VALIDATOR.Validate(yaml_object)
        time_util.Strptime(yaml_object['timestamp'])
        resources = yaml_object.get('resource_body')
        if resources and not IsResourceLike(resources):
            raise ValueError(_INVALID_RESOURCE_VALUE_MSG)

        return yaml_object
    except (yaml.YAMLParseError, ValueError) as e:
        raise MessageParsingError(
            'Error loading YAML message [{}] :: {}.'.format(input_str, e))
    except (yaml_validator.ValidationError, ryaml.error.YAMLStreamError) as ve:
        raise InvalidMessageError(
            'Invalid OutputMessage string [{}] :: [{}]'.format(input_str, ve))