# -*- coding: utf8 -*-
-# ============LICENSE_START=======================================================
+# ============LICENSE_START====================================================
# org.onap.vvp/validation-scripts
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless otherwise specified, all software contained herein is licensed
-# under the Apache License, Version 2.0 (the “License”);
+# under the Apache License, Version 2.0 (the "License");
# you may not use this software except in compliance with the License.
# You may obtain a copy of the License at
#
#
#
# Unless otherwise specified, all documentation contained herein is licensed
-# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# under the Creative Commons License, Attribution 4.0 Intl. (the "License");
# you may not use this documentation except in compliance with the License.
# You may obtain a copy of the License at
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
#
+'''test_all_referenced_resources_exists
+'''
+
import pytest
import yaml
+
from .utils.nested_iterables import find_all_get_resource_in_yml
+VERSION = '1.0.0'
+
+# pylint: disable=invalid-name
+
def test_all_referenced_resources_exists(yaml_file):
'''
resource_ids = yml['resources'].keys()
referenced_resource_ids = find_all_get_resource_in_yml(yml)
- missing_referenced_resources = []
+ missing_referenced_resources = set()
for referenced_resource_id in referenced_resource_ids:
if referenced_resource_id not in resource_ids:
- missing_referenced_resources.append(referenced_resource_id)
+ missing_referenced_resources.add(referenced_resource_id)
- assert not set(missing_referenced_resources)
+ assert not missing_referenced_resources, (
+ 'missing referenced resources %s' % list(
+ missing_referenced_resources))