Extention of VDR311 rule.
Sometimes even partial mutation of scope variables could challenge understanding of the original data that was used in some specific test/
class Scenario(vedro.Scenario):
subject = "get banned user info"
def given_registered_user(self):
self.user = registered_user()
def given_banned_user(self):
banned_user(self.user)
# there is no guarantee that
# user status was not banned after registration
self.user["status"] = "banned" # <--- partial mutation
def when_user_gets_info(self):
self.response = httpx.get(f"{API_URL}/user/info/{self.user['id']}"
def then_it_should_return_success_response(self):
assert self.response.status_code == 200
def and_then_it_should_return_user_info(self):
assert self.response.json() == NewUserSchema % {
"status": self.user["status"],
}
class Scenario(vedro.Scenario):
subject = "get user info with empty username"
def given_registered_user(self):
self.user = registered_user()
def given_banned_user(self):
self.banned_user = banned_user(self.user)
def when_user_gets_info(self):
self.response = httpx.get(f"{API_URL}/user/info/{self.user['id']}"
def then_it_should_return_success_response(self):
assert self.response.status_code == 200
def and_then_it_should_return_user_info(self):
assert self.response.json() == NewUserSchema % {
"status": self.banned_user["status"],
}