From d899cc343310862975bfb9325b38f1d942a540e3 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 28 Nov 2023 14:48:45 -0800 Subject: [PATCH 01/52] bump version to 4.2.0.dev0 --- pyonepassword/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyonepassword/__about__.py b/pyonepassword/__about__.py index 92db4692..7e0b4771 100644 --- a/pyonepassword/__about__.py +++ b/pyonepassword/__about__.py @@ -1,5 +1,5 @@ __title__ = "pyonepassword" -__version__ = "4.1.0" +__version__ = "4.2.0.dev0" __summary__ = "A python API to query a 1Password account using the 'op' command-line tool" """ From 64a2b4593db534c2da4fd9233ac4bcbfffb14753 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 28 Nov 2023 14:50:19 -0800 Subject: [PATCH 02/52] updated repo-mgmt-scripts submodule --- submodules/repo-mgmt-scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/repo-mgmt-scripts b/submodules/repo-mgmt-scripts index 3de3d8a6..c2cf4dbd 160000 --- a/submodules/repo-mgmt-scripts +++ b/submodules/repo-mgmt-scripts @@ -1 +1 @@ -Subproject commit 3de3d8a675460a536ae106adcbd2995b7c8ae449 +Subproject commit c2cf4dbd622ac112e1f35d99c101d7157a3f9a0d From b2f689b1298348a287289ca18b9b43a7053117a3 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 28 Nov 2023 15:31:17 -0800 Subject: [PATCH 03/52] change name of testing & linting GH action --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 261cc6be..01a22905 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: Python testing and linting +name: testing and linting on: push: From 70845f7e8ee3871aa542f6a3bca9e7a322533abb Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 28 Nov 2023 15:32:13 -0800 Subject: [PATCH 04/52] rename testing & linting yml file --- .github/workflows/{python-package.yml => testing-linting.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{python-package.yml => testing-linting.yml} (100%) diff --git a/.github/workflows/python-package.yml b/.github/workflows/testing-linting.yml similarity index 100% rename from .github/workflows/python-package.yml rename to .github/workflows/testing-linting.yml From 9abcbc97dc260b57fe4c6e7b68a34ce3bbc6a366 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 28 Nov 2023 15:32:33 -0800 Subject: [PATCH 05/52] add additional pypi classifiers to setup.py --- setup.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2ee47725..0b4c1226 100644 --- a/setup.py +++ b/setup.py @@ -77,9 +77,15 @@ def run(self): entry_points={"console_scripts": ["opconfig=pyonepassword.opconfig_main:main"]}, classifiers=[ - "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", + "Topic :: Software Development :: Libraries", + "Topic :: Utilities", ], cmdclass={ # TODO: this breaks building in tox>=4.0 From 279fd5b4b1f25dc40df470c0cf647eca747704c2 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 28 Nov 2023 15:32:43 -0800 Subject: [PATCH 06/52] add badges to README --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index e3644b2c..26773973 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # PYONEPASSWORD +![PyPI - Version](https://img.shields.io/pypi/v/pyonepassword) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyonepassword) +![Testing & linting](https://github.com/zcutlip/pyonepassword/actions/workflows/python-package.yml/badge.svg) +![CodeQL](https://github.com/zcutlip/pyonepassword/actions/workflows/codeql.yml/badge.svg) + + + ## Description A Python API to sign into and query a 1Password account using the `op` command. From 5e7550dbe4b7734232c6aceb618c593df1f9bb79 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 6 Dec 2023 13:42:50 +0000 Subject: [PATCH 07/52] Update actions/setup-python action to v5 --- .github/workflows/testing-linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing-linting.yml b/.github/workflows/testing-linting.yml index 01a22905..043dc094 100644 --- a/.github/workflows/testing-linting.yml +++ b/.github/workflows/testing-linting.yml @@ -21,7 +21,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - name: Install dependencies From f576ae5d5ba43dec5d4ed733af128cc563749dc5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 19:06:42 +0000 Subject: [PATCH 08/52] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pycqa/isort: 5.12.0 → 5.13.0](https://github.com/pycqa/isort/compare/5.12.0...5.13.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ee310ea5..3cae82b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ repos: hooks: - id: autopep8 - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 5.13.0 hooks: - id: isort name: isort (python) From 4abb04d4e7d802a5640ab247bc81ee465d58f873 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 17:20:35 +0000 Subject: [PATCH 09/52] Update github/codeql-action action to v3 --- .github/workflows/codeql.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index dc599845..d7d44422 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -50,7 +50,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -64,7 +64,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -77,6 +77,6 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 with: category: "/language:${{matrix.language}}" From a9f36086282547ee305504885c25c410eb77e67f Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 16:27:27 -0800 Subject: [PATCH 10/52] add windows to python testing and linting --- .github/workflows/testing-linting.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing-linting.yml b/.github/workflows/testing-linting.yml index 043dc094..5a8d6983 100644 --- a/.github/workflows/testing-linting.yml +++ b/.github/workflows/testing-linting.yml @@ -12,10 +12,11 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: + os: [ubuntu-latest, windows-latest] python: ["3.9", "3.10", "3.11", "3.12"] steps: From 6c6d8506e28321cba8e5cf406044b1fbc23fa792 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 16:59:09 -0800 Subject: [PATCH 11/52] add .gitattributes to tests/ directory --- tests/.gitattributes | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/.gitattributes diff --git a/tests/.gitattributes b/tests/.gitattributes new file mode 100644 index 00000000..609503a2 --- /dev/null +++ b/tests/.gitattributes @@ -0,0 +1,3 @@ +# keep windows from converting line endings in stderr and stdout files +config/mock-op/responses/**/output -text +config/mock-op/responses/**/error_output -text From b3f325dda39f75e3d01ba053721468e98ca30dd4 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Wed, 29 Nov 2023 18:31:41 -0800 Subject: [PATCH 12/52] change name of "user_get_argv" --- pyonepassword/_op_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyonepassword/_op_commands.py b/pyonepassword/_op_commands.py index dda407f1..39d26d2a 100644 --- a/pyonepassword/_op_commands.py +++ b/pyonepassword/_op_commands.py @@ -627,10 +627,10 @@ def _signed_in_accounts(cls, op_path, decode="utf-8"): return output def _user_get(self, user_name_or_id: str, decode: str = "utf-8") -> str: - get_user_argv = self._user_get_argv(user_name_or_id) + user_get_argv = self._user_get_argv(user_name_or_id) try: output = self._run_with_auth_check(self.op_path, self._account_identifier, - get_user_argv, capture_stdout=True, decode=decode) + user_get_argv, capture_stdout=True, decode=decode) except OPCmdFailedException as ocfe: raise OPUserGetException.from_opexception(ocfe) from ocfe return output From 235ff15156668fb5cfcfddd34c974027a1e7c5e4 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Wed, 29 Nov 2023 18:54:30 -0800 Subject: [PATCH 13/52] update several exception messages - match `op` 2.x operations vs `op` 1.x --- pyonepassword/py_op_exceptions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyonepassword/py_op_exceptions.py b/pyonepassword/py_op_exceptions.py index 2f6be0e3..5087251d 100644 --- a/pyonepassword/py_op_exceptions.py +++ b/pyonepassword/py_op_exceptions.py @@ -99,7 +99,7 @@ def __init__(self, stderr_out, returncode): class OPItemGetException(OPCmdFailedException): - MSG = "1Password 'get item' failed." + MSG = "1Password 'item get' failed." def __init__(self, stderr_out, returncode): super().__init__(stderr_out, returncode) @@ -169,7 +169,7 @@ def __init__(self, stderr_out, returncode): class OPUserGetException(OPCmdFailedException): - MSG = "1Password 'get user' failed." + MSG = "1Password 'user get' failed." def __init__(self, stderr_out, returncode): super().__init__(stderr_out, returncode) @@ -183,7 +183,7 @@ def __init__(self, stderr_out, returncode): class OPVaultGetException(OPCmdFailedException): - MSG = "1Password 'get vault' failed." + MSG = "1Password 'vault get' failed." def __init__(self, stderr_out, returncode): super().__init__(stderr_out, returncode) @@ -197,7 +197,7 @@ def __init__(self, stderr_out, returncode): class OPGroupGetException(OPCmdFailedException): - MSG = "1Password 'get group' failed." + MSG = "1Password 'group get' failed." def __init__(self, stderr_out, returncode): super().__init__(stderr_out, returncode) From 3f5f456caa31a98fdb1d62e0b531896de9397707 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Wed, 29 Nov 2023 19:10:36 -0800 Subject: [PATCH 14/52] add OPUserEditException --- pyonepassword/py_op_exceptions.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyonepassword/py_op_exceptions.py b/pyonepassword/py_op_exceptions.py index 5087251d..35528691 100644 --- a/pyonepassword/py_op_exceptions.py +++ b/pyonepassword/py_op_exceptions.py @@ -175,6 +175,13 @@ def __init__(self, stderr_out, returncode): super().__init__(stderr_out, returncode) +class OPUserEditException(OPCmdFailedException): + MSG = "1Password 'user edit' failed." + + def __init__(self, stderr_out, returncode): + super().__init__(stderr_out, returncode) + + class OPUserListException(OPCmdFailedException): MSG = "1Password 'user list' failed." From fa5a6119c82ab89d28b3b78abe13ba884671a958 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 3 Dec 2023 18:25:51 -0800 Subject: [PATCH 15/52] rename group identifier arg in group_get_argv() --- pyonepassword/_op_cli_argv.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyonepassword/_op_cli_argv.py b/pyonepassword/_op_cli_argv.py index 6f9016f7..367446dc 100644 --- a/pyonepassword/_op_cli_argv.py +++ b/pyonepassword/_op_cli_argv.py @@ -237,8 +237,8 @@ def group_generic_argv(cls, return argv @classmethod - def group_get_argv(cls, op_exe, user_name_or_id): - sub_cmd_args = [user_name_or_id] + def group_get_argv(cls, op_exe, group_name_or_id): + sub_cmd_args = [group_name_or_id] argv = cls.group_generic_argv(op_exe, "get", sub_cmd_args) return argv From b9f7428fbfaa7da727971ad0a9bea6954528a333 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 3 Dec 2023 18:27:45 -0800 Subject: [PATCH 16/52] redact several instances of user IDs --- pyonepassword/_op_cli_argv.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyonepassword/_op_cli_argv.py b/pyonepassword/_op_cli_argv.py index 367446dc..4e761913 100644 --- a/pyonepassword/_op_cli_argv.py +++ b/pyonepassword/_op_cli_argv.py @@ -190,6 +190,7 @@ def vault_list_argv(cls, op_exe, group_name_or_id=None, user_name_or_id=None): if group_name_or_id: sub_cmd_args.extend(["--group", group_name_or_id]) if user_name_or_id: + user_name_or_id = RedactedString(user_name_or_id) sub_cmd_args.extend(["--user", user_name_or_id]) argv = cls.vault_generic_argv(op_exe, "list", sub_cmd_args) return argv @@ -209,6 +210,7 @@ def user_generic_argv(cls, @classmethod def user_get_argv(cls, op_exe, user_name_or_id): + user_name_or_id = RedactedString(user_name_or_id) sub_cmd_args = [user_name_or_id] argv = cls.user_generic_argv(op_exe, "get", sub_cmd_args) return argv @@ -246,6 +248,7 @@ def group_get_argv(cls, op_exe, group_name_or_id): def group_list_argv(cls, op_exe, user_name_or_id=None, vault=None): sub_cmd_args = [] if user_name_or_id: + user_name_or_id = RedactedString(user_name_or_id) sub_cmd_args.extend(["--user", user_name_or_id]) if vault: sub_cmd_args.extend(["--vault", vault]) From f352d666cbb70cb4ccd64c2c930823695c184a46 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 3 Dec 2023 18:30:14 -0800 Subject: [PATCH 17/52] fix copy/paste typo with item_edit_add_url_field() replace password arg with "url" --- pyonepassword/pyonepassword.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyonepassword/pyonepassword.py b/pyonepassword/pyonepassword.py index 3c598a1d..2dbfb3c3 100644 --- a/pyonepassword/pyonepassword.py +++ b/pyonepassword/pyonepassword.py @@ -817,13 +817,12 @@ def item_edit_add_url_field(self, Supported required keyword arguments: vault """ - password = RedactedString(url, unmask_len=0) field_type = OPFieldTypeEnum.URL op_item = self._item_edit_set_field(item_identifier, field_type, field_label, section_label, - password, + url, vault, password_downgrade=False, insecure_operation=False, From a3defe516edccc766e91cbf40c7a9de49288ce37 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 3 Dec 2023 18:31:54 -0800 Subject: [PATCH 18/52] add `_OPArgv.user_edit_argv()` --- pyonepassword/_op_cli_argv.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pyonepassword/_op_cli_argv.py b/pyonepassword/_op_cli_argv.py index 4e761913..0a4e536b 100644 --- a/pyonepassword/_op_cli_argv.py +++ b/pyonepassword/_op_cli_argv.py @@ -215,6 +215,21 @@ def user_get_argv(cls, op_exe, user_name_or_id): argv = cls.user_generic_argv(op_exe, "get", sub_cmd_args) return argv + @classmethod + def user_edit_argv(cls, op_exe, user_name_or_id, new_name, travel_mode): + user_name_or_id = RedactedString(user_name_or_id) + sub_cmd_args = [user_name_or_id] + if new_name: + sub_cmd_args.extend(["--name", new_name]) + if travel_mode in (False, True): + arg = "on" if travel_mode else "off" + sub_cmd_args.extend(["--travel-mode", arg]) + elif travel_mode is not None: + raise TypeError("travel_mode must be bool or None") + + argv = cls.user_generic_argv(op_exe, "edit", sub_cmd_args) + return argv + @classmethod def user_list_argv(cls, op_exe, group_name_or_id=None, vault=None): sub_cmd_args = [] From 7fd55b57c6391bad16107784bc6fb7713dda66ad Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 3 Dec 2023 18:55:27 -0800 Subject: [PATCH 19/52] add user edit support to `_OPCommandInterface` --- pyonepassword/_op_commands.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pyonepassword/_op_commands.py b/pyonepassword/_op_commands.py index 39d26d2a..265f7807 100644 --- a/pyonepassword/_op_commands.py +++ b/pyonepassword/_op_commands.py @@ -43,6 +43,7 @@ OPItemListException, OPSigninException, OPUnknownAccountException, + OPUserEditException, OPUserGetException, OPUserListException, OPVaultGetException, @@ -635,6 +636,24 @@ def _user_get(self, user_name_or_id: str, decode: str = "utf-8") -> str: raise OPUserGetException.from_opexception(ocfe) from ocfe return output + def _user_edit(self, + user_name_or_id: str, + new_name: Optional[str], + travel_mode: Optional[bool], + decode: str = "utf-8"): + + user_edit_argv = self._user_edit_argv( + user_name_or_id, new_name, travel_mode) + + try: + # 'op user edit' doesn't have any output if successful + # if it fails, stderr will be in the exception object + self._run_with_auth_check(self.op_path, self._account_identifier, + user_edit_argv, capture_stdout=True, decode=decode) + except OPCmdFailedException as ocfe: + raise OPUserEditException.from_opexception(ocfe) from ocfe + return + def _user_list(self, group_name_or_id=None, vault=None, decode: str = "utf-8") -> str: user_list_argv = self._user_list_argv( group_name_or_id=group_name_or_id, vault=vault) @@ -871,6 +890,13 @@ def _user_get_argv(self, user_name_or_id: str): get_user_argv = _OPArgv.user_get_argv(self.op_path, user_name_or_id) return get_user_argv + def _user_edit_argv(self, user_name_or_id: str, new_name: Optional[str], travel_mode: Optional[bool]): + get_user_argv = _OPArgv.user_edit_argv(self.op_path, + user_name_or_id, + new_name, + travel_mode) + return get_user_argv + def _user_list_argv(self, group_name_or_id=None, vault=None): user_list_argv = _OPArgv.user_list_argv( self.op_path, group_name_or_id=group_name_or_id, vault=vault) From a9087be01d491ac1f5ccd40f04e72e17caad0c09 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 3 Dec 2023 19:01:32 -0800 Subject: [PATCH 20/52] add `OP.user_edit()` --- pyonepassword/pyonepassword.py | 49 +++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/pyonepassword/pyonepassword.py b/pyonepassword/pyonepassword.py index 2dbfb3c3..5e4a4a0e 100644 --- a/pyonepassword/pyonepassword.py +++ b/pyonepassword/pyonepassword.py @@ -59,7 +59,9 @@ OPItemGetException, OPItemListException, OPPasswordFieldDowngradeException, - OPSignoutException + OPSignoutException, + OPUserEditException, + OPUserGetException ) from .string import RedactedString from .version import PyOPAboutMixin @@ -1642,6 +1644,51 @@ def user_get(self, user_name_or_id: str) -> OPUser: user = OPUser(user_json) return user + def user_edit(self, + user_name_or_id: str, + new_name: Optional[str] = None, + travel_mode: Optional[bool] = None) -> OPUser: + """ + Edit the details for the user specified by name or unique ID. + + Parameters + ---------- + user_name_or_id: str + Name or ID of the user to edit + new_name: str, optional + New user-visible name to assign to user + by default, None + travel_mode: bool, optional + Set travel mode on or off + by default, None + Raises + ------ + OPUserEditException + If the lookup or edit fails for any reason during command execution + OPNotFoundException + If the 1Password command can't be found + + Returns + ------- + user_id: str + The unique ID of the user + + Service Account Support + ----------------------- + Not supported + """ + # 'op document edit' doesn't have any stdout, so we're not + # capturing any here + try: + user = self.user_get(user_name_or_id) + except OPUserGetException as e: + raise OPUserEditException.from_opexception(e) + + user_id = user.unique_id + self._user_edit(user_id, new_name, travel_mode) + + return user_id + def user_list(self, group_name_or_id=None, vault_name_or_id=None) -> OPUserDescriptorList: """ Return a list of users in an account. From 1b7959756c8f279c531768a2840ba8c7f49d778b Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 3 Dec 2023 19:04:27 -0800 Subject: [PATCH 21/52] updated repo-mgmt-scripts submodule --- submodules/repo-mgmt-scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/repo-mgmt-scripts b/submodules/repo-mgmt-scripts index c2cf4dbd..7eaf0422 160000 --- a/submodules/repo-mgmt-scripts +++ b/submodules/repo-mgmt-scripts @@ -1 +1 @@ -Subproject commit c2cf4dbd622ac112e1f35d99c101d7157a3f9a0d +Subproject commit 7eaf0422f49c18110ff02550b81d30148cb35468 From b5d8dbc5fcf20c4f8bca6e98df3a286228ddca51 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 5 Dec 2023 21:07:46 -0800 Subject: [PATCH 22/52] edit a bunch of test data --- .../document-get-example-document-03-filename/output | 2 +- .../responses-1/list-signed-in-accounts/output | 2 +- .../responses-2/list-signed-in-accounts/output | 2 +- .../responses-3/list-signed-in-accounts/output | 2 +- .../responses-4/list-signed-in-accounts/output | 2 +- .../responses-1/item-edit-example-login-03-set-password/output | 2 +- .../responses-1/item-edit-example-login-04-set-favorite/output | 2 +- .../responses-1/item-edit-example-login-05-set-favorite/output | 2 +- .../responses-1/item-edit-example-login-06-set-tags/output | 2 +- .../responses-1/item-edit-example-login-07-set-tags/output | 2 +- .../responses-1/item-edit-example-login-09-set-url/output | 2 +- .../responses-1/item-edit-example-login-11-set-url/output | 2 +- .../item-edit-example-login-12-set-field-text/output | 2 +- .../responses-1/item-edit-example-login-13-set-field-url/output | 2 +- .../item-edit-example-login-14-set-field-text/output | 2 +- .../responses-1/item-edit-example-login-15-set-field-url/output | 2 +- .../item-edit-example-login-17-add-text-field/output | 2 +- .../item-edit-example-login-17a-add-text-field/output | 2 +- .../item-edit-example-login-17b-add-text-field/output | 2 +- .../item-edit-example-login-17c-add-text-field/output | 2 +- .../item-edit-example-login-17d-add-text-field/output | 2 +- .../responses-1/item-edit-example-login-21a-delete-field/output | 2 +- .../responses-1/item-edit-example-login-21b-delete-field/output | 2 +- .../responses-1/item-edit-example-login-23-add-url-field/output | 2 +- .../responses-1/item-get-example-login-03/output | 2 +- .../responses-1/item-get-example-login-04/output | 2 +- .../responses-1/item-get-example-login-05/output | 2 +- .../responses-1/item-get-example-login-06/output | 2 +- .../responses-1/item-get-example-login-07/output | 2 +- .../responses-1/item-get-example-login-11/output | 2 +- .../responses-1/item-get-example-login-12/output | 2 +- .../responses-1/item-get-example-login-13/output | 2 +- .../responses-1/item-get-example-login-14/output | 2 +- .../responses-1/item-get-example-login-15/output | 2 +- .../responses-1/item-get-example-login-16/output | 2 +- .../responses-1/item-get-example-login-17/output | 2 +- .../responses-1/item-get-example-login-17a/output | 2 +- .../responses-1/item-get-example-login-17b/output | 2 +- .../responses-1/item-get-example-login-17c/output | 2 +- .../responses-1/item-get-example-login-17d/output | 2 +- .../responses-1/item-get-example-login-19/output | 2 +- .../responses-1/item-get-example-login-20/output | 2 +- .../responses-1/item-get-example-login-21a/output | 2 +- .../responses-1/item-get-example-login-21b/output | 2 +- .../responses-1/item-get-example-login-23/output | 2 +- .../responses-1/list-signed-in-accounts/output | 2 +- .../responses-2/list-signed-in-accounts/output | 2 +- .../responses-svc-acct-corrupt/list-signed-in-accounts/output | 2 +- .../list-signed-in-accounts/output | 2 +- 49 files changed, 49 insertions(+), 49 deletions(-) diff --git a/tests/config/mock-op/responses-document-edit/responses-1/document-get-example-document-03-filename/output b/tests/config/mock-op/responses-document-edit/responses-1/document-get-example-document-03-filename/output index c3b7bcde..e5186224 100644 --- a/tests/config/mock-op/responses-document-edit/responses-1/document-get-example-document-03-filename/output +++ b/tests/config/mock-op/responses-document-edit/responses-1/document-get-example-document-03-filename/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "DOCUMENT", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-11-15T03:26:37Z", "updated_at": "2023-11-20T03:36:55Z", "additional_information": "1 KB", diff --git a/tests/config/mock-op/responses-document-edit/responses-1/list-signed-in-accounts/output b/tests/config/mock-op/responses-document-edit/responses-1/list-signed-in-accounts/output index 0f19f028..045c5ca7 100644 --- a/tests/config/mock-op/responses-document-edit/responses-1/list-signed-in-accounts/output +++ b/tests/config/mock-op/responses-document-edit/responses-1/list-signed-in-accounts/output @@ -2,7 +2,7 @@ { "url": "pyonepassword.1password.com", "email": "uid000@gmail.com", - "user_uuid": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" }, { diff --git a/tests/config/mock-op/responses-item-delete-multiple/responses-2/list-signed-in-accounts/output b/tests/config/mock-op/responses-item-delete-multiple/responses-2/list-signed-in-accounts/output index 5ba8ce9e..b4655a59 100644 --- a/tests/config/mock-op/responses-item-delete-multiple/responses-2/list-signed-in-accounts/output +++ b/tests/config/mock-op/responses-item-delete-multiple/responses-2/list-signed-in-accounts/output @@ -8,7 +8,7 @@ { "url": "pyonepassword.1password.com", "email": "uid000@gmail.com", - "user_uuid": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" }, { diff --git a/tests/config/mock-op/responses-item-delete-multiple/responses-3/list-signed-in-accounts/output b/tests/config/mock-op/responses-item-delete-multiple/responses-3/list-signed-in-accounts/output index 0f19f028..045c5ca7 100644 --- a/tests/config/mock-op/responses-item-delete-multiple/responses-3/list-signed-in-accounts/output +++ b/tests/config/mock-op/responses-item-delete-multiple/responses-3/list-signed-in-accounts/output @@ -2,7 +2,7 @@ { "url": "pyonepassword.1password.com", "email": "uid000@gmail.com", - "user_uuid": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" }, { diff --git a/tests/config/mock-op/responses-item-delete-multiple/responses-4/list-signed-in-accounts/output b/tests/config/mock-op/responses-item-delete-multiple/responses-4/list-signed-in-accounts/output index 0f19f028..045c5ca7 100644 --- a/tests/config/mock-op/responses-item-delete-multiple/responses-4/list-signed-in-accounts/output +++ b/tests/config/mock-op/responses-item-delete-multiple/responses-4/list-signed-in-accounts/output @@ -2,7 +2,7 @@ { "url": "pyonepassword.1password.com", "email": "uid000@gmail.com", - "user_uuid": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" }, { diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-03-set-password/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-03-set-password/output index b35d08cd..5cd8dc93 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-03-set-password/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-03-set-password/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-08-22T22:14:47Z", "updated_at": "2023-08-22T19:54:41.937504-07:00", "additional_information": "user_03", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-04-set-favorite/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-04-set-favorite/output index 3ed9e464..f262083c 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-04-set-favorite/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-04-set-favorite/output @@ -8,7 +8,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-08-22T22:14:48Z", "updated_at": "2023-08-28T21:00:00.268653-07:00", "additional_information": "user_04", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-05-set-favorite/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-05-set-favorite/output index 31f1586f..0e2a23ff 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-05-set-favorite/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-05-set-favorite/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-08-22T22:14:49Z", "updated_at": "2023-08-29T19:04:53.130478-07:00", "additional_information": "user_05", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-06-set-tags/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-06-set-tags/output index 6bff826e..0f31eded 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-06-set-tags/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-06-set-tags/output @@ -8,7 +8,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-08-22T22:14:50Z", "updated_at": "2023-09-01T21:58:36.081212-07:00", "additional_information": "user_06", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-07-set-tags/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-07-set-tags/output index 4083c2fb..7bef85f7 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-07-set-tags/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-07-set-tags/output @@ -8,7 +8,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-08-22T22:14:51Z", "updated_at": "2023-09-01T21:58:38.423206-07:00", "additional_information": "user_07", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-09-set-url/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-09-set-url/output index 058d2ebd..875d9f9b 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-09-set-url/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-09-set-url/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-08-22T22:14:53Z", "updated_at": "2023-09-07T13:43:31.347492-07:00", "additional_information": "user_09", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-11-set-url/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-11-set-url/output index da1fce74..6ddc7b90 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-11-set-url/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-11-set-url/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:31Z", "updated_at": "2023-09-07T13:48:50.104181-07:00", "additional_information": "user_11", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-12-set-field-text/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-12-set-field-text/output index 9508dae9..04b1e386 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-12-set-field-text/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-12-set-field-text/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-14T04:25:57Z", "updated_at": "2023-09-26T18:53:19.202625-07:00", "additional_information": "user_12", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-13-set-field-url/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-13-set-field-url/output index 25b2bdaa..b451d438 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-13-set-field-url/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-13-set-field-url/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:33Z", "updated_at": "2023-10-06T10:52:44.448321-07:00", "additional_information": "user_13", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-14-set-field-text/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-14-set-field-text/output index 65fbd624..27dffe13 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-14-set-field-text/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-14-set-field-text/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:34Z", "updated_at": "2023-09-26T21:51:26.449926-07:00", "additional_information": "user_14", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-15-set-field-url/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-15-set-field-url/output index e459e4a6..a5d20f24 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-15-set-field-url/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-15-set-field-url/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:35Z", "updated_at": "2023-10-07T15:38:14.015489-07:00", "additional_information": "user_15", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17-add-text-field/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17-add-text-field/output index bb78616e..ec45f06a 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17-add-text-field/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17-add-text-field/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:37Z", "updated_at": "2023-10-11T19:42:10.408811-07:00", "additional_information": "user_17", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17a-add-text-field/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17a-add-text-field/output index c3aba913..06215fe1 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17a-add-text-field/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17a-add-text-field/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:37Z", "updated_at": "2023-10-12T20:29:55.454791-07:00", "additional_information": "user_17", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17b-add-text-field/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17b-add-text-field/output index b158a624..df1d36fe 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17b-add-text-field/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17b-add-text-field/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:37Z", "updated_at": "2023-10-12T20:42:38.141343-07:00", "additional_information": "user_17", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17c-add-text-field/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17c-add-text-field/output index 5765fe66..886f56b1 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17c-add-text-field/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17c-add-text-field/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:37Z", "updated_at": "2023-10-13T10:28:41.243968-07:00", "additional_information": "user_17", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17d-add-text-field/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17d-add-text-field/output index 514fa6ea..6f5c677f 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17d-add-text-field/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-17d-add-text-field/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:37Z", "updated_at": "2023-10-17T19:30:07.137522-07:00", "additional_information": "user_17", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-21a-delete-field/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-21a-delete-field/output index 9bc680c3..40b2e628 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-21a-delete-field/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-21a-delete-field/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-10-19T03:56:29Z", "updated_at": "2023-10-19T20:22:12.760091-07:00", "additional_information": "user_22", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-21b-delete-field/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-21b-delete-field/output index 11184bdf..6db2ead9 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-21b-delete-field/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-21b-delete-field/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-10-20T04:07:03Z", "updated_at": "2023-10-19T21:08:06.891601-07:00", "additional_information": "user_21", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-23-add-url-field/output b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-23-add-url-field/output index f9390c4a..711fc0ef 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-23-add-url-field/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-edit-example-login-23-add-url-field/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-10-19T03:56:29Z", "updated_at": "2023-10-30T20:19:11.366466-07:00", "additional_information": "user_23", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-03/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-03/output index 223fe642..8b3b2f93 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-03/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-03/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-08-22T22:14:47Z", "updated_at": "2023-08-23T02:52:36Z", "additional_information": "user_03", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-04/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-04/output index c5a5de68..a66fffea 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-04/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-04/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-08-22T22:14:48Z", "updated_at": "2023-08-29T03:59:52Z", "additional_information": "user_04", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-05/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-05/output index 6dfa460d..bdb6d663 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-05/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-05/output @@ -8,7 +8,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-08-22T22:14:49Z", "updated_at": "2023-08-30T01:58:30Z", "additional_information": "user_05", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-06/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-06/output index ac65fd74..bd696ec4 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-06/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-06/output @@ -8,7 +8,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-08-22T22:14:50Z", "updated_at": "2023-09-02T04:55:29Z", "additional_information": "user_06", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-07/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-07/output index 771ec34c..4cf207d1 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-07/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-07/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-08-22T22:14:51Z", "updated_at": "2023-09-02T04:56:21Z", "additional_information": "user_07", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-11/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-11/output index d0adc815..3330d0ca 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-11/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-11/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:31Z", "updated_at": "2023-09-07T20:36:02Z", "additional_information": "user_11", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-12/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-12/output index 3c0caa25..9c8fcc78 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-12/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-12/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-14T04:25:57Z", "updated_at": "2023-09-27T01:50:38Z", "additional_information": "user_12", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-13/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-13/output index b93e2b0a..2a4dd7f3 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-13/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-13/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:33Z", "updated_at": "2023-10-06T17:52:02Z", "additional_information": "user_13", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-14/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-14/output index b127fd7d..7890be26 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-14/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-14/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:34Z", "updated_at": "2023-09-27T04:36:49Z", "additional_information": "user_14", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-15/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-15/output index a8789dc2..ca28f448 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-15/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-15/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:35Z", "updated_at": "2023-10-07T21:35:10Z", "additional_information": "user_15", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-16/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-16/output index 511c808e..258734cc 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-16/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-16/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:36Z", "updated_at": "2023-10-11T02:54:17Z", "additional_information": "user_16", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17/output index 1887ba9f..e53e8097 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:37Z", "updated_at": "2023-10-12T02:25:18Z", "additional_information": "user_17", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17a/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17a/output index 5fc368c9..4853b514 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17a/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17a/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:37Z", "updated_at": "2023-10-13T03:25:35Z", "additional_information": "user_17", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17b/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17b/output index 7bde28e7..1cc7eb2a 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17b/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17b/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:37Z", "updated_at": "2023-10-13T03:40:49Z", "additional_information": "user_17", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17c/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17c/output index 0e69e55e..7cf31f14 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17c/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17c/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:37Z", "updated_at": "2023-10-13T17:25:15Z", "additional_information": "user_17", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17d/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17d/output index 80a70979..481e5b75 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17d/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-17d/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:37Z", "updated_at": "2023-10-18T02:24:10Z", "additional_information": "user_17", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-19/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-19/output index c2f7d265..8e516216 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-19/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-19/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:38Z", "updated_at": "2023-10-17T22:34:50Z", "additional_information": "user_19", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-20/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-20/output index 12df5a8d..71bc3f19 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-20/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-20/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-09-07T20:31:38Z", "updated_at": "2023-10-18T02:50:52Z", "additional_information": "user_19", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-21a/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-21a/output index 18080d04..8375a186 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-21a/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-21a/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-10-19T03:56:29Z", "updated_at": "2023-10-20T03:21:38Z", "additional_information": "user_22", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-21b/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-21b/output index 6a512ac8..4626eba6 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-21b/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-21b/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-10-20T04:07:03Z", "updated_at": "2023-10-20T04:07:49Z", "additional_information": "user_21", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-23/output b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-23/output index 0940032d..7f85ab17 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-23/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/item-get-example-login-23/output @@ -7,7 +7,7 @@ "name": "Test Data 2" }, "category": "LOGIN", - "last_edited_by": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "last_edited_by": "IT52W465L3IOUUUCSD3WBNL26M", "created_at": "2023-10-19T03:56:29Z", "updated_at": "2023-10-31T03:16:52Z", "additional_information": "user_23", diff --git a/tests/config/mock-op/responses-item-edit/responses-1/list-signed-in-accounts/output b/tests/config/mock-op/responses-item-edit/responses-1/list-signed-in-accounts/output index e4d885fe..4544134d 100644 --- a/tests/config/mock-op/responses-item-edit/responses-1/list-signed-in-accounts/output +++ b/tests/config/mock-op/responses-item-edit/responses-1/list-signed-in-accounts/output @@ -14,7 +14,7 @@ { "url": "pyonepassword.1password.com", "email": "uid000@gmail.com", - "user_uuid": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" } ] diff --git a/tests/config/mock-op/responses-item-edit/responses-2/list-signed-in-accounts/output b/tests/config/mock-op/responses-item-edit/responses-2/list-signed-in-accounts/output index e4d885fe..4544134d 100644 --- a/tests/config/mock-op/responses-item-edit/responses-2/list-signed-in-accounts/output +++ b/tests/config/mock-op/responses-item-edit/responses-2/list-signed-in-accounts/output @@ -14,7 +14,7 @@ { "url": "pyonepassword.1password.com", "email": "uid000@gmail.com", - "user_uuid": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" } ] diff --git a/tests/config/mock-op/responses-svc-acct-corrupt/list-signed-in-accounts/output b/tests/config/mock-op/responses-svc-acct-corrupt/list-signed-in-accounts/output index f83f2c73..03c09b68 100644 --- a/tests/config/mock-op/responses-svc-acct-corrupt/list-signed-in-accounts/output +++ b/tests/config/mock-op/responses-svc-acct-corrupt/list-signed-in-accounts/output @@ -8,7 +8,7 @@ { "url": "pyonepassword.1password.com", "email": "uid000@gmail.com", - "user_uuid": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" }, { diff --git a/tests/config/mock-op/responses-svc-acct-revoked-token/list-signed-in-accounts/output b/tests/config/mock-op/responses-svc-acct-revoked-token/list-signed-in-accounts/output index b7541db9..9bfa4bee 100644 --- a/tests/config/mock-op/responses-svc-acct-revoked-token/list-signed-in-accounts/output +++ b/tests/config/mock-op/responses-svc-acct-revoked-token/list-signed-in-accounts/output @@ -14,7 +14,7 @@ { "url": "pyonepassword.1password.com", "email": "uid000@gmail.com", - "user_uuid": "4J4NLDK7GFAXJFOR7RF2KDUAMI", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" } ] From 61c43867b6bd6fa7958c1bd3ee1c051738189f73 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 5 Dec 2023 21:47:27 -0800 Subject: [PATCH 23/52] mock-op query definitions to support user-edit --- .../user-edit/travel-mode/user-edit-1.cfg | 28 +++++++++++++++++ .../user-edit/travel-mode/user-edit-2.cfg | 31 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 tests/config/mock-op/response-generation/user-edit/travel-mode/user-edit-1.cfg create mode 100644 tests/config/mock-op/response-generation/user-edit/travel-mode/user-edit-2.cfg diff --git a/tests/config/mock-op/response-generation/user-edit/travel-mode/user-edit-1.cfg b/tests/config/mock-op/response-generation/user-edit/travel-mode/user-edit-1.cfg new file mode 100644 index 00000000..0409aa63 --- /dev/null +++ b/tests/config/mock-op/response-generation/user-edit/travel-mode/user-edit-1.cfg @@ -0,0 +1,28 @@ +[MAIN] +config-path = ./tests/config/mock-op/responses-user-edit/travel-mode +response-path = responses-1 +input-path = input +response-dir-file = response-directory-1.json +state-iteration = 0 +state-config = ./tests/config/mock-op/responses-user-edit/travel-mode/user-edit-state-config.json + +# be sure to first perform whoami-account-uuid and user-get-user-to-edit from user-edit-1-private + + +[cli-version] +type = cli-version +enabled = true + +[list-signed-in-accounts] +type = account-list +enabled = true + +[whoami] +type = whoami +enabled = true + +[user-edit-set-travel-mode] +type = user-edit +user_identifier = 4J4NLDK7GFAXJFOR7RF2KDUAMI +travel-mode = true +changes-state = true diff --git a/tests/config/mock-op/response-generation/user-edit/travel-mode/user-edit-2.cfg b/tests/config/mock-op/response-generation/user-edit/travel-mode/user-edit-2.cfg new file mode 100644 index 00000000..c018dac7 --- /dev/null +++ b/tests/config/mock-op/response-generation/user-edit/travel-mode/user-edit-2.cfg @@ -0,0 +1,31 @@ +[MAIN] +config-path = ./tests/config/mock-op/responses-user-edit/travel-mode +response-path = responses-2 +input-path = input +response-dir-file = response-directory-2.json +state-iteration = 1 +state-config = ./tests/config/mock-op/responses-user-edit/travel-mode/user-edit-state-config.json + +# be sure to first perform whoami-account-uuid and user-get-user-to-edit from user-edit-2-private + + +[cli-version] +type = cli-version +enabled = true + +[list-signed-in-accounts] +type = account-list +enabled = true + +[whoami] +type = whoami +enabled = true + +[user-edit-disable-travel-mode] +type = user-edit +user_identifier = 4J4NLDK7GFAXJFOR7RF2KDUAMI +travel-mode = false +changes-state = true + +# be sure to run user-edit-3-private after this or the +# above response will overflow when iterating From 45bcb7a546977fc1075dcffc541143cdc48cb2d6 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 5 Dec 2023 21:48:01 -0800 Subject: [PATCH 24/52] add query responses for 'op user edit' operations --- .../travel-mode/response-directory-1.json | 51 +++++++++++++++++++ .../travel-mode/response-directory-2.json | 51 +++++++++++++++++++ .../travel-mode/response-directory-3.json | 23 +++++++++ .../responses-1/cli-version/error_output | 0 .../responses-1/cli-version/output | 1 + .../list-signed-in-accounts/error_output | 0 .../list-signed-in-accounts/output | 20 ++++++++ .../user-edit-set-travel-mode/error_output | 0 .../user-edit-set-travel-mode/output | 0 .../user-get-user-to-edit/error_output | 0 .../responses-1/user-get-user-to-edit/output | 10 ++++ .../whoami-account-uuid/error_output | 0 .../responses-1/whoami-account-uuid/output | 6 +++ .../responses-1/whoami/error_output | 0 .../travel-mode/responses-1/whoami/output | 6 +++ .../responses-2/cli-version/error_output | 0 .../responses-2/cli-version/output | 1 + .../list-signed-in-accounts/error_output | 0 .../list-signed-in-accounts/output | 20 ++++++++ .../error_output | 0 .../user-edit-disable-travel-mode/output | 0 .../user-get-user-to-edit/error_output | 0 .../responses-2/user-get-user-to-edit/output | 10 ++++ .../whoami-account-uuid/error_output | 0 .../responses-2/whoami-account-uuid/output | 6 +++ .../responses-2/whoami/error_output | 0 .../travel-mode/responses-2/whoami/output | 6 +++ .../user-get-user-to-edit/error_output | 0 .../responses-3/user-get-user-to-edit/output | 10 ++++ .../whoami-account-uuid/error_output | 0 .../responses-3/whoami-account-uuid/output | 6 +++ .../travel-mode/user-edit-state-config.json | 27 ++++++++++ 32 files changed, 254 insertions(+) create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/response-directory-1.json create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/response-directory-2.json create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/response-directory-3.json create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/cli-version/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/cli-version/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/list-signed-in-accounts/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/list-signed-in-accounts/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-edit-set-travel-mode/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-edit-set-travel-mode/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-user-to-edit/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-user-to-edit/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami-account-uuid/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami-account-uuid/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-2/cli-version/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-2/cli-version/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-2/list-signed-in-accounts/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-2/list-signed-in-accounts/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-edit-disable-travel-mode/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-edit-disable-travel-mode/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-get-user-to-edit/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-get-user-to-edit/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami-account-uuid/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami-account-uuid/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-3/user-get-user-to-edit/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-3/user-get-user-to-edit/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-3/whoami-account-uuid/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-3/whoami-account-uuid/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/user-edit-state-config.json diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-1.json b/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-1.json new file mode 100644 index 00000000..d25cfb91 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-1.json @@ -0,0 +1,51 @@ +{ + "meta": { + "response_dir": "tests/config/mock-op/responses-user-edit/travel-mode/responses-1", + "input_dir": "input" + }, + "commands": { + "--account|IT52W465L3IOUUUCSD3WBNL26M|--format|json|whoami": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "whoami-account-uuid", + "changes_state": false + }, + "--format|json|user|get|Example User": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-get-user-to-edit", + "changes_state": false + }, + "--version": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "cli-version", + "changes_state": false + }, + "--format|json|account|list": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "list-signed-in-accounts", + "changes_state": false + }, + "--format|json|whoami": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "whoami", + "changes_state": false + }, + "--format|json|user|edit|IT52W465L3IOUUUCSD3WBNL26M|--travel-mode|on": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-edit-set-travel-mode", + "changes_state": true + } + }, + "commands_with_input": {} +} \ No newline at end of file diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-2.json b/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-2.json new file mode 100644 index 00000000..0d8b684c --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-2.json @@ -0,0 +1,51 @@ +{ + "meta": { + "response_dir": "tests/config/mock-op/responses-user-edit/travel-mode/responses-2", + "input_dir": "input" + }, + "commands": { + "--account|IT52W465L3IOUUUCSD3WBNL26M|--format|json|whoami": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "whoami-account-uuid", + "changes_state": false + }, + "--format|json|user|get|Example User": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-get-user-to-edit", + "changes_state": false + }, + "--version": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "cli-version", + "changes_state": false + }, + "--format|json|account|list": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "list-signed-in-accounts", + "changes_state": false + }, + "--format|json|whoami": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "whoami", + "changes_state": false + }, + "--format|json|user|edit|IT52W465L3IOUUUCSD3WBNL26M|--travel-mode|off": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-edit-disable-travel-mode", + "changes_state": true + } + }, + "commands_with_input": {} +} \ No newline at end of file diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-3.json b/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-3.json new file mode 100644 index 00000000..92882387 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-3.json @@ -0,0 +1,23 @@ +{ + "meta": { + "response_dir": "tests/config/mock-op/responses-user-edit/travel-mode/responses-3", + "input_dir": "input" + }, + "commands": { + "--account|IT52W465L3IOUUUCSD3WBNL26M|--format|json|whoami": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "whoami-account-uuid", + "changes_state": false + }, + "--format|json|user|get|Example User": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-get-user-to-edit", + "changes_state": false + } + }, + "commands_with_input": {} +} \ No newline at end of file diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/cli-version/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/cli-version/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/cli-version/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/cli-version/output new file mode 100644 index 00000000..e9763f6b --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/cli-version/output @@ -0,0 +1 @@ +2.23.0 diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/list-signed-in-accounts/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/list-signed-in-accounts/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/list-signed-in-accounts/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/list-signed-in-accounts/output new file mode 100644 index 00000000..9d30b597 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/list-signed-in-accounts/output @@ -0,0 +1,20 @@ +[ + { + "url": "pyonepassword.1password.com", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" + }, + { + "url": "my.1password.com", + "email": "guest_user@example.email", + "user_uuid": "DJGTGRFRM5C4BHNUXQLJXQJAOE", + "account_uuid": "6J7RFGQWONBVJHIHJUVICO2C3Q" + }, + { + "url": "example-account.1password.com", + "email": "example_user@example.email", + "user_uuid": "5GHHPJK5HZC5BAT7WDUXW57G44", + "account_uuid": "GRXJAN4BY5DPROISKYL55IRCPY" + } +] diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-edit-set-travel-mode/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-edit-set-travel-mode/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-edit-set-travel-mode/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-edit-set-travel-mode/output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-user-to-edit/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-user-to-edit/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-user-to-edit/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-user-to-edit/output new file mode 100644 index 00000000..b47dd96e --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-user-to-edit/output @@ -0,0 +1,10 @@ +{ + "id": "IT52W465L3IOUUUCSD3WBNL26M", + "name": "Example User", + "email": "uid000@gmail.com", + "type": "MEMBER", + "state": "ACTIVE", + "created_at": "2023-03-14T23:05:57Z", + "updated_at": "2023-12-06T05:41:25Z", + "last_auth_at": "2023-12-06T05:38:15Z" +} diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami-account-uuid/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami-account-uuid/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami-account-uuid/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami-account-uuid/output new file mode 100644 index 00000000..b866ab41 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami-account-uuid/output @@ -0,0 +1,6 @@ +{ + "url": "https://pyonepassword.1password.com/", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" +} diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami/output new file mode 100644 index 00000000..b866ab41 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/whoami/output @@ -0,0 +1,6 @@ +{ + "url": "https://pyonepassword.1password.com/", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" +} diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/cli-version/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/cli-version/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/cli-version/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/cli-version/output new file mode 100644 index 00000000..e9763f6b --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/cli-version/output @@ -0,0 +1 @@ +2.23.0 diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/list-signed-in-accounts/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/list-signed-in-accounts/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/list-signed-in-accounts/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/list-signed-in-accounts/output new file mode 100644 index 00000000..9d30b597 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/list-signed-in-accounts/output @@ -0,0 +1,20 @@ +[ + { + "url": "pyonepassword.1password.com", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" + }, + { + "url": "my.1password.com", + "email": "guest_user@example.email", + "user_uuid": "DJGTGRFRM5C4BHNUXQLJXQJAOE", + "account_uuid": "6J7RFGQWONBVJHIHJUVICO2C3Q" + }, + { + "url": "example-account.1password.com", + "email": "example_user@example.email", + "user_uuid": "5GHHPJK5HZC5BAT7WDUXW57G44", + "account_uuid": "GRXJAN4BY5DPROISKYL55IRCPY" + } +] diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-edit-disable-travel-mode/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-edit-disable-travel-mode/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-edit-disable-travel-mode/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-edit-disable-travel-mode/output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-get-user-to-edit/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-get-user-to-edit/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-get-user-to-edit/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-get-user-to-edit/output new file mode 100644 index 00000000..5618a515 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/user-get-user-to-edit/output @@ -0,0 +1,10 @@ +{ + "id": "IT52W465L3IOUUUCSD3WBNL26M", + "name": "Example User", + "email": "uid000@gmail.com", + "type": "MEMBER", + "state": "ACTIVE", + "created_at": "2023-03-14T23:05:57Z", + "updated_at": "2023-12-06T05:42:52Z", + "last_auth_at": "2023-12-06T05:38:15Z" +} diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami-account-uuid/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami-account-uuid/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami-account-uuid/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami-account-uuid/output new file mode 100644 index 00000000..b866ab41 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami-account-uuid/output @@ -0,0 +1,6 @@ +{ + "url": "https://pyonepassword.1password.com/", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" +} diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami/output new file mode 100644 index 00000000..b866ab41 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-2/whoami/output @@ -0,0 +1,6 @@ +{ + "url": "https://pyonepassword.1password.com/", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" +} diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-3/user-get-user-to-edit/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-3/user-get-user-to-edit/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-3/user-get-user-to-edit/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-3/user-get-user-to-edit/output new file mode 100644 index 00000000..935dac93 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-3/user-get-user-to-edit/output @@ -0,0 +1,10 @@ +{ + "id": "IT52W465L3IOUUUCSD3WBNL26M", + "name": "Example User", + "email": "uid000@gmail.com", + "type": "MEMBER", + "state": "ACTIVE", + "created_at": "2023-03-14T23:05:57Z", + "updated_at": "2023-12-06T05:42:54Z", + "last_auth_at": "2023-12-06T05:38:15Z" +} diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-3/whoami-account-uuid/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-3/whoami-account-uuid/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-3/whoami-account-uuid/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-3/whoami-account-uuid/output new file mode 100644 index 00000000..b866ab41 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-3/whoami-account-uuid/output @@ -0,0 +1,6 @@ +{ + "url": "https://pyonepassword.1password.com/", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" +} diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/user-edit-state-config.json b/tests/config/mock-op/responses-user-edit/travel-mode/user-edit-state-config.json new file mode 100644 index 00000000..f563659e --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/user-edit-state-config.json @@ -0,0 +1,27 @@ +{ + "iteration": 0, + "max-iterations": 3, + "state-list": [ + { + "response-directory": "tests/config/mock-op/responses-user-edit/travel-mode/response-directory-1.json", + "env-vars": { + "set": {}, + "pop": [] + } + }, + { + "response-directory": "tests/config/mock-op/responses-user-edit/travel-mode/response-directory-2.json", + "env-vars": { + "set": {}, + "pop": [] + } + }, + { + "response-directory": "tests/config/mock-op/responses-user-edit/travel-mode/response-directory-3.json", + "env-vars": { + "set": {}, + "pop": [] + } + } + ] +} \ No newline at end of file From 3f64e9fc922f11fabf51d4461c3fb35f75bbac5e Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 5 Dec 2023 21:48:40 -0800 Subject: [PATCH 25/52] add path constants for user-edit response directory --- tests/fixtures/paths.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/fixtures/paths.py b/tests/fixtures/paths.py index 1db44a32..2bde9247 100644 --- a/tests/fixtures/paths.py +++ b/tests/fixtures/paths.py @@ -30,6 +30,12 @@ DOCUMENT_EDIT_RESP_PATH, "document-edit-state-config.json" ) +USER_EDIT_TRAVEL_MODE_RESP_PATH = Path( + MOCK_OP_CONFIG_PATH, "responses-user-edit", "travel-mode" +) +USER_EDIT_TRAVEL_MODE_STATE_CONFIG_PATH = Path( + USER_EDIT_TRAVEL_MODE_RESP_PATH, "user-edit-state-config.json" +) UNAUTH_RESP_DIRECTORY_PATH = Path( MOCK_OP_CONFIG_PATH, "unauth-response-directory.json") From 35865e60eb98fce477bea41259edd5610ada958b Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 5 Dec 2023 21:49:46 -0800 Subject: [PATCH 26/52] add test fixtures to support user-edit travel-mode tests --- tests/fixtures/op_fixtures.py | 37 ++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/tests/fixtures/op_fixtures.py b/tests/fixtures/op_fixtures.py index 8c3d9de9..4397dc90 100644 --- a/tests/fixtures/op_fixtures.py +++ b/tests/fixtures/op_fixtures.py @@ -50,7 +50,8 @@ SVC_ACCT_NOT_YET_AUTH_STATE_CONFIG_PATH, SVC_ACCT_RESP_DIRECTORY_PATH, SVC_ACCT_REVOKED_RESP_DIRECTORY_PATH, - UNAUTH_RESP_DIRECTORY_PATH + UNAUTH_RESP_DIRECTORY_PATH, + USER_EDIT_TRAVEL_MODE_STATE_CONFIG_PATH ) from .platform_support import HOME_ENV_VAR from .valid_data import ValidData @@ -63,6 +64,7 @@ TEST_DATA_VAULT = "Test Data" OP_MASTER_PASSWORD = "made-up-password" ACCOUNT_ID = "5GHHPJK5HZC5BAT7WDUXW57G44" +TEAM_USER_ID = "IT52W465L3IOUUUCSD3WBNL26M" # set up console logger early, because pytest comes behind and messes with sys.stderr/sys.stdout # otherwise anomolies happen like duplicated log messages, etc. @@ -264,6 +266,33 @@ def setup_stateful_document_edit(): # temp_dir will get cleaned up once we return +@fixture +def setup_stateful_user_edit_travel_mode(): + + # set up a temporary directory to copy the state config to, since it gets modified + # during state iteration + config_file_name = USER_EDIT_TRAVEL_MODE_STATE_CONFIG_PATH.name + temp_dir = tempfile.TemporaryDirectory() + state_config_dir = temp_dir.name + state_config_path = Path(state_config_dir, config_file_name) + shutil.copyfile( + USER_EDIT_TRAVEL_MODE_STATE_CONFIG_PATH, state_config_path) + + # now pop MOCK_OP_RESPONSE_DIRECTORY to ensure it doesn't conflict with with + # the stateful config + old_mock_op_resp_dir = os.environ.pop("MOCK_OP_RESPONSE_DIRECTORY", None) + os.environ["MOCK_OP_STATE_DIR"] = str(state_config_path) + yield # pytest will return us here after the test runs + # get rid of MOCK_OP_STATE_DIR + os.environ.pop("MOCK_OP_STATE_DIR") + + # restore MOCK_OP_RESPONSE_DIRECTORY if it was previously set + if old_mock_op_resp_dir is not None: + os.environ["MOCK_OP_RESPONSE_DIRECTORY"] = old_mock_op_resp_dir + + # temp_dir will get cleaned up once we return + + @fixture def setup_stateful_svc_acct_auth(): config_file_name = SVC_ACCT_NOT_YET_AUTH_STATE_CONFIG_PATH.name @@ -377,6 +406,12 @@ def signed_in_op(): return op +@fixture +def signed_in_team_account_op(): + op = _get_signed_in_op(account_id=TEAM_USER_ID) + return op + + @fixture def signed_in_op_svc_acct(): op = _get_signed_in_op(account_id=None, skip_env=True, no_password=True) From 82dd4d7c67030b1341ed9fd5f0f8ee6a976e7499 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 5 Dec 2023 21:50:15 -0800 Subject: [PATCH 27/52] add test module for user-edit travel-mode --- .../user/edit/test_user_edit_travel_mode.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/test_op_api/user/edit/test_user_edit_travel_mode.py diff --git a/tests/test_op_api/user/edit/test_user_edit_travel_mode.py b/tests/test_op_api/user/edit/test_user_edit_travel_mode.py new file mode 100644 index 00000000..a460cb2a --- /dev/null +++ b/tests/test_op_api/user/edit/test_user_edit_travel_mode.py @@ -0,0 +1,35 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from pyonepassword import OP + + +import pytest + +pytestmark = pytest.mark.usefixtures("valid_op_cli_config_homedir") + + +@pytest.mark.usefixtures("setup_stateful_user_edit_travel_mode") +def test_user_edit_01(signed_in_team_account_op: OP): + """ + Test: + + Verify: + + """ + # There isn't, as of this writing, any way to verify travel mode has been turned + # on or off + # nothing about travel mode shows up in `op user get`, + # and for reasons that aren't clear, travel mode restrictions only affect the apps, + # not `op item get/list` or `op vault list`, so it's not possible to check if a user + # has/does not have access to something when travel mode is enabled + # + # so there isn't really much to test here other than: + # - we're constructing the CLI arguments correctly + # - mock-op has a corresponding response to those CLI args + # - nothing blew up when the response generator ran `op` with those args + user_id = "Example User" + signed_in_team_account_op.user_edit(user_id, travel_mode=True) + signed_in_team_account_op.user_edit(user_id, travel_mode=False) From 5450a50b62b9b3ee612fa9b4d0b201ce86bad799 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 12 Dec 2023 13:35:14 -0800 Subject: [PATCH 28/52] fix return type for OP.user_edit() --- pyonepassword/pyonepassword.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyonepassword/pyonepassword.py b/pyonepassword/pyonepassword.py index 5e4a4a0e..eba0c6b9 100644 --- a/pyonepassword/pyonepassword.py +++ b/pyonepassword/pyonepassword.py @@ -1647,7 +1647,7 @@ def user_get(self, user_name_or_id: str) -> OPUser: def user_edit(self, user_name_or_id: str, new_name: Optional[str] = None, - travel_mode: Optional[bool] = None) -> OPUser: + travel_mode: Optional[bool] = None) -> str: """ Edit the details for the user specified by name or unique ID. From 057ab0fbce713d2b1b67a5ea0fec7d36c2899bd5 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 12 Dec 2023 13:35:43 -0800 Subject: [PATCH 29/52] export OPUserEditException from api.exceptions --- pyonepassword/api/exceptions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyonepassword/api/exceptions.py b/pyonepassword/api/exceptions.py index cd8fd612..9ccccfac 100644 --- a/pyonepassword/api/exceptions.py +++ b/pyonepassword/api/exceptions.py @@ -46,6 +46,7 @@ OPSigninException, OPSignoutException, OPUnknownAccountException, + OPUserEditException, OPUserGetException, OPUserListException, OPVaultGetException, @@ -93,6 +94,7 @@ "OPSvcAcctCommandNotSupportedException", "OPUnknownAccountException", "OPUnknownItemTypeException", + "OPUserEditException", "OPUserGetException", "OPUserListException", "OPVaultGetException", From ebd522c6d37fb62330b351b1c96f30251f1890fd Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 12 Dec 2023 13:36:41 -0800 Subject: [PATCH 30/52] add user edit query definitions for non-existent users --- .../user-edit/travel-mode/user-edit-1.cfg | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/config/mock-op/response-generation/user-edit/travel-mode/user-edit-1.cfg b/tests/config/mock-op/response-generation/user-edit/travel-mode/user-edit-1.cfg index 0409aa63..3971d1f3 100644 --- a/tests/config/mock-op/response-generation/user-edit/travel-mode/user-edit-1.cfg +++ b/tests/config/mock-op/response-generation/user-edit/travel-mode/user-edit-1.cfg @@ -11,18 +11,35 @@ state-config = ./tests/config/mock-op/responses-user-edit/travel-mode/user-edit- [cli-version] type = cli-version -enabled = true +enabled = false [list-signed-in-accounts] type = account-list -enabled = true +enabled = false [whoami] type = whoami -enabled = true +enabled = false [user-edit-set-travel-mode] type = user-edit user_identifier = 4J4NLDK7GFAXJFOR7RF2KDUAMI travel-mode = true changes-state = true +enabled = false + +[user-get-no-such-user] +type = user-get +# non-existent user +user_identifier = no-such-user +changes-state = false +expected-return = 1 +enabled = false + +[user-get-invalid-user-id] +type = user-get +# non-existent user +user_identifier = TQ2EKE3TPSK4YDFRMLRVG54Y4U +changes-state = false +expected-return = 4 +enabled = false From 8ce89f858bef1421c7dcb713cfe65071d3ad8759 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 12 Dec 2023 13:37:23 -0800 Subject: [PATCH 31/52] add user-edit query responses for non-existent user --- .../travel-mode/response-directory-1.json | 14 ++++++++++++++ .../user-get-invalid-user-id/error_output | 1 + .../responses-1/user-get-invalid-user-id/output | 0 .../responses-1/user-get-no-such-user/error_output | 1 + .../responses-1/user-get-no-such-user/output | 0 5 files changed, 16 insertions(+) create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-invalid-user-id/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-invalid-user-id/output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-no-such-user/error_output create mode 100644 tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-no-such-user/output diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-1.json b/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-1.json index d25cfb91..62e6b70d 100644 --- a/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-1.json +++ b/tests/config/mock-op/responses-user-edit/travel-mode/response-directory-1.json @@ -45,6 +45,20 @@ "stderr": "error_output", "name": "user-edit-set-travel-mode", "changes_state": true + }, + "--format|json|user|get|no-such-user": { + "exit_status": 1, + "stdout": "output", + "stderr": "error_output", + "name": "user-get-no-such-user", + "changes_state": false + }, + "--format|json|user|get|TQ2EKE3TPSK4YDFRMLRVG54Y4U": { + "exit_status": 4, + "stdout": "output", + "stderr": "error_output", + "name": "user-get-invalid-user-id", + "changes_state": false } }, "commands_with_input": {} diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-invalid-user-id/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-invalid-user-id/error_output new file mode 100644 index 00000000..2c063631 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-invalid-user-id/error_output @@ -0,0 +1 @@ +[ERROR] 2023/12/12 13:19:34 (404) Not Found: The requested resource was not found. diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-invalid-user-id/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-invalid-user-id/output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-no-such-user/error_output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-no-such-user/error_output new file mode 100644 index 00000000..198ab20a --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-no-such-user/error_output @@ -0,0 +1 @@ +[ERROR] 2023/12/12 13:19:33 "no-such-user" isn't a user in this account. Specify the user with their UUID, email address, or name. diff --git a/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-no-such-user/output b/tests/config/mock-op/responses-user-edit/travel-mode/responses-1/user-get-no-such-user/output new file mode 100644 index 00000000..e69de29b From 85fc6fb9e92ad395539e732dca5134eee3096e9e Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 12 Dec 2023 13:38:28 -0800 Subject: [PATCH 32/52] update docstring for test_user_edit_010 --- .../test_op_api/user/edit/test_user_edit_travel_mode.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_op_api/user/edit/test_user_edit_travel_mode.py b/tests/test_op_api/user/edit/test_user_edit_travel_mode.py index a460cb2a..874ab665 100644 --- a/tests/test_op_api/user/edit/test_user_edit_travel_mode.py +++ b/tests/test_op_api/user/edit/test_user_edit_travel_mode.py @@ -12,11 +12,14 @@ @pytest.mark.usefixtures("setup_stateful_user_edit_travel_mode") -def test_user_edit_01(signed_in_team_account_op: OP): +def test_user_edit_010(signed_in_team_account_op: OP): """ - Test: - + Test: OP.user_edit() + - set travel mode on for a user + - set travel mode off for the same user Verify: + - No exception is raised for either operation + - The user name is correctly converted to the expected user ID for both edit operations """ # There isn't, as of this writing, any way to verify travel mode has been turned From a01b471870e918a75eadee25c4ae0061255dbaec Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 12 Dec 2023 13:39:20 -0800 Subject: [PATCH 33/52] add user-edit assertions for correct returned user ID --- .../user/edit/test_user_edit_travel_mode.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_op_api/user/edit/test_user_edit_travel_mode.py b/tests/test_op_api/user/edit/test_user_edit_travel_mode.py index 874ab665..87387bdb 100644 --- a/tests/test_op_api/user/edit/test_user_edit_travel_mode.py +++ b/tests/test_op_api/user/edit/test_user_edit_travel_mode.py @@ -33,6 +33,14 @@ def test_user_edit_010(signed_in_team_account_op: OP): # - we're constructing the CLI arguments correctly # - mock-op has a corresponding response to those CLI args # - nothing blew up when the response generator ran `op` with those args - user_id = "Example User" - signed_in_team_account_op.user_edit(user_id, travel_mode=True) - signed_in_team_account_op.user_edit(user_id, travel_mode=False) + # - user name gets converted to expected user ID + user_name = "Example User" + expected_user_id = "IT52W465L3IOUUUCSD3WBNL26M" + + edited_user_id = signed_in_team_account_op.user_edit( + user_name, travel_mode=True) + assert edited_user_id == expected_user_id + + edited_user_id = signed_in_team_account_op.user_edit( + user_name, travel_mode=False) + assert edited_user_id == expected_user_id From 5be2883aaa04ac6ea85e03a49d14a2bfc8369026 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Tue, 12 Dec 2023 14:17:27 -0800 Subject: [PATCH 34/52] add user-edit test cases for non-existent users --- .../user/edit/test_user_edit_travel_mode.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/test_op_api/user/edit/test_user_edit_travel_mode.py b/tests/test_op_api/user/edit/test_user_edit_travel_mode.py index 87387bdb..6e290e22 100644 --- a/tests/test_op_api/user/edit/test_user_edit_travel_mode.py +++ b/tests/test_op_api/user/edit/test_user_edit_travel_mode.py @@ -2,6 +2,8 @@ from typing import TYPE_CHECKING +from pyonepassword.api.exceptions import OPUserEditException + if TYPE_CHECKING: from pyonepassword import OP @@ -44,3 +46,29 @@ def test_user_edit_010(signed_in_team_account_op: OP): edited_user_id = signed_in_team_account_op.user_edit( user_name, travel_mode=False) assert edited_user_id == expected_user_id + + +@pytest.mark.usefixtures("setup_stateful_user_edit_travel_mode") +def test_user_edit_020(signed_in_team_account_op: OP): + """ + Test: OP.user_edit() + - Edit a user, providing a user name for a non-existent user + Verify: + - OPUserEditException is raised + """ + user_id = "no-such-user" + with pytest.raises(OPUserEditException): + signed_in_team_account_op.user_edit(user_id, travel_mode=True) + + +@pytest.mark.usefixtures("setup_stateful_user_edit_travel_mode") +def test_user_edit_030(signed_in_team_account_op: OP): + """ + Test: OP.user_edit() + - Edit a user, providing a user ID for a non-existent user + Verify: + - OPUserEditException is raised + """ + invalid_user_id = "TQ2EKE3TPSK4YDFRMLRVG54Y4U" + with pytest.raises(OPUserEditException): + signed_in_team_account_op.user_edit(invalid_user_id, travel_mode=True) From c51b3e83a8d05cca9afad0178b9daf18213c80ec Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Fri, 15 Dec 2023 22:02:18 -0800 Subject: [PATCH 35/52] rename test cases for user-edit travel-mode --- tests/test_op_api/user/edit/test_user_edit_travel_mode.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_op_api/user/edit/test_user_edit_travel_mode.py b/tests/test_op_api/user/edit/test_user_edit_travel_mode.py index 6e290e22..de68156e 100644 --- a/tests/test_op_api/user/edit/test_user_edit_travel_mode.py +++ b/tests/test_op_api/user/edit/test_user_edit_travel_mode.py @@ -14,7 +14,7 @@ @pytest.mark.usefixtures("setup_stateful_user_edit_travel_mode") -def test_user_edit_010(signed_in_team_account_op: OP): +def test_user_edit_travel_mode_010(signed_in_team_account_op: OP): """ Test: OP.user_edit() - set travel mode on for a user @@ -49,7 +49,7 @@ def test_user_edit_010(signed_in_team_account_op: OP): @pytest.mark.usefixtures("setup_stateful_user_edit_travel_mode") -def test_user_edit_020(signed_in_team_account_op: OP): +def test_user_edit_travel_mode_020(signed_in_team_account_op: OP): """ Test: OP.user_edit() - Edit a user, providing a user name for a non-existent user @@ -62,7 +62,7 @@ def test_user_edit_020(signed_in_team_account_op: OP): @pytest.mark.usefixtures("setup_stateful_user_edit_travel_mode") -def test_user_edit_030(signed_in_team_account_op: OP): +def test_user_edit_travel_mode_030(signed_in_team_account_op: OP): """ Test: OP.user_edit() - Edit a user, providing a user ID for a non-existent user From 59083196ddeaf6c4b45f06a2d205b22b4d633188 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Fri, 15 Dec 2023 22:03:01 -0800 Subject: [PATCH 36/52] add response-generator query definitions: - user-edit new-user-name --- .../user-edit/new-user-name/user-edit-1.cfg | 49 ++++++++++++++++ .../user-edit/new-user-name/user-edit-2.cfg | 57 +++++++++++++++++++ .../user-edit/new-user-name/user-edit-3.cfg | 29 ++++++++++ 3 files changed, 135 insertions(+) create mode 100644 tests/config/mock-op/response-generation/user-edit/new-user-name/user-edit-1.cfg create mode 100644 tests/config/mock-op/response-generation/user-edit/new-user-name/user-edit-2.cfg create mode 100644 tests/config/mock-op/response-generation/user-edit/new-user-name/user-edit-3.cfg diff --git a/tests/config/mock-op/response-generation/user-edit/new-user-name/user-edit-1.cfg b/tests/config/mock-op/response-generation/user-edit/new-user-name/user-edit-1.cfg new file mode 100644 index 00000000..e796f3ba --- /dev/null +++ b/tests/config/mock-op/response-generation/user-edit/new-user-name/user-edit-1.cfg @@ -0,0 +1,49 @@ +[MAIN] +config-path = ./tests/config/mock-op/responses-user-edit/new-user-name +response-path = responses-1 +input-path = input +response-dir-file = response-directory-1.json +state-iteration = 0 +state-config = ./tests/config/mock-op/responses-user-edit/new-user-name/user-edit-state-config.json + +# be sure to first perform whoami-account-uuid and user-get-user-to-edit from user-edit-1-private + + +[cli-version] +type = cli-version +enabled = true + +[list-signed-in-accounts] +type = account-list +enabled = true + +[whoami] +type = whoami +enabled = true + +[whoami-account-uuid] +type = whoami +changes-state = false +account_id = 4J4NLDK7GFAXJFOR7RF2KDUAMI +enabled = false + +[user-get-user-to-edit] +# perform user-get on the user we're going to edit later +type = user-get +changes-state = false +user_identifier = Zachary Cutlip +enabled = false + +[user-get-user-to-edit-by-id] +# perform user-get on the user we're going to edit later +type = user-get +changes-state = false +user_identifier = 4J4NLDK7GFAXJFOR7RF2KDUAMI +enabled = false + +[user-edit-set-new-name] +type = user-edit +user_identifier = 4J4NLDK7GFAXJFOR7RF2KDUAMI +new-name = Zachary Cutlip (new) +changes-state = true +enabled = true diff --git a/tests/config/mock-op/response-generation/user-edit/new-user-name/user-edit-2.cfg b/tests/config/mock-op/response-generation/user-edit/new-user-name/user-edit-2.cfg new file mode 100644 index 00000000..44684be3 --- /dev/null +++ b/tests/config/mock-op/response-generation/user-edit/new-user-name/user-edit-2.cfg @@ -0,0 +1,57 @@ +[MAIN] +config-path = ./tests/config/mock-op/responses-user-edit/new-user-name +response-path = responses-2 +input-path = input +response-dir-file = response-directory-2.json +state-iteration = 1 +state-config = ./tests/config/mock-op/responses-user-edit/new-user-name/user-edit-state-config.json + +# be sure to first perform whoami-account-uuid and user-get-user-to-edit from user-edit-2-private + + +[cli-version] +type = cli-version +enabled = false + +[list-signed-in-accounts] +type = account-list +enabled = false + +[whoami] +type = whoami +enabled = false + +[whoami-account-uuid] +type = whoami +changes-state = false +account_id = 4J4NLDK7GFAXJFOR7RF2KDUAMI +enabled = false + +[user-get-user-to-edit] +# perform user-get on the user we're going to edit later +type = user-get +changes-state = false +user_identifier = Zachary Cutlip (new) +enabled = false + +[user-get-orig-user-name] +# perform user-get based on the original user name +type = user-get +changes-state = false +user_identifier = Zachary Cutlip +expected-return = 1 +enabled = false + +[user-get-user-to-edit-by-id] +# perform user-get on the user we're going to edit later +type = user-get +changes-state = false +user_identifier = 4J4NLDK7GFAXJFOR7RF2KDUAMI +enabled = false + +[user-edit-set-name-back-to-orig] +type = user-edit +user_identifier = 4J4NLDK7GFAXJFOR7RF2KDUAMI +new-name = Zachary Cutlip +changes-state = true +enabled = false diff --git a/tests/config/mock-op/response-generation/user-edit/new-user-name/user-edit-3.cfg b/tests/config/mock-op/response-generation/user-edit/new-user-name/user-edit-3.cfg new file mode 100644 index 00000000..9a357ee7 --- /dev/null +++ b/tests/config/mock-op/response-generation/user-edit/new-user-name/user-edit-3.cfg @@ -0,0 +1,29 @@ +[MAIN] +config-path = ./tests/config/mock-op/responses-user-edit/new-user-name +response-path = responses-3 +input-path = input +response-dir-file = response-directory-3.json +state-iteration = 2 +state-config = ./tests/config/mock-op/responses-user-edit/new-user-name/user-edit-state-config.json +# don't set state-config for this file +# No operations here are stateful + +[whoami-account-uuid] +type = whoami +changes-state = false +account_id = 4J4NLDK7GFAXJFOR7RF2KDUAMI +enabled = false + +[user-get-user-to-edit] +# perform user-get on the user we're going to edit later +type = user-get +changes-state = false +user_identifier = Zachary Cutlip +enabled = false + +[user-get-user-to-edit-by-id] +# perform user-get on the user we're going to edit later +type = user-get +changes-state = false +user_identifier = 4J4NLDK7GFAXJFOR7RF2KDUAMI +enabled = false From 5f064f491f38eaa1c020390c8107b8e02d6e1ae6 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Fri, 15 Dec 2023 22:03:52 -0800 Subject: [PATCH 37/52] add response-generator response definitions: - user-edit new-user-name --- .../new-user-name/response-directory-1.json | 58 +++++++++++++++++ .../new-user-name/response-directory-2.json | 65 +++++++++++++++++++ .../new-user-name/response-directory-3.json | 30 +++++++++ .../responses-1/cli-version/error_output | 0 .../responses-1/cli-version/output | 1 + .../list-signed-in-accounts/error_output | 0 .../list-signed-in-accounts/output | 20 ++++++ .../user-edit-set-new-name/error_output | 0 .../responses-1/user-edit-set-new-name/output | 0 .../user-get-user-to-edit-by-id/error_output | 0 .../user-get-user-to-edit-by-id/output | 10 +++ .../user-get-user-to-edit/error_output | 0 .../responses-1/user-get-user-to-edit/output | 10 +++ .../whoami-account-uuid/error_output | 0 .../responses-1/whoami-account-uuid/output | 6 ++ .../responses-1/whoami/error_output | 0 .../new-user-name/responses-1/whoami/output | 6 ++ .../responses-2/cli-version/error_output | 0 .../responses-2/cli-version/output | 1 + .../list-signed-in-accounts/error_output | 0 .../list-signed-in-accounts/output | 20 ++++++ .../error_output | 0 .../user-edit-set-name-back-to-orig/output | 0 .../user-get-orig-user-name/error_output | 1 + .../user-get-orig-user-name/output | 0 .../user-get-user-to-edit-by-id/error_output | 0 .../user-get-user-to-edit-by-id/output | 10 +++ .../user-get-user-to-edit/error_output | 0 .../responses-2/user-get-user-to-edit/output | 10 +++ .../whoami-account-uuid/error_output | 0 .../responses-2/whoami-account-uuid/output | 6 ++ .../responses-2/whoami/error_output | 0 .../new-user-name/responses-2/whoami/output | 6 ++ .../user-get-user-to-edit-by-id/error_output | 0 .../user-get-user-to-edit-by-id/output | 10 +++ .../user-get-user-to-edit/error_output | 0 .../responses-3/user-get-user-to-edit/output | 10 +++ .../whoami-account-uuid/error_output | 0 .../responses-3/whoami-account-uuid/output | 6 ++ .../new-user-name/user-edit-state-config.json | 27 ++++++++ 40 files changed, 313 insertions(+) create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/response-directory-1.json create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/response-directory-2.json create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/response-directory-3.json create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/cli-version/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/cli-version/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/list-signed-in-accounts/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/list-signed-in-accounts/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-edit-set-new-name/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-edit-set-new-name/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit-by-id/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit-by-id/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami-account-uuid/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami-account-uuid/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/cli-version/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/cli-version/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/list-signed-in-accounts/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/list-signed-in-accounts/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-edit-set-name-back-to-orig/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-edit-set-name-back-to-orig/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-orig-user-name/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-orig-user-name/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit-by-id/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit-by-id/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami-account-uuid/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami-account-uuid/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit-by-id/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit-by-id/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-3/whoami-account-uuid/error_output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/responses-3/whoami-account-uuid/output create mode 100644 tests/config/mock-op/responses-user-edit/new-user-name/user-edit-state-config.json diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/response-directory-1.json b/tests/config/mock-op/responses-user-edit/new-user-name/response-directory-1.json new file mode 100644 index 00000000..e0049ced --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/response-directory-1.json @@ -0,0 +1,58 @@ +{ + "meta": { + "response_dir": "tests/config/mock-op/responses-user-edit/new-user-name/responses-1", + "input_dir": "input" + }, + "commands": { + "--account|IT52W465L3IOUUUCSD3WBNL26M|--format|json|whoami": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "whoami-account-uuid", + "changes_state": false + }, + "--format|json|user|get|Example User": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-get-user-to-edit", + "changes_state": false + }, + "--format|json|user|get|IT52W465L3IOUUUCSD3WBNL26M": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-get-user-to-edit-by-id", + "changes_state": false + }, + "--format|json|user|edit|IT52W465L3IOUUUCSD3WBNL26M|--name|Example User (new)": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-edit-set-new-name", + "changes_state": true + }, + "--version": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "cli-version", + "changes_state": false + }, + "--format|json|account|list": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "list-signed-in-accounts", + "changes_state": false + }, + "--format|json|whoami": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "whoami", + "changes_state": false + } + }, + "commands_with_input": {} +} \ No newline at end of file diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/response-directory-2.json b/tests/config/mock-op/responses-user-edit/new-user-name/response-directory-2.json new file mode 100644 index 00000000..e8464d59 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/response-directory-2.json @@ -0,0 +1,65 @@ +{ + "meta": { + "response_dir": "tests/config/mock-op/responses-user-edit/new-user-name/responses-2", + "input_dir": "input" + }, + "commands": { + "--version": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "cli-version", + "changes_state": false + }, + "--format|json|account|list": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "list-signed-in-accounts", + "changes_state": false + }, + "--format|json|whoami": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "whoami", + "changes_state": false + }, + "--account|IT52W465L3IOUUUCSD3WBNL26M|--format|json|whoami": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "whoami-account-uuid", + "changes_state": false + }, + "--format|json|user|get|Example User (new)": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-get-user-to-edit", + "changes_state": false + }, + "--format|json|user|get|IT52W465L3IOUUUCSD3WBNL26M": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-get-user-to-edit-by-id", + "changes_state": false + }, + "--format|json|user|edit|IT52W465L3IOUUUCSD3WBNL26M|--name|Example User": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-edit-set-name-back-to-orig", + "changes_state": true + }, + "--format|json|user|get|Example User": { + "exit_status": 1, + "stdout": "output", + "stderr": "error_output", + "name": "user-get-orig-user-name", + "changes_state": false + } + }, + "commands_with_input": {} +} \ No newline at end of file diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/response-directory-3.json b/tests/config/mock-op/responses-user-edit/new-user-name/response-directory-3.json new file mode 100644 index 00000000..fa79a363 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/response-directory-3.json @@ -0,0 +1,30 @@ +{ + "meta": { + "response_dir": "tests/config/mock-op/responses-user-edit/new-user-name/responses-3", + "input_dir": "input" + }, + "commands": { + "--account|IT52W465L3IOUUUCSD3WBNL26M|--format|json|whoami": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "whoami-account-uuid", + "changes_state": false + }, + "--format|json|user|get|Example User": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-get-user-to-edit", + "changes_state": false + }, + "--format|json|user|get|IT52W465L3IOUUUCSD3WBNL26M": { + "exit_status": 0, + "stdout": "output", + "stderr": "error_output", + "name": "user-get-user-to-edit-by-id", + "changes_state": false + } + }, + "commands_with_input": {} +} \ No newline at end of file diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/cli-version/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/cli-version/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/cli-version/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/cli-version/output new file mode 100644 index 00000000..ad226192 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/cli-version/output @@ -0,0 +1 @@ +2.24.0 diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/list-signed-in-accounts/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/list-signed-in-accounts/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/list-signed-in-accounts/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/list-signed-in-accounts/output new file mode 100644 index 00000000..9d30b597 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/list-signed-in-accounts/output @@ -0,0 +1,20 @@ +[ + { + "url": "pyonepassword.1password.com", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" + }, + { + "url": "my.1password.com", + "email": "guest_user@example.email", + "user_uuid": "DJGTGRFRM5C4BHNUXQLJXQJAOE", + "account_uuid": "6J7RFGQWONBVJHIHJUVICO2C3Q" + }, + { + "url": "example-account.1password.com", + "email": "example_user@example.email", + "user_uuid": "5GHHPJK5HZC5BAT7WDUXW57G44", + "account_uuid": "GRXJAN4BY5DPROISKYL55IRCPY" + } +] diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-edit-set-new-name/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-edit-set-new-name/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-edit-set-new-name/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-edit-set-new-name/output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit-by-id/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit-by-id/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit-by-id/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit-by-id/output new file mode 100644 index 00000000..508dee46 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit-by-id/output @@ -0,0 +1,10 @@ +{ + "id": "IT52W465L3IOUUUCSD3WBNL26M", + "name": "Example User", + "email": "uid000@gmail.com", + "type": "MEMBER", + "state": "ACTIVE", + "created_at": "2023-03-14T23:05:57Z", + "updated_at": "2023-12-15T02:57:55Z", + "last_auth_at": "2023-12-15T02:51:58Z" +} diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit/output new file mode 100644 index 00000000..508dee46 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/user-get-user-to-edit/output @@ -0,0 +1,10 @@ +{ + "id": "IT52W465L3IOUUUCSD3WBNL26M", + "name": "Example User", + "email": "uid000@gmail.com", + "type": "MEMBER", + "state": "ACTIVE", + "created_at": "2023-03-14T23:05:57Z", + "updated_at": "2023-12-15T02:57:55Z", + "last_auth_at": "2023-12-15T02:51:58Z" +} diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami-account-uuid/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami-account-uuid/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami-account-uuid/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami-account-uuid/output new file mode 100644 index 00000000..b866ab41 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami-account-uuid/output @@ -0,0 +1,6 @@ +{ + "url": "https://pyonepassword.1password.com/", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" +} diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami/output new file mode 100644 index 00000000..b866ab41 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-1/whoami/output @@ -0,0 +1,6 @@ +{ + "url": "https://pyonepassword.1password.com/", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" +} diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/cli-version/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/cli-version/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/cli-version/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/cli-version/output new file mode 100644 index 00000000..ad226192 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/cli-version/output @@ -0,0 +1 @@ +2.24.0 diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/list-signed-in-accounts/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/list-signed-in-accounts/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/list-signed-in-accounts/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/list-signed-in-accounts/output new file mode 100644 index 00000000..9d30b597 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/list-signed-in-accounts/output @@ -0,0 +1,20 @@ +[ + { + "url": "pyonepassword.1password.com", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" + }, + { + "url": "my.1password.com", + "email": "guest_user@example.email", + "user_uuid": "DJGTGRFRM5C4BHNUXQLJXQJAOE", + "account_uuid": "6J7RFGQWONBVJHIHJUVICO2C3Q" + }, + { + "url": "example-account.1password.com", + "email": "example_user@example.email", + "user_uuid": "5GHHPJK5HZC5BAT7WDUXW57G44", + "account_uuid": "GRXJAN4BY5DPROISKYL55IRCPY" + } +] diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-edit-set-name-back-to-orig/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-edit-set-name-back-to-orig/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-edit-set-name-back-to-orig/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-edit-set-name-back-to-orig/output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-orig-user-name/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-orig-user-name/error_output new file mode 100644 index 00000000..5e504f06 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-orig-user-name/error_output @@ -0,0 +1 @@ +[ERROR] 2023/12/15 21:26:48 "Zachary Cutlip" isn't a user in this account. Specify the user with their UUID, email address, or name. diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-orig-user-name/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-orig-user-name/output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit-by-id/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit-by-id/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit-by-id/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit-by-id/output new file mode 100644 index 00000000..d28d560f --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit-by-id/output @@ -0,0 +1,10 @@ +{ + "id": "IT52W465L3IOUUUCSD3WBNL26M", + "name": "Example User (new)", + "email": "uid000@gmail.com", + "type": "MEMBER", + "state": "ACTIVE", + "created_at": "2023-03-14T23:05:57Z", + "updated_at": "2023-12-15T02:58:22Z", + "last_auth_at": "2023-12-15T02:51:58Z" +} diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit/output new file mode 100644 index 00000000..d28d560f --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/user-get-user-to-edit/output @@ -0,0 +1,10 @@ +{ + "id": "IT52W465L3IOUUUCSD3WBNL26M", + "name": "Example User (new)", + "email": "uid000@gmail.com", + "type": "MEMBER", + "state": "ACTIVE", + "created_at": "2023-03-14T23:05:57Z", + "updated_at": "2023-12-15T02:58:22Z", + "last_auth_at": "2023-12-15T02:51:58Z" +} diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami-account-uuid/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami-account-uuid/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami-account-uuid/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami-account-uuid/output new file mode 100644 index 00000000..b866ab41 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami-account-uuid/output @@ -0,0 +1,6 @@ +{ + "url": "https://pyonepassword.1password.com/", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" +} diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami/output new file mode 100644 index 00000000..b866ab41 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-2/whoami/output @@ -0,0 +1,6 @@ +{ + "url": "https://pyonepassword.1password.com/", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" +} diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit-by-id/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit-by-id/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit-by-id/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit-by-id/output new file mode 100644 index 00000000..750ce4fe --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit-by-id/output @@ -0,0 +1,10 @@ +{ + "id": "IT52W465L3IOUUUCSD3WBNL26M", + "name": "Example User", + "email": "uid000@gmail.com", + "type": "MEMBER", + "state": "ACTIVE", + "created_at": "2023-03-14T23:05:57Z", + "updated_at": "2023-12-15T02:58:27Z", + "last_auth_at": "2023-12-15T02:51:58Z" +} diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit/output new file mode 100644 index 00000000..750ce4fe --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/user-get-user-to-edit/output @@ -0,0 +1,10 @@ +{ + "id": "IT52W465L3IOUUUCSD3WBNL26M", + "name": "Example User", + "email": "uid000@gmail.com", + "type": "MEMBER", + "state": "ACTIVE", + "created_at": "2023-03-14T23:05:57Z", + "updated_at": "2023-12-15T02:58:27Z", + "last_auth_at": "2023-12-15T02:51:58Z" +} diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/whoami-account-uuid/error_output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/whoami-account-uuid/error_output new file mode 100644 index 00000000..e69de29b diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/whoami-account-uuid/output b/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/whoami-account-uuid/output new file mode 100644 index 00000000..b866ab41 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/responses-3/whoami-account-uuid/output @@ -0,0 +1,6 @@ +{ + "url": "https://pyonepassword.1password.com/", + "email": "uid000@gmail.com", + "user_uuid": "IT52W465L3IOUUUCSD3WBNL26M", + "account_uuid": "M5C4BT3KMQ7HROISKYLWDUXW57" +} diff --git a/tests/config/mock-op/responses-user-edit/new-user-name/user-edit-state-config.json b/tests/config/mock-op/responses-user-edit/new-user-name/user-edit-state-config.json new file mode 100644 index 00000000..bd86a418 --- /dev/null +++ b/tests/config/mock-op/responses-user-edit/new-user-name/user-edit-state-config.json @@ -0,0 +1,27 @@ +{ + "iteration": 0, + "max-iterations": 3, + "state-list": [ + { + "response-directory": "tests/config/mock-op/responses-user-edit/new-user-name/response-directory-1.json", + "env-vars": { + "set": {}, + "pop": [] + } + }, + { + "response-directory": "tests/config/mock-op/responses-user-edit/new-user-name/response-directory-2.json", + "env-vars": { + "set": {}, + "pop": [] + } + }, + { + "response-directory": "tests/config/mock-op/responses-user-edit/new-user-name/response-directory-3.json", + "env-vars": { + "set": {}, + "pop": [] + } + } + ] +} \ No newline at end of file From 2a7cde899b4fba6114533d05e5bde37fd3455836 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Fri, 15 Dec 2023 22:04:54 -0800 Subject: [PATCH 38/52] add test fixture code to support user-edit new-user-name --- tests/fixtures/op_fixtures.py | 28 ++++++++++++++++++++++++++++ tests/fixtures/paths.py | 7 +++++++ 2 files changed, 35 insertions(+) diff --git a/tests/fixtures/op_fixtures.py b/tests/fixtures/op_fixtures.py index 4397dc90..6a2d4e5d 100644 --- a/tests/fixtures/op_fixtures.py +++ b/tests/fixtures/op_fixtures.py @@ -51,6 +51,7 @@ SVC_ACCT_RESP_DIRECTORY_PATH, SVC_ACCT_REVOKED_RESP_DIRECTORY_PATH, UNAUTH_RESP_DIRECTORY_PATH, + USER_EDIT_NEW_USER_NAME_STATE_CONFIG_PATH, USER_EDIT_TRAVEL_MODE_STATE_CONFIG_PATH ) from .platform_support import HOME_ENV_VAR @@ -293,6 +294,33 @@ def setup_stateful_user_edit_travel_mode(): # temp_dir will get cleaned up once we return +@fixture +def setup_stateful_user_edit_new_user_name(): + + # set up a temporary directory to copy the state config to, since it gets modified + # during state iteration + config_file_name = USER_EDIT_NEW_USER_NAME_STATE_CONFIG_PATH.name + temp_dir = tempfile.TemporaryDirectory() + state_config_dir = temp_dir.name + state_config_path = Path(state_config_dir, config_file_name) + shutil.copyfile( + USER_EDIT_NEW_USER_NAME_STATE_CONFIG_PATH, state_config_path) + + # now pop MOCK_OP_RESPONSE_DIRECTORY to ensure it doesn't conflict with with + # the stateful config + old_mock_op_resp_dir = os.environ.pop("MOCK_OP_RESPONSE_DIRECTORY", None) + os.environ["MOCK_OP_STATE_DIR"] = str(state_config_path) + yield # pytest will return us here after the test runs + # get rid of MOCK_OP_STATE_DIR + os.environ.pop("MOCK_OP_STATE_DIR") + + # restore MOCK_OP_RESPONSE_DIRECTORY if it was previously set + if old_mock_op_resp_dir is not None: + os.environ["MOCK_OP_RESPONSE_DIRECTORY"] = old_mock_op_resp_dir + + # temp_dir will get cleaned up once we return + + @fixture def setup_stateful_svc_acct_auth(): config_file_name = SVC_ACCT_NOT_YET_AUTH_STATE_CONFIG_PATH.name diff --git a/tests/fixtures/paths.py b/tests/fixtures/paths.py index 2bde9247..a442960f 100644 --- a/tests/fixtures/paths.py +++ b/tests/fixtures/paths.py @@ -37,6 +37,13 @@ USER_EDIT_TRAVEL_MODE_RESP_PATH, "user-edit-state-config.json" ) +USER_EDIT_NEW_USER_NAME_RESP_PATH = Path( + MOCK_OP_CONFIG_PATH, "responses-user-edit", "new-user-name" +) +USER_EDIT_NEW_USER_NAME_STATE_CONFIG_PATH = Path( + USER_EDIT_NEW_USER_NAME_RESP_PATH, "user-edit-state-config.json" +) + UNAUTH_RESP_DIRECTORY_PATH = Path( MOCK_OP_CONFIG_PATH, "unauth-response-directory.json") From 846011edf1ab0d98b679bf77c8418896ed8e2480 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Fri, 15 Dec 2023 22:05:08 -0800 Subject: [PATCH 39/52] add test cases for user-edit new-user-name --- .../user/edit/test_user_edit_set_name.py | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 tests/test_op_api/user/edit/test_user_edit_set_name.py diff --git a/tests/test_op_api/user/edit/test_user_edit_set_name.py b/tests/test_op_api/user/edit/test_user_edit_set_name.py new file mode 100644 index 00000000..1195cef0 --- /dev/null +++ b/tests/test_op_api/user/edit/test_user_edit_set_name.py @@ -0,0 +1,75 @@ +from __future__ import annotations + +from typing import TYPE_CHECKING + +from pyonepassword.api.exceptions import OPUserGetException + +if TYPE_CHECKING: + from pyonepassword import OP + + +import pytest + +pytestmark = pytest.mark.usefixtures("valid_op_cli_config_homedir") + + +@pytest.mark.usefixtures("setup_stateful_user_edit_new_user_name") +def test_user_edit_set_name_010(signed_in_team_account_op: OP): + """ + Test: OP.user_edit() + - retrieve a user based on username + - set new username for a user + - retrieve the user based on the new username + - set the old username back for the same user + - retrieve the user based on the original username + Verify: + - the original user object's user ID matches the expected user ID + - the updated user object's user ID matches the expected user ID + - the restored user object's user ID matches the expected user ID + """ + + user_name = "Example User" + new_user_name = "Example User (new)" + expected_user_id = "IT52W465L3IOUUUCSD3WBNL26M" + + existing_user = signed_in_team_account_op.user_get(user_name) + user_id = existing_user.unique_id + assert user_id == expected_user_id + + signed_in_team_account_op.user_edit(user_id, new_name=new_user_name) + + updated_user = signed_in_team_account_op.user_get(new_user_name) + + assert updated_user.unique_id == expected_user_id + + signed_in_team_account_op.user_edit(user_id, new_name=user_name) + + updated_user = signed_in_team_account_op.user_get(user_name) + + assert updated_user.unique_id == expected_user_id + + +@pytest.mark.usefixtures("setup_stateful_user_edit_new_user_name") +def test_user_edit_set_name_020(signed_in_team_account_op: OP): + """ + Test: OP.user_edit() + - retrieve a user based on username + - set new username for a user + - Attempt to retrieve the user based on the original username + Verify: + - the original user object's user ID matches the expected user ID + - OPUserGetException is raised + """ + + original_user_name = "Example User" + new_user_name = "Example User (new)" + expected_user_id = "IT52W465L3IOUUUCSD3WBNL26M" + + existing_user = signed_in_team_account_op.user_get(original_user_name) + user_id = existing_user.unique_id + assert user_id == expected_user_id + + signed_in_team_account_op.user_edit(user_id, new_name=new_user_name) + + with pytest.raises(OPUserGetException): + signed_in_team_account_op.user_get(original_user_name) From 0f6515f3e0ce71d843cf112be747ebc1d36ab1ff Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Fri, 15 Dec 2023 22:06:38 -0800 Subject: [PATCH 40/52] add script to generate user IDs --- scripts/user-id-generate.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 scripts/user-id-generate.py diff --git a/scripts/user-id-generate.py b/scripts/user-id-generate.py new file mode 100755 index 00000000..86f03156 --- /dev/null +++ b/scripts/user-id-generate.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +from pyonepassword.op_items.uuid import OPUniqueIdentifierBase32 + + +def new_user_id(): + uuid = OPUniqueIdentifierBase32(uppercase=True) + print(uuid) + + +if __name__ == "__main__": + exit(new_user_id()) From 4e57a1bf85262702c831d2bac1f830771f22ea42 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 16:12:38 -0800 Subject: [PATCH 41/52] Add Vagrantfile for windows testing --- vagrant/Vagrantfile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 vagrant/Vagrantfile diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile new file mode 100644 index 00000000..d1bb790b --- /dev/null +++ b/vagrant/Vagrantfile @@ -0,0 +1,11 @@ +Vagrant.configure("2") do |config| + config.vm.provider "parallels" do |prl| + prl.memory = 8192 + prl.cpus = 8 + end + config.vm.box = "windows11arm64" + config.vm.communicator = "winssh" + config.vm.guest = :windows + config.vm.synced_folder "..", "/vagrant" + config.vm.provision "shell", inline: "choco install python39 python310 python311 python312 rsync vim --yes" +end From be66faaa5370b7b92b092fd0f98e99ba50250ba9 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 18:27:06 -0800 Subject: [PATCH 42/52] tidy up auth_required example --- examples/sign_in_fail_auth_required.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/sign_in_fail_auth_required.py b/examples/sign_in_fail_auth_required.py index 10a35f55..846dd6cf 100644 --- a/examples/sign_in_fail_auth_required.py +++ b/examples/sign_in_fail_auth_required.py @@ -1,19 +1,16 @@ """ -An example of signing in with existing authentication required but not existing +An example of signing in with existing authentication required but not available Demonstrates OPAuthenticationException """ from do_signin import do_signin -from pyonepassword import OP, logging +from pyonepassword import logging from pyonepassword.api.authentication import EXISTING_AUTH_REQD from pyonepassword.api.exceptions import OPAuthenticationException if __name__ == "__main__": - import inspect - print(__name__) - print(inspect.getfile(OP)) logger = logging.console_logger("example-sign-in", level=logging.DEBUG) try: # ensure OP() fails if there's no existing authentication From 5bd4f91ae4f12a76509106ed030cd818663ef1d2 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 18:28:07 -0800 Subject: [PATCH 43/52] add user_edit.py to examples --- examples/user_edit.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 examples/user_edit.py diff --git a/examples/user_edit.py b/examples/user_edit.py new file mode 100644 index 00000000..a473b412 --- /dev/null +++ b/examples/user_edit.py @@ -0,0 +1,37 @@ +from do_signin import do_signin + +from pyonepassword.api.exceptions import OPUserEditException + + +def user_edit_set_travel_mode(): + op = do_signin() + user_name = "Example User" + + # Toggle travel mode on + # user_edit() returns the unique user ID + user_id = op.user_edit(user_name, travel_mode=True) + + # Toggle travel mode back off + # When editing users, either user name or unique user ID is okay + op.user_edit(user_id, travel_mode=False) + + +def user_edit_set_user_name(): + op = do_signin() + user_name = "Example User" + + new_user_name = "Example User - updated" + + # set new username + op.user_edit(user_name, new_user_name=new_user_name) + + +def user_edit_invalid_user(): + + op = do_signin() + user_name = "Nonexistent User" + + try: + op.user_edit(user_name, travel_mode=False) + except OPUserEditException as e: + print(e.err_output) From 8548767394d64e72b9420371d772323c8b3a2354 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 18:41:52 -0800 Subject: [PATCH 44/52] updated changelong for work in progress --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7c66d9c..50d7bc5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ All notable changes to this project will be documented in this file. +## [DEVELOPMENT] + +### Added + +- User editing (gh-159) + - `OP.user_edit()` + +### Testing + +- Ensured all tests pass under Windows + - Added Vagrant file to aid in automated local development testing on windows + - Added `windows-latest` to OS matrix in github testing workflow + + ## [4.1.0] 2023-11-28 ### Added From d7d0c4fb5d026b886cf4febafdf8154aa6588dd7 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 19:16:46 -0800 Subject: [PATCH 45/52] bump version to 4.2.0 --- pyonepassword/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyonepassword/__about__.py b/pyonepassword/__about__.py index 7e0b4771..e557c2b6 100644 --- a/pyonepassword/__about__.py +++ b/pyonepassword/__about__.py @@ -1,5 +1,5 @@ __title__ = "pyonepassword" -__version__ = "4.2.0.dev0" +__version__ = "4.2.0" __summary__ = "A python API to query a 1Password account using the 'op' command-line tool" """ From 20cdf507d19c69fdb12bd4e50c4eb1e32f247f8e Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 19:18:06 -0800 Subject: [PATCH 46/52] update CHANGELOG.md for 4.2.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50d7bc5c..97226a4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. -## [DEVELOPMENT] +## [4.2.0] 2023-12-17 ### Added From b108780509314239d637c9779c944a84ae7579bd Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 19:27:02 -0800 Subject: [PATCH 47/52] Revert "update CHANGELOG.md for 4.2.0" This reverts commit 20cdf507d19c69fdb12bd4e50c4eb1e32f247f8e. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97226a4d..50d7bc5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. -## [4.2.0] 2023-12-17 +## [DEVELOPMENT] ### Added From 745fffb7c2ffbe5a499061cd39b5f5c2cf66e3ed Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 19:27:12 -0800 Subject: [PATCH 48/52] Revert "bump version to 4.2.0" This reverts commit d7d0c4fb5d026b886cf4febafdf8154aa6588dd7. --- pyonepassword/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyonepassword/__about__.py b/pyonepassword/__about__.py index e557c2b6..7e0b4771 100644 --- a/pyonepassword/__about__.py +++ b/pyonepassword/__about__.py @@ -1,5 +1,5 @@ __title__ = "pyonepassword" -__version__ = "4.2.0" +__version__ = "4.2.0.dev0" __summary__ = "A python API to query a 1Password account using the 'op' command-line tool" """ From b67f450df7a603bb06b12d37a89d6dbca75c205b Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 19:46:32 -0800 Subject: [PATCH 49/52] rename user_edit.py to user_editing.py --- examples/{user_edit.py => user_editing.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/{user_edit.py => user_editing.py} (100%) diff --git a/examples/user_edit.py b/examples/user_editing.py similarity index 100% rename from examples/user_edit.py rename to examples/user_editing.py From fe074827ed55da5bd0086e28446a91fec1af39f8 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 19:48:08 -0800 Subject: [PATCH 50/52] add section to README on user editing --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 26773973..2d607552 100644 --- a/README.md +++ b/README.md @@ -365,6 +365,12 @@ For details on editing existing document item file contents, see [document-editi See examples in [examples/document_editing](examples/document_editing.py) +### User Editing + +User editing is supported via the `OP.user_edit()` method. It supports toggling travel mode on and off, as well as setting a new user name. Only one user at a time may be edited via this method. + +See examples in [examples/user_editing](examples/user_editing.py) + ### More Examples Lots more examples are available in the `examples` directory From 5c641d58ada76348ecc30874a02171945fe53aa1 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 19:48:36 -0800 Subject: [PATCH 51/52] bump version to 4.2.0 --- pyonepassword/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyonepassword/__about__.py b/pyonepassword/__about__.py index 7e0b4771..e557c2b6 100644 --- a/pyonepassword/__about__.py +++ b/pyonepassword/__about__.py @@ -1,5 +1,5 @@ __title__ = "pyonepassword" -__version__ = "4.2.0.dev0" +__version__ = "4.2.0" __summary__ = "A python API to query a 1Password account using the 'op' command-line tool" """ From 739c9e3ec59e1d4448be0e9135ecc27215fbcfc4 Mon Sep 17 00:00:00 2001 From: Zachary Cutlip Date: Sun, 17 Dec 2023 19:48:59 -0800 Subject: [PATCH 52/52] update CHANGELOG.md for 4.2.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50d7bc5c..97226a4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. -## [DEVELOPMENT] +## [4.2.0] 2023-12-17 ### Added