Skip to content

Commit

Permalink
(feat) update test
Browse files Browse the repository at this point in the history
  • Loading branch information
azai91 committed Nov 22, 2015
1 parent 4736f5e commit 4982b0f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test:
# python -m tests.util_test
# python -m tests.venmo_api_test
# python -m tests.server_test
python -m tests.util_test
python -m tests.venmo_api_test
python -m tests.server_test
python -m tests.venmo_test
21 changes: 16 additions & 5 deletions tests/venmo_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from src.config import FRIENDS_URL, LOGIN, LOGOUT, CLEAR_CACHE, INVALID
import json
import logging
import os
import sys
# from src.venmo_api import Venmo as Venmo_backup

CachedData = {}
Expand Down Expand Up @@ -95,36 +97,42 @@ def test_generate_payload(self):
'user_id' : friend['id'],
'amount' : '[amount]',
'note' : '[note]',
'display_name' : friend['display_name']
})

self.assertEqual(Venmo.generate_payload(['1'], friend),{
'user_id' : friend['id'],
'amount' : '1.00',
'note' : '[note]'
'note' : '[note]',
'display_name' : friend['display_name']
})

self.assertEqual(Venmo.generate_payload(['-'], friend),{
'user_id' : friend['id'],
'amount' : '[amount]',
'note' : '[note]'
'note' : '[note]',
'display_name' : friend['display_name']
})

self.assertEqual(Venmo.generate_payload(['1',''], friend),{
'user_id' : friend['id'],
'amount' : '1.00',
'note' : '[note]'
'note' : '[note]',
'display_name' : friend['display_name']
})

self.assertEqual(Venmo.generate_payload(['1','t'], friend),{
'user_id' : friend['id'],
'amount' : '1.00',
'note' : 't'
'note' : 't',
'display_name' : friend['display_name']
})

self.assertEqual(Venmo.generate_payload(['1','test test'], friend),{
'user_id' : friend['id'],
'amount' : '1.00',
'note' : 'test test'
'note' : 'test test',
'display_name' : friend['display_name']
})

def test_format_title(self):
Expand Down Expand Up @@ -197,6 +205,9 @@ def test_show_formatting(self):


def setUp(self):
f = open(os.devnull, 'w')
sys.stdout = f

CachedData.clear()
StoredData.clear()
Passwords.clear()
Expand Down

0 comments on commit 4982b0f

Please sign in to comment.