1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
import requests
import socket
import time
import json
from test_helper import ApiTestCase
class TestAttrs(ApiTestCase):
def test_Attrs(self):
attrs = dict()
attrs['accountStatus'] = "normal"
r = self.allowFuncAttrs('fredbloggs', '127.0.0.1', "1234", attrs)
j = r.json()
self.assertEqual(j['status'], 0)
r.close()
attrs['accountStatus'] = "blocked"
r = self.allowFuncAttrs('fredbloggs', '127.0.0.1', "1234", attrs)
j = r.json()
self.assertEqual(j['status'], -1)
attrs['accountStatus'] = "normal"
attrs['countryList'] = [ "UK", "US" ]
r = self.allowFuncAttrs('fredbloggs', '127.0.0.1', "1234", attrs)
j = r.json()
self.assertEqual(j['status'], 0)
r.close()
attrs['countryList'] = [ "UK", "US", "Blockmestan" ]
r = self.allowFuncAttrs('fredbloggs', '127.0.0.1', "1234", attrs)
j = r.json()
self.assertEqual(j['status'], -1)
|