Skip to content

Commit

Permalink
Remove test that isn't necessary anymore
Browse files Browse the repository at this point in the history
We don't need to test for unknown fields causing import failures,
because that won't happen anymore.
  • Loading branch information
markstory committed Feb 10, 2025
1 parent 08d3e4a commit 7227466
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions tests/sentry/runner/commands/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,37 +781,6 @@ def test_import_integrity_error_exit_code(self, get_importer_for_model):


class BadImportExportCommandTests(TestCase):
def test_import_invalid_json(self):
with TemporaryDirectory() as tmp_dir:
tmp_invalid_json = Path(tmp_dir).joinpath(f"{self._testMethodName}.invalid.json")
with open(get_fixture_path("backup", "single-option.json")) as backup_file:
models = json.load(backup_file)
models[0]["fields"]["invalid_field"] = "invalid_data"
with open(tmp_invalid_json, "w") as invalid_input_file:
json.dump(models, invalid_input_file)

for scope in {"users", "organizations", "config", "global"}:
tmp_findings = Path(tmp_dir).joinpath(
f"{self._testMethodName}.{scope}.findings.json"
)
rv = CliRunner().invoke(
import_,
[
scope,
str(tmp_invalid_json),
"--no-prompt",
"--findings-file",
str(tmp_findings),
],
)
assert rv.exit_code == 1, rv.output

with open(tmp_findings) as findings_file:
findings = json.load(findings_file)
assert len(findings) == 1
assert findings[0]["finding"] == "RpcImportError"
assert findings[0]["kind"] == "DeserializationFailed"

def test_import_file_read_error_exit_code(self):
rv = CliRunner().invoke(import_, ["global", NONEXISTENT_FILE_PATH, "--no-prompt"])
assert not isinstance(rv.exception, ImportingError)
Expand Down

0 comments on commit 7227466

Please sign in to comment.