File: test_Attrs.py

package info (click to toggle)
weakforced 3.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,196 kB
  • sloc: cpp: 20,397; python: 2,002; sh: 700; makefile: 432
file content (33 lines) | stat: -rw-r--r-- 1,008 bytes parent folder | download | duplicates (2)
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)