From e53e120dbbc6cbedb63570fdfc71c7aedd30488c Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 1 May 2019 16:08:44 -0700 Subject: [PATCH] pagekite: Convert tests to pytest style Signed-off-by: Sunil Mohan Adapa Reviewed-by: Joseph Nuthalapati --- .../modules/pagekite/tests/test_pagekite.py | 62 +++++++++---------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/plinth/modules/pagekite/tests/test_pagekite.py b/plinth/modules/pagekite/tests/test_pagekite.py index 2a777ef26..8375c3e86 100644 --- a/plinth/modules/pagekite/tests/test_pagekite.py +++ b/plinth/modules/pagekite/tests/test_pagekite.py @@ -19,40 +19,36 @@ Test modules for Pagekite functions. """ -import unittest - from plinth.modules.pagekite import utils -class TestPagekiteActions(unittest.TestCase): - """Test-cases for the pagekite action utils""" - _tests = [ - { - 'line': 'https/8080:*.@kitename:localhost:8080:@kitesecret', - 'params': {'kitename': '*.@kitename', 'backend_host': 'localhost', - 'secret': '@kitesecret', 'protocol': 'https/8080', - 'backend_port': '8080'} - }, - { - 'line': 'https:*.@kitename:localhost:80:@kitesecret', - 'params': {'protocol': 'https', - 'kitename': '*.@kitename', - 'backend_port': '80', - 'backend_host': 'localhost', - 'secret': '@kitesecret'} - }, - { - 'line': 'raw/22:@kitename:localhost:22:@kitesecret', - 'params': {'protocol': 'raw/22', - 'kitename': '@kitename', - 'backend_port': '22', - 'backend_host': 'localhost', - 'secret': '@kitesecret'} - }, - ] +_tests = [ + { + 'line': 'https/8080:*.@kitename:localhost:8080:@kitesecret', + 'params': {'kitename': '*.@kitename', 'backend_host': 'localhost', + 'secret': '@kitesecret', 'protocol': 'https/8080', + 'backend_port': '8080'} + }, + { + 'line': 'https:*.@kitename:localhost:80:@kitesecret', + 'params': {'protocol': 'https', + 'kitename': '*.@kitename', + 'backend_port': '80', + 'backend_host': 'localhost', + 'secret': '@kitesecret'} + }, + { + 'line': 'raw/22:@kitename:localhost:22:@kitesecret', + 'params': {'protocol': 'raw/22', + 'kitename': '@kitename', + 'backend_port': '22', + 'backend_host': 'localhost', + 'secret': '@kitesecret'} + }, +] - def test_convert_service_to_string(self): - """ Test deconstructing parameter dictionaries into strings """ - for test in self._tests: - service_string = utils.convert_service_to_string(test['params']) - self.assertEqual(test['line'], service_string) +def test_convert_service_to_string(): + """ Test deconstructing parameter dictionaries into strings """ + for test in _tests: + service_string = utils.convert_service_to_string(test['params']) + assert test['line'] == service_string