File: test_Block.py

package info (click to toggle)
weakforced 3.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,040 kB
  • sloc: cpp: 20,397; python: 2,002; sh: 700; makefile: 432
file content (23 lines) | stat: -rw-r--r-- 563 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import requests
import socket
import time
import json
from test_helper import ApiTestCase

class TestBlock(ApiTestCase):

    def test_block(self):
        r = self.allowFunc("baddie", "127.0.0.1", "1234")
        j = r.json()
        self.assertEqual(j['status'], 0)
        r.close()

        for i in range(100):
            r = self.reportFunc('baddie', '127.0.0.1', "1234'%s" % i, False)
            r.json()

        r = self.allowFunc('baddie', '127.0.0.1', "1234")
        j = r.json()
        self.assertEqual(j['status'], -1)
        r.close()