#!/usr/bin/python # # my_prompt: tests the user modified custom prompt for all cases. # import socket import os import getpass as gt import sys, imp, atexit, signal, time, threading from testutils import * from datetime import datetime from datetime import date console = setup_tests() currentTime = datetime.now() timeIs = currentTime.strftime("%H:%M:%S") sendline("my_prompt \\t") expect_exact(timeIs, "failed test") sendline("my_prompt \\#") expect_exact("3", "Failed test") user = gt.getuser() sendline("my_prompt \\u") expect_exact(user, "Failed test") sendline("my_prompt \\j") expect_exact("0", "Failed test") sendline("my_prompt \\h") expect_exact(socket.gethostname(), "Failed test") td = date.today() dateFormat = td.strftime("%m/%d/%y") sendline("my_prompt \\d") expect_exact(dateFormat, "Failed test") cwd = os.getcwd() sendline("my_prompt \\w") expect_exact(cwd, "Failed test") sendline("my_prompt \\#") expect_exact("9", "Failed test") test_success()