Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test__set_captain_captain():
user_picks = get_picks()
captain = next(p for p in user_picks if p["is_captain"])
_set_captain(user_picks, 145, "is_captain", user_player_ids)
new_captain = next(p for p in user_picks if p["is_captain"])
assert new_captain["element"] == 145
assert not captain["is_captain"]
def test__set_captain_captain_to_vice():
user_picks = get_picks()
captain = next(p for p in user_picks if p["is_captain"])
vice_captain = next(p for p in user_picks if p["is_vice_captain"])
_set_captain(user_picks, 270, "is_vice_captain", user_player_ids)
new_captain = next(p for p in user_picks if p["is_captain"])
new_vice_captain = next(p for p in user_picks if p["is_vice_captain"])
assert new_captain["element"] == vice_captain["element"]
assert new_vice_captain["element"] == captain["element"]
def test__set_captain_vice_to_vice():
user_picks = get_picks()
vice_captain = next(p for p in user_picks if p["is_vice_captain"])
_set_captain(user_picks, 302, "is_vice_captain", user_player_ids)
new_vice_captain = next(p for p in user_picks if p["is_vice_captain"])
assert new_vice_captain["element"] == vice_captain["element"]
def test__set_captain_vice_to_captain():
user_picks = get_picks()
captain = next(p for p in user_picks if p["is_captain"])
vice_captain = next(p for p in user_picks if p["is_vice_captain"])
_set_captain(user_picks, 302, "is_captain", user_player_ids)
new_captain = next(p for p in user_picks if p["is_captain"])
new_vice_captain = next(p for p in user_picks if p["is_vice_captain"])
assert new_vice_captain["element"] == captain["element"]
assert new_captain["element"] == vice_captain["element"]
def test__set_captain_captain_to_captain():
user_picks = get_picks()
captain = next(p for p in user_picks if p["is_captain"])
_set_captain(user_picks, 270, "is_captain", user_player_ids)
new_captain = next(p for p in user_picks if p["is_captain"])
assert new_captain["element"] == captain["element"]
def test__set_captain_vice():
user_picks = get_picks()
vice_captain = next(p for p in user_picks if p["is_vice_captain"])
_set_captain(user_picks, 145, "is_vice_captain", user_player_ids)
new_vice_captain = next(p for p in user_picks if p["is_vice_captain"])
assert new_vice_captain["element"] == 145
assert not vice_captain["is_vice_captain"]