<commit_before>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<commit_msg>Fix regression with test_pages (#406)<commit_after>from gittip.testing import serve_request, tip_graph, load


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():
    with load():
        expected = "<b>lgtest</b> has not joined"
        actual = serve_request('/on/github/lgtest/').body
        assert expected in actual, actual

def test_twitter_proxy():
    with load():
        expected = "<b>Twitter</b> has not joined"
        actual = serve_request('/on/twitter/twitter/').body
        assert expected in actual, actual
{'fraction_non_alphanumeric': 0.11163589523400601, 'fraction_numerical': 0.0015027908973808501, 'mean_word_length': 3.5856299212598426, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '767249', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1281, 'n_words': 408}