def test_home_directory_get_status(): user = User(username="******") hd = HomeDirectory(user) cluster.HOME_RESETTING = "Resetting" hd._poll = MagicMock(return_value=cluster.HOME_RESETTING) hd._subprocess = True assert hd.get_status() == cluster.HOME_RESETTING
def home_reset(self, message): """ Reset the home directory of the specified user. """ user = User.objects.get(auth0_id=message["user_id"]) home_directory = HomeDirectory(user) update_home_status(home_directory, HOME_RESETTING) home_directory.reset() status = wait_for_home_reset(home_directory) if status == HOME_RESET_FAILED: log.warning(f"Failed to reset home directory for user {user}") else: log.debug(f"Reset home directory for user {user}")
def test_home_directory_reset(cluster): user = User(username="******") hd = HomeDirectory(user) hd.reset() assert hd._subprocess == cluster.User(user).reset_home()