Last change
on this file since 646355d was
6386d37,
checked in by OpenGnSys Support Team <soporte-og@…>, 4 years ago
|
#915 Test for GET /client/info and POST /client/add
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | import requests |
---|
2 | import unittest |
---|
3 | |
---|
4 | class TestPostClientAddMethods(unittest.TestCase): |
---|
5 | |
---|
6 | def setUp(self): |
---|
7 | self.url = 'http://localhost:8888/client/add' |
---|
8 | self.headers = {'Authorization' : '07b3bfe728954619b58f0107ad73acc1'} |
---|
9 | self.json = { 'boot' :"19pxeADMIN", |
---|
10 | "center": 0, |
---|
11 | "hardware_id": 0, |
---|
12 | "id": 2, |
---|
13 | "ip": "192.168.56.13", |
---|
14 | "livedir": "ogLive", |
---|
15 | "mac": "0800270E6512", |
---|
16 | "maintenance": True, |
---|
17 | "name": "pc12", |
---|
18 | "netdriver": "generic", |
---|
19 | "netiface": "eth1", |
---|
20 | "netmask": "255.255.255.0", |
---|
21 | "remote": False, |
---|
22 | "repo_id": 1, |
---|
23 | "room": 1, |
---|
24 | "serial_number": "" } |
---|
25 | |
---|
26 | |
---|
27 | def test_post(self): |
---|
28 | returned = requests.post(self.url, headers=self.headers, json=self.json) |
---|
29 | self.assertEqual(returned.status_code, 200) |
---|
30 | |
---|
31 | #def test_post_no_payload(self): |
---|
32 | #returned = requests.post(self.url, headers=self.headers, json={}) |
---|
33 | #self.assertEqual(returned.status_code, 400) |
---|
34 | |
---|
35 | #def test_post_malformed_payload(self): |
---|
36 | #returned = requests.post(self.url, headers=self.headers, json={'boot' :"19pxeADMIN"}) |
---|
37 | #self.assertEqual(returned.status_code, 400) |
---|
38 | |
---|
39 | if __name__ == '__main__': |
---|
40 | unittest.main() |
---|
Note: See
TracBrowser
for help on using the repository browser.