#!/usr/bin/env python

import sys
import urllib2

USER_AGENTS={
    
    # iPhone 3 - gets smart styling
    'smart': 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16',
    
    # iPaq - gets dumb styling
    'dumb': 'Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320; HP iPAQ h6300)',
}

URLS=[
    '/',
    '/contact/',
    '/contact/results/',
    '/service-status/',
    '/weather/',
    '/desktop/',
    '/feature-suggestions/',
    '/feedback/',
    '/library/',
]

def verify_200(url, ua):
    try:
        request = urllib2.Request(url, headers={
            'User-Agent': ua,
        })
        file = urllib2.urlopen(url)
        if file.geturl() != url:
            # Redirected
            return file, 300
        else:
            return file, 200
    except urllib2.HTTPError, e:
        return None, e.code

def smoke_test(base_url):
    tests = 0
    status = 0
    print "MOLLY SMOKER"
    print "------------"
    
    for type, ua in USER_AGENTS.items():
        print
        print "Simulating", type
        for url in URLS:
            tests += 1
            file, code = verify_200(base_url + url, ua)
            if code != 200:
                status += 1
                print "FAIL", code, url
            else:
                print " OK ", code, url
    
    print "SUMMARY"
    print "-------"
    print
    print "Ran", tests, "tests"
    if status == 0:
        print "All passed - well done"
    else:
        print status, "tests failed"
    
    return status

if __name__ == '__main__':
    if len(sys.argv) > 1:
        base_url = sys.argv[1]
    else:
        base_url = "http://localhost:8000"
    sys.exit(smoke_test(base_url))
@@ -398,17 +398,8 @@
 S=%5B%0A
-    '/',%0A
     
@@ -446,40 +446,40 @@
   '/
-service-status/',%0A    '/weather/
+contact/results/?query=northwood
 ',%0A 
@@ -535,31 +535,1306 @@
 '/fe
-edback/',%0A    '/library
+ature-suggestions/1/',%0A    '/feedback/',%0A    '/news/',%0A    '/news/molly/',%0A    '/news/molly/272/',%0A    '/',%0A    '/about/',%0A    '/messages/',%0A    '/library/',%0A    '/service-status/',%0A    '/weather/',%0A    '/library/',%0A    '/library/search/',%0A    '/library/search/?title=erewhon&author=&isbn=',%0A    '/library/item:701036753/',%0A    '/library/item:701036753/NLS:0Hall/',%0A    '/places/',%0A    #'/places/nearby/',%0A    #'/places/nearby/bus-stop/',%0A    '/places/category/',%0A    '/places/category/unit/',%0A    '/places/atco:9100OXFD/',%0A    '/places/atco:9100OXFD/?board=arrivals',%0A    '/places/atco:9100OXFD/nearby/',%0A    '/places/atco:9100OXFD/nearby/bus-stop/',%0A    '/places/osm:N295953659/update/',%0A    '/places/openstreetmap/',%0A    #'/places/api/',%0A    '/podcasts/',%0A    '/podcasts/category:bbc-radio-1/',%0A    '/podcasts/radio1/moyles/',%0A    #'/podcasts/itunesu_redirect/',%0A    '/search/',%0A    '/search/?query=molly+project',%0A    '/service-status/',%0A    '/transport/',%0A    '/weather/',%0A    '/webcams/',%0A    '/webcams/york-minster/',%0A    '/auth/',%0A    '/auth/clear-session/',%0A    '/favourites/',%0A    '/geolocation/',%0A    #'/geolocation/clear/',%0A    #'/geolocation/favourites/',%0A    '/maps/touchmaplite/',%0A    '/maps/osm/about/',%0A    '/maps/osm/gpx/foo/',%0A    '/url-shortener/?path=/',%0A    '/device-detection
 /',%0A
@@ -2510,16 +2510,80 @@
 if code 
+== 404:%0A                print %22SKIP%22, url%0A            elif code 
 != 200:%0A

Add a more complete set of URLs to test to the smoke tester