Exemplo n.º 1
0
    def test__validate_credentials__only_access_token_fails(self):
        def store(key):
            if key == 'access_token':
                return 'foo'

        config = MagicMock()
        config.auth_store.__getitem__ = MagicMock(side_effect=store)

        with self.assertRaises(click.Abort):
            validate_credentials(config)
Exemplo n.º 2
0
    def __init__(self, config: Config, type: str, name: str, version: str,
                 groups: list):
        super(DeployCommand, self).__init__(config)

        self.type = type
        self.name = name
        self.version = version
        self.groups = groups

        validate_credentials(config)
Exemplo n.º 3
0
    def __init__(self,
                 config: Config,
                 project: str,
                 version: str,
                 block: bool,
                 mason_version: str,
                 time=time,
                 urlparse=urlparse):
        super(BuildCommand, self).__init__(config)

        self.project = project
        self.version = version
        self.block = block
        self.mason_version = mason_version
        self.time = time
        self.urlparse = urlparse

        validate_credentials(config)
Exemplo n.º 4
0
    def __init__(self, config: Config):
        super(RegisterCommand, self).__init__(config)

        validate_credentials(config)
Exemplo n.º 5
0
    def test__validate_credentials__id_and_access_token_succeeds(self):
        config = MagicMock()
        config.auth_store.__getitem__ = MagicMock(return_value='foo')

        self.assertIsNone(validate_credentials(config))
Exemplo n.º 6
0
    def test__validate_credentials__no_tokens_fails(self):
        config = MagicMock()
        config.auth_store.__getitem__ = MagicMock(return_value=None)

        with self.assertRaises(click.Abort):
            validate_credentials(config)
Exemplo n.º 7
0
    def __init__(self, config: Config, working_dir=None):
        super(InitCommand, self).__init__(config)
        self.working_dir = os.path.abspath(working_dir or os.getcwd())

        validate_credentials(config)