~nchohan/+junk/mytools

« back to all changes in this revision

Viewing changes to bin/notranstest/clientside/test_functions.py

  • Committer: root
  • Date: 2010-11-03 07:43:57 UTC
  • Revision ID: root@appscale-image0-20101103074357-xea7ja3sor3x93oc
init

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import curllib
 
2
def __curl(ip, port, method, args):
 
3
  return curllib.url_post(ip, port, False, method, args)
 
4
 
 
5
def __curlget(ip, port, args):
 
6
  return curllib.url_get(ip, port, False, None)
 
7
 
 
8
def MainIndex(ip, port):
 
9
  return curllib.url_post(ip, port, False, None, None)
 
10
 
 
11
# Primes DB 
 
12
def Root(ip, port):
 
13
  return curllib.url_post(ip, port, False, "root", None)
 
14
 
 
15
def GetIndex(ip, port, sender, receiver, amount, retries=3):
 
16
  return __curlget(ip, port, {})
 
17
 
 
18
def CreateTransfer(ip, port, sender, receiver, amount, retries=3):
 
19
  args = {}
 
20
  args['sender'] = sender 
 
21
  args['receiver'] = receiver
 
22
  args['amount'] = amount
 
23
  args['retries'] = retries
 
24
  return __curl(ip, port, "createtransfer", args)
 
25
 
 
26
def CreateAccount(ip, port, account, balance):
 
27
  args = {}
 
28
  args['account'] = account 
 
29
  args['balance'] = balance
 
30
  return __curl(ip, port, "createaccount", args)
 
31
 
 
32
def BatchCreateAccount(ip, port, numaccounts, offset, balance):
 
33
  args = {}
 
34
  args['numaccounts'] = str(numaccounts)
 
35
  args['balance'] = str(balance)
 
36
  args['offset'] = str(offset)
 
37
  return __curl(ip, port, "batchcreateaccount", args)
 
38
 
 
39
def BatchDeleteAccount(ip, port, numaccount, offset, balance):
 
40
  args = {}
 
41
  args['numaccounts'] = numaccount
 
42
  args['offset'] = offset
 
43
  args['balance'] = balance
 
44
  return __curl(ip, port, "batchdeleteaccount", args)
 
45
 
 
46
def DeleteAccount(ip, port, account):
 
47
  args = {}
 
48
  args['account'] = account
 
49
  return __curl(ip, port, "deleteaccount", args) 
 
50
 
 
51
def GetAccount(ip, port, account):
 
52
  args = {}
 
53
  args['account'] = account
 
54
  return __curl(ip, port, "getaccount", args)