From 556aa6b858ac1c5bf5d6ef39448dd69e56798fb2 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Thu, 30 May 2019 18:12:57 +0200 Subject: #915 add test for POST /wol REST API --- tests/units/0003-post-wol.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/units/0003-post-wol.py (limited to 'tests') diff --git a/tests/units/0003-post-wol.py b/tests/units/0003-post-wol.py new file mode 100644 index 0000000..686cb37 --- /dev/null +++ b/tests/units/0003-post-wol.py @@ -0,0 +1,20 @@ +import requests +import unittest + +class TestPostWolMethods(unittest.TestCase): + + def setUp(self): + self.url = 'http://localhost:8888/wol' + self.json = { 'type' : 'broadcast', 'clients' : { 'addr' : '192.168.2.1', + 'mac' : '00AABBCCDD01' } } + + def test_post(self): + returned = requests.post(self.url, json=self.json) + self.assertEqual(returned.status_code, 200) + + def test_get(self): + returned = requests.post(self.url) + self.assertEqual(returned.status_code, 404) + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3-18-g5258