from gittip.testing import serve_request, tip_graph


def test_homepage():
    actual = serve_request('/').body
    expected = "Gittip happens every Thursday."
    assert expected in actual, actual

def test_profile():
    with tip_graph(("cheese", "puffs", 0)):
        expected = "I&rsquo;m grateful for tips"
        actual = serve_request('/cheese/').body
        assert expected in actual, actual

def test_widget():
    with tip_graph(("cheese", "puffs", 0)):
        expected = "javascript: window.open"
        actual = serve_request('/cheese/widget.html').body
        assert expected in actual, actual

def test_bank_account():
    expected = "add or change your bank account"
    actual = serve_request('/bank-account.html').body
    assert expected in actual, actual

def test_credit_card():
    expected = "add or change your credit card"
    actual = serve_request('/credit-card.html').body
    assert expected in actual, actual

def test_github_associate():
    expected = "Bad request, program!"
    actual = serve_request('/on/github/associate').body
    assert expected in actual, actual

def test_twitter_associate():
    expected = "Bad request, program!"
    actual = serve_request('/on/twitter/associate').body
    assert expected in actual, actual

def test_about():
    expected = "pretty-smart grants"
    actual = serve_request('/about/').body
    assert expected in actual, actual

def test_about_stats():
    expected = "have joined Gittip"
    actual = serve_request('/about/stats.html').body
    assert expected in actual, actual

def test_about_charts():
    expected = "growth since it launched"
    actual = serve_request('/about/charts.html').body
    assert expected in actual, actual

def test_about_unclaimed():
    expected = "Unclaimed"
    actual = serve_request('/about/unclaimed.html').body
    assert expected in actual, actual


# These hit the network. XXX add a knob to skip these

def test_github_proxy():
    expected = "<b>lgtest</b> has not joined"
    actual = serve_request('/on/github/lgtest/').body
    assert expected in actual, actual

def test_twitter_proxy():
    expected = "<b>Twitter</b> has not joined"
    actual = serve_request('/on/twitter/twitter/').body
    assert expected in actual, actual

@@ -44,16 +44,22 @@
 ip_graph
+, load
 %0A%0A%0Adef t
@@ -1944,32 +1944,53 @@
 github_proxy():%0A
+    with load():%0A    
     expected = %22
@@ -2015,32 +2015,36 @@
 not joined%22%0A    
+ 
+   
 actual = serve_r
@@ -2069,32 +2069,36 @@
 /lgtest/').body%0A
+    
     assert expec
@@ -2142,24 +2142,45 @@
 er_proxy():%0A
+    with load():%0A    
     expected
@@ -2210,32 +2210,36 @@
 not joined%22%0A    
+ 
+   
 actual = serve_r
@@ -2266,32 +2266,36 @@
 twitter/').body%0A
+    
     assert expec

Fix regression with test_pages (#406)