| Total Complexity | 5 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| 1 | """Test HTTP capabilities of the core's frontend.""" |
||
| 6 | 1 | class HttpTest(PPPTestCase(app)): |
|
| 7 | 1 | config_var = 'PPP_CORE_CONFIG' |
|
| 8 | 1 | config = """ |
|
| 9 | { |
||
| 10 | "debug": true, |
||
| 11 | "modules": [] |
||
| 12 | } |
||
| 13 | """ |
||
| 14 | 1 | def testPostOnly(self): |
|
| 15 | 1 | self.assertEqual(self.app.get('/', status='*').status_int, 405) |
|
| 16 | 1 | self.assertEqual(self.app.put('/', status='*').status_int, 405) |
|
| 17 | 1 | def testNotRoot(self): |
|
| 18 | 1 | self.assertEqual(self.app.post_json('/foo', {}, status='*').status_int, 400) |
|
| 19 | 1 | def testNotJson(self): |
|
| 20 | 1 | self.assertEqual(self.app.post('/', 'foobar', status='*').status_int, 400) |
|
| 21 | 1 | def testWorking(self): |
|
| 22 | 1 | q = {'id': '1', 'language': 'en', 'tree': {'type': 'triple', |
|
| 23 | 'subject': {'type': 'resource', 'value': 'foo'}, |
||
| 24 | 'predicate': {'type': 'resource', 'value': 'bar'}, |
||
| 25 | 'object': {'type': 'resource', 'value': 'baz'}}, |
||
| 26 | 'measures': {}, 'trace': []} |
||
| 27 | 1 | self.assertResponse(q, []) |
|
| 28 | 1 | def testNoTree(self): |
|
| 29 | 1 | q = {'language': 'en'} |
|
| 30 | self.assertStatusInt(q, 400) |
||
| 31 |