Last change
on this file was
c2c6ce9,
checked in by OpenGnSys Support Team <soporte-og@…>, 4 years ago
|
#915 Add large HTTP response test
This commit adds a test for HTTP responses that are too large to fit in
ogServer response buffer.
It also moves the basic sql data used for the other tests to its own
file, easing its reuse in several files.
|
-
Property mode set to
100644
|
File size:
1007 bytes
|
Line | |
---|
1 | import subprocess |
---|
2 | import requests |
---|
3 | import unittest |
---|
4 | import tempfile |
---|
5 | |
---|
6 | class TestBigResponse(unittest.TestCase): |
---|
7 | |
---|
8 | def setUp(self): |
---|
9 | self.url = 'http://localhost:8888/scopes' |
---|
10 | self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'} |
---|
11 | self.query = tempfile.NamedTemporaryFile() |
---|
12 | self.query.write(b'INSERT INTO centros (nombrecentro, identidad, ' |
---|
13 | + b'comentarios, directorio) VALUES ' |
---|
14 | + b'("Center", 1, "", ""),' * 5000 |
---|
15 | + b'("Center", 1, "", "");') |
---|
16 | |
---|
17 | def test_get(self): |
---|
18 | subprocess.run('mysql --default-character-set=utf8 test-db < ' |
---|
19 | + self.query.name, shell=True) |
---|
20 | returned = requests.get(self.url, headers=self.headers) |
---|
21 | subprocess.run('mysql --default-character-set=utf8 test-db ' |
---|
22 | '< config/basic_data.sql', shell=True) |
---|
23 | self.assertEqual(returned.status_code, 400) |
---|
24 | |
---|
25 | if __name__ == '__main__': |
---|
26 | unittest.main() |
---|
Note: See
TracBrowser
for help on using the repository browser.