def test_deploy_info_must_match_schema(self): schema = config_helper.Schema.load_yaml(""" x-google-marketplace: schemaVersion: v2 partnerId: partner-a solutionId: solution-a applicationApiVersion: v1beta1 publishedVersion: 6.5.130-metadata publishedVersionMetadata: releaseNote: Bug fixes images: {} properties: {} """) self.assertRaisesRegex( Exception, r'Partner or solution ID values.*schema.*not consistent', lambda: validate_deploy_info_annotation( '{"partner_id": "partner-a", "product_id": "solution-b"}', schema)) self.assertRaisesRegex( Exception, r'Partner or solution ID values.*schema.*not consistent', lambda: validate_deploy_info_annotation( '{"partner_id": "partner-b", "product_id": "solution-a"}', schema)) validate_deploy_info_annotation( '{"partner_id": "partner-a", "product_id": "solution-a"}', schema)
def test_deploy_info_ok_if_schema_has_no_partner_product_ids(self): schema = config_helper.Schema.load_yaml(""" x-google-marketplace: schemaVersion: v2 applicationApiVersion: v1beta1 publishedVersion: 6.5.130-metadata publishedVersionMetadata: releaseNote: Bug fixes images: {} properties: {} """) validate_deploy_info_annotation( '{"partner_id": "partner-a", "product_id": "solution-a"}', schema)
def test_deploy_info_must_contain_product_id(self): self.assertRaisesRegexp( Exception, r'.*must contain a product_id.*', lambda: validate_deploy_info_annotation('{"partner_id": "partner"}'))
def test_deploy_info_must_be_json(self): self.assertRaisesRegexp( Exception, r'.*must be valid JSON.*', lambda: validate_deploy_info_annotation('invalid json'))