diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2021-04-16 13:39:03 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2021-04-19 19:05:15 +0200 |
commit | c2c6ce93b1feecbcc79b4d52cf68823f14e88410 (patch) | |
tree | c2ce352891770bfffcc3001a733ea7e1093af2b1 /tests/units/test_0032_big_response.py | |
parent | 0b5c0813fa253e4f020fc4ee09a2501f96329337 (diff) |
#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.
Diffstat (limited to 'tests/units/test_0032_big_response.py')
-rw-r--r-- | tests/units/test_0032_big_response.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/units/test_0032_big_response.py b/tests/units/test_0032_big_response.py new file mode 100644 index 0000000..49dee76 --- /dev/null +++ b/tests/units/test_0032_big_response.py @@ -0,0 +1,26 @@ +import subprocess +import requests +import unittest +import tempfile + +class TestBigResponse(unittest.TestCase): + + def setUp(self): + self.url = 'http://localhost:8888/scopes' + self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'} + self.query = tempfile.NamedTemporaryFile() + self.query.write(b'INSERT INTO centros (nombrecentro, identidad, ' + + b'comentarios, directorio) VALUES ' + + b'("Center", 1, "", ""),' * 5000 + + b'("Center", 1, "", "");') + + def test_get(self): + subprocess.run('mysql --default-character-set=utf8 test-db < ' + + self.query.name, shell=True) + returned = requests.get(self.url, headers=self.headers) + subprocess.run('mysql --default-character-set=utf8 test-db ' + '< config/basic_data.sql', shell=True) + self.assertEqual(returned.status_code, 400) + +if __name__ == '__main__': + unittest.main() |