Coverage for netbox_data_import/graphql/types.py: 100.00%

12 statements  

« prev     ^ index     » next       coverage.py v7.17.0, created at 2026-10-30 09:47 +0000

1# SPDX-License-Identifier: Apache-2.0 

2# Copyright (C) 2025 Marcin Zieba <marcinpsk@gmail.com> 

3 

4"""GraphQL object types for import profile configuration.""" 

5 

6import strawberry_django 

7from netbox.graphql.types import BaseObjectType, NetBoxObjectType 

8 

9from netbox_data_import.models import CableClassMapping, ImportProfile, PortClassMapping 

10 

11from .filters import ImportProfileFilter 

12 

13_type_kwargs = {"fields": "__all__", "pagination": True} 

14if ImportProfileFilter is not None: # pragma: no cover 

15 _type_kwargs["filters"] = ImportProfileFilter 

16 

17 

18@strawberry_django.type(ImportProfile, **_type_kwargs) 

19class ImportProfileType(NetBoxObjectType): 

20 """One saved source-file import configuration.""" 

21 

22 

23@strawberry_django.type( 

24 CableClassMapping, 

25 fields=[ 

26 "id", 

27 "profile", 

28 "cable_class", 

29 "cable_type_resolved", 

30 "cable_type", 

31 "cable_profile_resolved", 

32 "cable_profile", 

33 ], 

34 pagination=True, 

35) 

36class CableClassMappingType(BaseObjectType): 

37 """One trace CableClass policy decision.""" 

38 

39 profile: ImportProfileType 

40 

41 

42@strawberry_django.type(PortClassMapping, fields=["id", "profile", "source_label", "port_class"], pagination=True) 

43class PortClassMappingType(BaseObjectType): 

44 """One trace PortClass label mapping.""" 

45 

46 profile: ImportProfileType 

47 

48 

49__all__ = ("CableClassMappingType", "ImportProfileType", "PortClassMappingType")