diff --git a/pyproject.toml b/pyproject.toml index 439cf9c..787831d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,3 +12,8 @@ requires = [ ] description-file = "README.md" requires-python = ">=3.4" + +[tool.flit.metadata.requires-extra] +test = [ + "responses" +] diff --git a/tests/test_simple.py b/tests/test_simple.py index 9d45f4f..43a369b 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -1,2 +1,23 @@ -def test_simple(): - assert True +import unittest +import wideq +import responses +import json + + +class SimpleTest(unittest.TestCase): + @responses.activate + def test_gateway_info(self): + responses.add( + responses.POST, + 'https://kic.lgthinq.com:46030/api/common/gatewayUriList', + json={'lgedmRoot': 'foo'}, + ) + + data = wideq.gateway_info('COUNTRY', 'LANGUAGE') + self.assertEqual(data, 'foo') + + self.assertEqual(len(responses.calls), 1) + self.assertEqual( + json.loads(responses.calls[0].request.body), + {'lgedmRoot': {'countryCode': 'COUNTRY', 'langCode': 'LANGUAGE'}}, + ) diff --git a/tox.ini b/tox.ini index 405ccff..4c9ba80 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,7 @@ envlist = py34,py35,py36,py37,flake8,coverage isolated_build = True [testenv] +extras = test commands = python -m unittest {posargs} discover -s tests