source: ogClient-Git/tests/units/test_0004_hardware.py

Last change on this file was cb9edc8, checked in by OpenGnSys Support Team <soporte-og@…>, 4 years ago

ogClient is AGPLv3+

Update license header in files.

  • Property mode set to 100644
File size: 1.0 KB
Line 
1#
2# Copyright (C) 2020-2021 Soleta Networks <info@soleta.eu>
3#
4# This program is free software: you can redistribute it and/or modify it under
5# the terms of the GNU Affero General Public License as published by the
6# Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8
9from server import Server
10from client import Client
11import unittest
12import json
13
14class TestHardwareMethods(unittest.TestCase):
15
16    def test_get(self):
17        req = 'GET /hardware HTTP/1.0\r\nContent-Length: 0\r\n' + \
18              'Content-Type: application/json\r\n\r\n '
19        c = Client()
20        s = Server()
21        s.connect()
22        s.send(req)
23        client_response = s.recv()
24        s.stop()
25        c.stop()
26        self.assertRegex(client_response, '^HTTP/1.0 200 OK\r\n*')
27        client_response = client_response.split('\r\n\r\n')
28        response_json = json.loads(client_response[1])
29        self.assertIn('hardware', response_json)
30
31if __name__ == '__main__':
32    unittest.main()
Note: See TracBrowser for help on using the repository browser.