Skip to content

Commit 27665d7

Browse files
remove import tests
1 parent dd748b9 commit 27665d7

1 file changed

Lines changed: 0 additions & 107 deletions

File tree

tests/api_fastapi/core_api/routes/public/test_variables.py

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -433,113 +433,6 @@ def test_post_should_respond_422_when_value_is_null(self, test_client):
433433
}
434434

435435

436-
class TestImportVariables(TestVariableEndpoint):
437-
@pytest.mark.enable_redact
438-
@pytest.mark.parametrize(
439-
"variables_data, behavior, expected_status_code, expected_created_count, expected_created_keys, expected_conflict_keys",
440-
[
441-
(
442-
{"new_key1": "new_value1", "new_key2": "new_value2"},
443-
"overwrite",
444-
200,
445-
2,
446-
{"new_key1", "new_key2"},
447-
set(),
448-
),
449-
(
450-
{"new_key1": "new_value1", "new_key2": "new_value2"},
451-
"skip",
452-
200,
453-
2,
454-
{"new_key1", "new_key2"},
455-
set(),
456-
),
457-
(
458-
{"test_variable_key": "new_value", "new_key": "new_value"},
459-
"fail",
460-
409,
461-
0,
462-
set(),
463-
{"test_variable_key"},
464-
),
465-
(
466-
{"test_variable_key": "new_value", "new_key": "new_value"},
467-
"skip",
468-
200,
469-
1,
470-
{"new_key"},
471-
{"test_variable_key"},
472-
),
473-
(
474-
{"test_variable_key": "new_value", "new_key": "new_value"},
475-
"overwrite",
476-
200,
477-
2,
478-
{"test_variable_key", "new_key"},
479-
set(),
480-
),
481-
],
482-
)
483-
def test_import_variables(
484-
self,
485-
test_client,
486-
variables_data,
487-
behavior,
488-
expected_status_code,
489-
expected_created_count,
490-
expected_created_keys,
491-
expected_conflict_keys,
492-
session,
493-
):
494-
"""Test variable import with different behaviors (overwrite, fail, skip)."""
495-
496-
self.create_variables()
497-
498-
file = create_file_upload(variables_data)
499-
response = test_client.post(
500-
"/public/variables/import",
501-
files={"file": ("variables.json", file, "application/json")},
502-
params={"action_if_exists": behavior},
503-
)
504-
505-
assert response.status_code == expected_status_code
506-
507-
if expected_status_code == 200:
508-
body = response.json()
509-
assert body["created_count"] == expected_created_count
510-
assert set(body["created_variable_keys"]) == expected_created_keys
511-
512-
elif expected_status_code == 409:
513-
body = response.json()
514-
assert (
515-
f"The variables with these keys: {expected_conflict_keys} already exists." == body["detail"]
516-
)
517-
518-
def test_import_invalid_json(self, test_client):
519-
"""Test invalid JSON import."""
520-
file = BytesIO(b"import variable test")
521-
response = test_client.post(
522-
"/public/variables/import",
523-
files={"file": ("variables.json", file, "application/json")},
524-
params={"action_if_exists": "overwrite"},
525-
)
526-
527-
assert response.status_code == 400
528-
assert "Invalid JSON format" in response.json()["detail"]
529-
530-
def test_import_empty_file(self, test_client):
531-
"""Test empty file import."""
532-
file = create_file_upload({})
533-
response = test_client.post(
534-
"/public/variables/import",
535-
files={"file": ("empty_variables.json", file, "application/json")},
536-
params={"action_if_exists": "overwrite"},
537-
)
538-
539-
assert response.status_code == 422
540-
assert response.json()["detail"] == "No variables found in the provided JSON."
541-
542-
543436
class TestBulkVariables(TestVariableEndpoint):
544437
@pytest.mark.enable_redact
545438
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)