Example #1
0
    def test_no_credentials(self):
        with pytest.raises(ClickException) as e:
            configure.get_credential("test")

        assert e.value.message == (
            "Provide API credential test. "
            "Either by using `rossum configure`, or environment variable ROSSUM_TEST."
        )
Example #2
0
    def test_get_credential_from_file(self, isolated_cli_runner,
                                      configuration_path):
        with isolated_cli_runner.isolation():
            configuration_path.parent.mkdir()

            config = configparser.RawConfigParser()
            config["default"] = {"test": "test%"}
            with configuration_path.open("w") as f:
                config.write(f)

            result = configure.get_credential("test")
        assert "test%" == result
Example #3
0
 def url(self) -> str:
     if self._url is None:
         _url = get_credential("url", self._profile).rstrip("/")
         self._url = f'{_url}{"/v1" if self._use_api_version else ""}'
     return self._url
Example #4
0
 def password(self) -> str:
     if self._password is None:
         self._password = get_credential("password", self._profile)
     return self._password
Example #5
0
 def user(self) -> str:
     if self._user is None:
         self._user = get_credential("username", self._profile)
     return self._user
Example #6
0
 def test_get_credential_from_env(self, isolated_cli_runner):
     with isolated_cli_runner.isolation():
         result = configure.get_credential("test")
     assert "test" == result