def test_when_user_resets_their_account_all_unlocked_levels_are_removed_except_current_wk_level(self): self.user.profile.unlocked_levels.get_or_create(level=1) self.user.profile.unlocked_levels.get_or_create(level=2) self.user.profile.unlocked_levels.get_or_create(level=3) self.user.profile.unlocked_levels.get_or_create(level=4) self.user.refresh_from_db() self.assertListEqual(self.user.profile.unlocked_levels_list(), [5, 1, 2, 3, 4]) reset_levels(self.user, 1) self.user.refresh_from_db() self.assertListEqual(self.user.profile.unlocked_levels_list(), [])
def test_when_user_resets_their_account_all_unlocked_levels_are_removed_except_current_wk_level( self ): self.user.profile.unlocked_levels.get_or_create(level=1) self.user.profile.unlocked_levels.get_or_create(level=2) self.user.profile.unlocked_levels.get_or_create(level=3) self.user.profile.unlocked_levels.get_or_create(level=4) self.user.refresh_from_db() self.assertListEqual(self.user.profile.unlocked_levels_list(), [5, 1, 2, 3, 4]) reset_levels(self.user, 1) self.user.refresh_from_db() self.assertListEqual(self.user.profile.unlocked_levels_list(), [])