Skip to content

Instantly share code, notes, and snippets.

@mkrogh
Created July 31, 2015 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkrogh/e1a7781b1d762a87956c to your computer and use it in GitHub Desktop.
Save mkrogh/e1a7781b1d762a87956c to your computer and use it in GitHub Desktop.
from chinchilla import *
import time
GREEN = "\x1b[32m"
RED = "\x1b[31m"
ORANGE = "\x1b[33m"
RESET = "\x1b[0m"
success,error = 0,0
def check_link(txt,content):
global success, error
click_link(txt)
if has_content(content):
print GREEN+u"\u2714 {0} - {1}".format(txt,page_url()) + RESET
success += 1
else:
print RED + u"\u2716 {0} - {1}".format(txt,page_url()) + RESET
error += 1
#Login
visit("http://localhost:8000/login?next=/")
fill_in("username", "user")
fill_in("password", "test")
submit()
start = time.time()
#Check pages
check_link("Blog", "Mockito cheat sheet")
check_link("Categories","Other")
check_link("Pages","Atom Feed")
time_spent = time.time()-start
print "Ran {0} tests in {1:.2f}s, {2} successes, {3} errors.".format(success+error,time_spent, success, error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment