def test_create_already_existing_folder(self): """Tests if the user is attempting to create a folder which is already existing. """ test_user = CommandHandler() test_user.register("test7", "lognslb402193570") test_user.login("test7", "lognslb402193570") test_user.create_folder("movies") expected = "\nThe folder already exists!" actual = test_user.create_folder("movies") self.assertEqual(expected, actual) test_user.quit()
def test_write_file(self): """Tests if the user is attempting to create and write content into a file """ test_user = CommandHandler() test_user.register("test9", "nlndgsvns") test_user.login("test9", "nlndgsvns") expected = "\nCreated and written data to file k.txt successfully" actual = test_user.write_file("k.txt", "Hello World") self.assertEqual(expected, actual) # Check also if the user able to append new data to the # existing file expected = "\nSuccess Written data to file k.txt successfully" actual = test_user.write_file("k.txt", "Hello Second World") self.assertEqual(expected, actual) test_user.quit()
def test_quit(self): """Tests if the user able to safely quit from the system. """ test_user = CommandHandler() test_user.register("test5", "bdghkga") test_user.login("test5", "bdghkga") expected = test_user.quit() actual = "\nLogged Out" self.assertEqual(expected, actual)