from datetime import datetime from decimal import Decimal import gittip from gittip.billing.payday import Payday from gittip import testing, wireup from mock import patch # commaize simplate = testing.load_simplate('/about/stats.html') commaize = simplate.pages[0]['commaize'] def test_commaize_commaizes(): actual = commaize(1000.0) assert actual == "1,000", actual def test_commaize_commaizes_and_obeys_decimal_places(): actual = commaize(1000, 4) assert actual == "1,000.0000", actual # chart of giving def test_get_chart_of_giving_handles_a_tip(): tip = ("foo", "bar", "3.00", True) expected = ( [[Decimal('3.00'), 1, Decimal('3.00'), 1.0, Decimal('1')]] , 1.0, Decimal('3.00') ) with testing.setup_tips(tip):
def setUp(self): super(Harness, self).setUp() simplate = load_simplate('/about/stats.html') self.commaize = simplate.pages[0]['commaize']
from datetime import datetime from decimal import Decimal from gittip import wireup from gittip.testing import load, load_simplate, serve_request, tip_graph from gittip.billing.payday import Payday from gittip.participant import Participant from mock import patch # commaize simplate = load_simplate('/about/stats.html') commaize = simplate.pages[0]['commaize'] def test_commaize_commaizes(): actual = commaize(1000.0) assert actual == "1,000", actual def test_commaize_commaizes_and_obeys_decimal_places(): actual = commaize(1000, 4) assert actual == "1,000.0000", actual # chart of giving def check_chart_of_receiving(participant_id): return Participant(participant_id).get_chart_of_receiving() def test_get_chart_of_receiving_handles_a_tip():
from datetime import datetime from mock import patch from gittip.billing.payday import Payday from gittip import testing from gittip import wireup # commaize simplate = testing.load_simplate("/about/stats.html") commaize = simplate.pages[0]["commaize"] def test_commaize_commaizes(): actual = commaize(1000.0) assert actual == "1,000", actual def test_commaize_commaizes_and_obeys_decimal_places(): actual = commaize(1000, 4) assert actual == "1,000.0000", actual # rendering class TestStatsPage(testing.GittipBaseTest): def get_stats_page(self): response = testing.serve_request("/about/stats.html")