Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuadavidthomas committed May 11, 2024
1 parent 7f86b77 commit 3643a11
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test_fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import os
import subprocess
from unittest.mock import patch

import pytest
Expand Down Expand Up @@ -119,9 +120,13 @@ def test_get_secret_error(mock_run):
assert "Could not read secret from 1Password" in str(exc_info.value)


@patch("shutil.which", return_value=None)
@patch("subprocess.check_call")
@patch.dict(os.environ, {"OP_SERVICE_ACCOUNT_TOKEN": "token"}, clear=True)
def test_get_secret_command_not_available(mock_which, db):
def test_get_secret_command_not_available(mock_check_call, db):
mock_check_call.side_effect = subprocess.CalledProcessError(
returncode=1, cmd="op --version", output=b"Command not found"
)

model = TestModel(op_uri="op://vault/item/field")

with pytest.raises(OSError) as excinfo:
Expand Down

0 comments on commit 3643a11

Please sign in to comment.