diff --git a/cas_wrapper.py b/cas_wrapper.py index e1e20a9..e5990a4 100644 --- a/cas_wrapper.py +++ b/cas_wrapper.py @@ -45,19 +45,32 @@ class CasWrapper: result_of_execution = command() return json.loads(result_of_execution)['hash'] - def authenticate(self, local_git_repo_path: str) -> bool: + def authenticate( + self, + local_path: str, + metadata: dict = None, + ): """ Wrapper around `cas authenticate` - :param local_git_repo_path: path to a local Git repo + :param local_path: path to a local Git repo + (should be started from `git://`) + or to a single local file + :param metadata: additional metadata :return: true if a commit is trusted, vice versa - false :rtype: bool """ command = self._cas[ 'authenticate', - f'git://{local_git_repo_path}', + local_path, '-o', 'json', ] + if metadata is not None: + for key, value in metadata.items(): + command = command[ + '-a', + f'{key}={value}', + ] try: result_of_execution = command() except ProcessExecutionError: