[PATCH] osmo-hlr[master]: add CTRL tests for enable-/disable-/status-ps

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Sep 25 21:27:27 UTC 2017


Review at  https://gerrit.osmocom.org/4064

add CTRL tests for enable-/disable-/status-ps

Change-Id: I014437db9c0f15d818e04810f6cb14bf475ee002
---
M tests/ctrl_test_runner.py
1 file changed, 42 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/64/4064/1

diff --git a/tests/ctrl_test_runner.py b/tests/ctrl_test_runner.py
index d453197..7c14f50 100644
--- a/tests/ctrl_test_runner.py
+++ b/tests/ctrl_test_runner.py
@@ -163,6 +163,46 @@
         return responses
 
 
+class TestCtrlHLR(TestCtrlBase):
+
+    HLR_DB = 'hlr_ctrl_test.db'
+    HLR_SQL = '%s/sql/hlr.sql' % confpath
+    HLR_TEST_SQL = '%s/tests/test_subscriber.sql' % confpath
+
+    def setUp(self):
+        print('\n')
+        print(os.getcwd())
+        assert subprocess.call('sqlite3 %s < %s' % (self.HLR_DB, self.HLR_SQL), shell=True) == 0
+        assert subprocess.call('sqlite3 %s < %s' % (self.HLR_DB, self.HLR_TEST_SQL), shell=True) == 0
+        super(TestCtrlHLR, self).setUp()
+
+    def tearDown(self):
+        super(TestCtrlHLR, self).tearDown()
+        os.unlink("hlr_ctrl_test.db")
+
+    def ctrl_command(self):
+        return ["./src/osmo-hlr", "-c", "doc/examples/osmo-hlr.cfg", '-l', 'hlr_ctrl_test.db']
+
+    def ctrl_app(self):
+        return (4259, "./src/osmo-hlr", "OsmoHLR", "hlr")
+
+    def testCtrlErrs(self):
+        r = self.do_get('invalid')
+        self.assertEquals(r['mtype'], 'ERROR')
+        self.assertEquals(r['error'], 'Command not found')
+
+    def testEnableDisablePs(self):
+        self.assert_set('enable-ps', '901990000000001', 'OK')
+        self.assert_set('status-ps', '901990000000001', '1')
+        self.assert_set('enable-ps', '901990000000001', 'OK')
+        self.assert_set('status-ps', '901990000000001', '1')
+        self.assert_set('disable-ps', '901990000000001', 'OK')
+        self.assert_set('status-ps', '901990000000001', '0')
+        self.assert_set('disable-ps', '901990000000001', 'OK')
+        self.assert_set('status-ps', '901990000000001', '0')
+        self.assert_set('enable-ps', '901990000000001', 'OK')
+        self.assert_set('status-ps', '901990000000001', '1')
+
 if __name__ == '__main__':
     import argparse
     import sys
@@ -193,6 +233,8 @@
     os.chdir(workdir)
     print "Running tests for specific control commands"
     suite = unittest.TestSuite()
+    test = unittest.TestLoader().loadTestsFromTestCase(TestCtrlHLR)
+    suite.addTest(test)
     res = unittest.TextTestRunner(verbosity=verbose_level).run(suite)
     sys.exit(len(res.errors) + len(res.failures))
 

-- 
To view, visit https://gerrit.osmocom.org/4064
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I014437db9c0f15d818e04810f6cb14bf475ee002
Gerrit-PatchSet: 1
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list