• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vantage6 / vantage6 / 18191710511

02 Oct 2025 11:30AM UTC coverage: 29.08%. First build
18191710511

Pull #2287

github

web-flow
Merge 3e2880106 into d88a9c354
Pull Request #2287: Change/#1510 and reinstate the dev network commands

17 of 48 new or added lines in 10 files covered. (35.42%)

196 of 674 relevant lines covered (29.08%)

0.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/vantage6/vantage6/cli/context/auth.py
1
from __future__ import annotations
1✔
2

3
from vantage6.common.context import AppContext
1✔
4
from vantage6.common.globals import InstanceType
1✔
5

6
from vantage6.cli import __version__
1✔
7
from vantage6.cli.configuration_manager import AuthConfigurationManager
1✔
8
from vantage6.cli.globals import DEFAULT_SERVER_SYSTEM_FOLDERS as S_FOL
1✔
9

10

11
class AuthContext(AppContext):
1✔
12
    """
13
    Context class for the keycloak authentication server.
14

15
    Parameters
16
    ----------
17
    instance_name : str
18
        Name of the configuration instance, corresponds to the filename
19
        of the configuration file.
20
    system_folders : bool, optional
21
        System wide or user configuration, by default S_FOL
22
    is_sandbox : bool, optional
23
        Whether the configuration is a sandbox configuration, by default False
24
    """
25

26
    # The auth configuration manager is aware of the structure of the auth
27
    # configuration file and makes sure only valid configuration can be loaded.
28
    INST_CONFIG_MANAGER = AuthConfigurationManager
1✔
29

30
    def __init__(
1✔
31
        self,
32
        instance_name: str,
33
        system_folders: bool = S_FOL,
34
        is_sandbox: bool = False,
35
    ):
36
        super().__init__(
×
37
            InstanceType.AUTH,
38
            instance_name,
39
            system_folders=system_folders,
40
            is_sandbox=is_sandbox,
41
        )
42
        self.log.info("vantage6 version '%s'", __version__)
×
43

44
    @classmethod
1✔
45
    def from_external_config_file(
1✔
46
        cls, path: str, system_folders: bool = S_FOL
47
    ) -> AuthContext:
48
        """
49
        Create a server context from an external configuration file. External
50
        means that the configuration file is not located in the default folders
51
        but its location is specified by the user.
52

53
        Parameters
54
        ----------
55
        path : str
56
            Path of the configuration file
57
        system_folders : bool, optional
58
            System wide or user configuration, by default S_FOL
59

60
        Returns
61
        -------
62
        ServerContext
63
            Server context object
64
        """
65
        return super().from_external_config_file(
×
66
            path,
67
            InstanceType.AUTH,
68
            system_folders,
69
        )
70

71
    @classmethod
1✔
72
    def config_exists(
1✔
73
        cls,
74
        instance_name: str,
75
        system_folders: bool = S_FOL,
76
        is_sandbox: bool = False,
77
    ) -> bool:
78
        """
79
        Check if a configuration file exists.
80

81
        Parameters
82
        ----------
83
        instance_name : str
84
            Name of the configuration instance, corresponds to the filename
85
            of the configuration file.
86
        system_folders : bool, optional
87
            System wide or user configuration, by default S_FOL
88
        is_sandbox : bool, optional
89
            Whether the configuration is a sandbox configuration, by default False
90

91
        Returns
92
        -------
93
        bool
94
            Whether the configuration file exists or not
95
        """
96
        return super().config_exists(
×
97
            InstanceType.AUTH,
98
            instance_name,
99
            system_folders=system_folders,
100
            is_sandbox=is_sandbox,
101
        )
102

103
    @classmethod
1✔
104
    def available_configurations(
1✔
105
        cls, system_folders: bool = S_FOL, is_sandbox: bool = False
106
    ) -> tuple[list, list]:
107
        """
108
        Find all available auth configurations in the default folders.
109

110
        Parameters
111
        ----------
112
        system_folders : bool, optional
113
            System wide or user configuration, by default S_FOL
114
        is_sandbox : bool, optional
115
            Whether the configuration is a sandbox configuration, by default False
116

117
        Returns
118
        -------
119
        tuple[list, list]
120
            The first list contains validated configuration files, the second
121
            list contains invalid configuration files.
122
        """
NEW
123
        return super().available_configurations(
×
124
            InstanceType.AUTH, system_folders, is_sandbox
125
        )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc