witten
/
luminotes
Archived
1
0
Fork 0

Wrote unit tests for controller.Users.paypal_notify() and thanks() methods.

Changed some wording on the thank you page.
This commit is contained in:
Dan Helfman 2008-01-15 00:36:19 +00:00
parent 095df38e96
commit 76d5f48fa2
5 changed files with 1201 additions and 12 deletions

View File

@ -985,8 +985,8 @@ class Users( object ):
record in the database with their new rate plan. paypal_notify() is
invoked by PayPal itself.
"""
PAYPAL_URL = u"https://www.sandbox.paypal.com/cgi-bin/webscr"
#PAYPAL_URL = u"https://www.paypal.com/cgi-bin/webscr"
#PAYPAL_URL = u"https://www.sandbox.paypal.com/cgi-bin/webscr"
PAYPAL_URL = u"https://www.paypal.com/cgi-bin/webscr"
# check that payment_status is Completed
payment_status = params.get( u"payment_status" )
@ -1054,17 +1054,19 @@ class Users( object ):
# update the database based on the type of transaction
txn_type = params.get( u"txn_type" )
user_id = params.get( u"custom" )
user_id = params.get( u"custom", u"" )
try:
user_id = Valid_id()( user_id )
except ValueError():
except ValueError:
raise Payment_error( u"invalid custom", params )
user = self.__database.load( User, user_id )
if not user:
raise Payment_error( u"unknown custom", params )
if txn_type in ( u"subscr_signup", u"subcr_modify" ):
if txn_type in ( u"subscr_signup", u"subscr_modify" ):
if params.get( u"recurring" ) != u"1":
raise Payment_error( u"invalid recurring", params )
user.rate_plan = plan_index
self.__database.save( user )
elif txn_type == u"subscr_cancel":

View File

@ -0,0 +1,26 @@
from StringIO import StringIO
result = u"VERIFIED"
headers = None
url = None
encodeded_params = None
class Request( object ):
def __init__( self, url ):
global result, headers
headers = {}
def add_header( self, key, value ):
headers[ key ] = value
def urlopen( open_url, params ):
global url
global encoded_params
url = open_url
encoded_params = params
return StringIO( result )

View File

@ -310,6 +310,7 @@ class Test_controller( object ):
u"luminotes.http_proxy_ip" : u"127.0.0.1",
u"luminotes.https_proxy_ip" : u"127.0.0.2",
u"luminotes.support_email": "unittest@luminotes.com",
u"luminotes.payment_email": "unittest@luminotes.com",
u"luminotes.rate_plans": [
{
u"name": u"super",
@ -322,7 +323,7 @@ class Test_controller( object ):
u"name": "extra super",
u"storage_quota_bytes": 31337,
u"notebook_collaboration": True,
u"fee": 199.99,
u"fee": 9.00,
u"button": u"[or here user %s!] button",
},
],

File diff suppressed because it is too large Load Diff

View File

@ -13,15 +13,14 @@ class Thanks_note( Span ):
),
P(
u"""
Your account has been upgraded to Luminotes %s. Please click on
one of your notebooks to the right to get started with your newly
upgraded wiki.
You are now subscribed to Luminotes %s. Please click on one of your
notebooks to the right to get started with your newly upgraded wiki.
""" % rate_plan_name,
),
P(
u"""
If you have any questions about your upgraded wiki, or anything else,
please
If you have any questions about your upgraded wiki or your Luminotes
account, please
""",
A( u"contact support", href = u"/contact_info", target = "_top" ),
u"""