Last change
on this file was
aeb53bd,
checked in by OpenGnSys Support Team <soporte-og@…>, 4 years ago
|
#915 Test GET /scopes
And fix ogserver, report error if GET /scopes have a JSON body.
|
-
Property mode set to
100644
|
File size:
813 bytes
|
Line | |
---|
1 | import requests |
---|
2 | import unittest |
---|
3 | |
---|
4 | class TestGetScopesMethods(unittest.TestCase): |
---|
5 | |
---|
6 | def setUp(self): |
---|
7 | self.url = 'http://localhost:8888/scopes' |
---|
8 | self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'} |
---|
9 | self.json = None |
---|
10 | |
---|
11 | def test_get(self): |
---|
12 | returned = requests.get(self.url, headers=self.headers, json=self.json) |
---|
13 | self.assertEqual(returned.status_code, 200) |
---|
14 | |
---|
15 | def test_empty_payload(self): |
---|
16 | returned = requests.get(self.url, headers=self.headers, json={}) |
---|
17 | self.assertEqual(returned.status_code, 400) |
---|
18 | |
---|
19 | def test_malformed_payload(self): |
---|
20 | returned = requests.get(self.url, headers=self.headers, json={ 'client': ['192.168.56.11'] }) |
---|
21 | self.assertEqual(returned.status_code, 400) |
---|
22 | |
---|
23 | |
---|
24 | if __name__ == '__main__': |
---|
25 | unittest.main() |
---|
Note: See
TracBrowser
for help on using the repository browser.