all the remain tests
This commit is contained in:
@@ -223,7 +223,7 @@ class TestCrud:
|
||||
|
||||
|
||||
@pytest.mark.parametrize("test_user_fixture", [
|
||||
([], [])
|
||||
(["admin"], ["admin_group"])
|
||||
], indirect=True)
|
||||
@pytest.mark.parametrize("user_record_to_update",[
|
||||
pytest.param({"first_name": "Test_New"},id="Positive_user_update_partially")
|
||||
@@ -245,7 +245,7 @@ class TestCrud:
|
||||
response.raise_for_status()
|
||||
response=response.json()
|
||||
|
||||
actual_permissions = [item.get("direct_permissions") for item in response.get("direct_permissions")] #unpacking json like {group:[{},{}]}
|
||||
actual_permissions = [item.get("permission") for item in response.get("direct_permissions")] #unpacking json like {group:[{},{}]}
|
||||
actual_groups =[item.get("group") for item in response.get("group")]
|
||||
|
||||
|
||||
@@ -253,8 +253,8 @@ class TestCrud:
|
||||
assert response.get("first_name")==user_record_to_update["first_name"]
|
||||
assert response.get("last_name")==new_user_record["last_name"]
|
||||
assert response.get("middle_name")==new_user_record["middle_name"]
|
||||
assert actual_permissions == new_user_record["direct_permissions"] or actual_permissions == [None]
|
||||
assert actual_groups == new_user_record["group"] or actual_groups == [None]
|
||||
assert actual_permissions == new_user_record["direct_permissions"]
|
||||
assert actual_groups == new_user_record["group"]
|
||||
assert not response.get("hashed_password") or not response.get("plain_password") or not response.get("password")
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ class TestCrud:
|
||||
@pytest.mark.parametrize("user_record_to_update, expected_exception, expected_status",[
|
||||
pytest.param({"plain_password": "Wrong_pass"},HTTPStatusError,422,id="Wrong_password"),
|
||||
pytest.param({"email": "Wrong_email"},HTTPStatusError,422,id="Wrong_email"),
|
||||
pytest.param({},HTTPStatusError, 400,id="Positive_user_update_nothing")
|
||||
pytest.param({},HTTPStatusError, 400,id="Negative_user_update_nothing")
|
||||
])
|
||||
async def test_user_update_partially_negative(self, test_user_fixture, user_record_to_update:dict, expected_exception, expected_status:int)->None:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user