Skip to content

Instantly share code, notes, and snippets.

@javouhey
Created August 10, 2011 03:34
Show Gist options
  • Save javouhey/1136072 to your computer and use it in GitHub Desktop.
Save javouhey/1136072 to your computer and use it in GitHub Desktop.
How to test fraud checker

Browser testing

  1. http://gavin/accounting/fraud_unit_test/
  2. http://gavin/accounting/ajax/fraud_check/
  3. http://gavin/accounting/ajax/fraud_check/?async=True

How to test on django shell:


from django.test.client import Client
from gavin.accounting.models import Order
client = Client()
response = client.post( '/accounting/fraud_unit_test/', {} )
fraud_data = { 'i': '8.8.8.8', 'city': 'Mountain View', 'region': 'CA', 'country': 'US', 'postal': '94043', 
'domain': 'yahoo.com', 'license_key': '9edwkLEgHrWQ', 'email': 'alibaba@gmail.com', 'license_owner': 'Ali Baba',
 'order_id': Order.objects.latest('counter').id, 'addresses': { 'invoice': { 'company': 'Google Inc', 'address1': '1600 Amphitheatre Parkway', 
'zip': '94043', 'city': 'Mountain View', 'state': 'CA', 'vatid': 'FR1111133434' }, 'delivery': {} } }

from gavin.accounting.tasks import async_fraud_checker
res = async_fraud_checker.apply_async(args=[fraud_data, 'session162572t3'], 
  kwargs={'is_checked':True}, queue='celery', routing_key="celery") 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment