aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_sdc2_resource.py
blob: b9a321163089a0f5c68921da68be422dec662acf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from urllib.parse import parse_qs

from pytest import raises

from onapsdk.sdc2.sdc import ResoureTypeEnum
from onapsdk.sdc2.sdc_resource import SDCResource

def test_build_exclude_types_query():
    for resource_type in ResoureTypeEnum:
        query = SDCResource._build_exclude_types_query(resource_type)
        assert query.count("excludeTypes=") == 12
        with raises(ValueError):
            parse_qs(query)["excludeTypes"].index(resource_type.value)
        for other_resource_type in ResoureTypeEnum:
            if other_resource_type == resource_type:
                continue
            parse_qs(query)["excludeTypes"].index(other_resource_type.value)