[PATCH] openbsc[master]: Fix vty tests

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/.

Max gerrit-no-reply at lists.osmocom.org
Wed Jun 22 12:04:55 UTC 2016


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

Fix vty tests

Use correct vty command for subscriber deletion, adjust assertions
accordingly. The error was cause by inconsistent vty commands for
subscriber creation and deletion.

Change-Id: I9b9376b4ac0ec066000545167de312ca4460493b
---
M openbsc/tests/vty_test_runner.py
1 file changed, 11 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/02/402/1

diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index 9ea988d..bae1866 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -388,12 +388,12 @@
         self.assert_(res.find("    IMSI: "+imsi) > 0)
 
         # Delete it
-        res = self.vty.command('subscriber delete imsi '+imsi)
-        self.assert_(res != "")
+        res = self.vty.command('subscriber imsi ' + imsi + ' delete')
+        self.assert_("" == res)
 
         # Now it should not be there anymore
         res = self.vty.command('show subscriber imsi '+imsi)
-        self.assert_(res != '% No subscriber found for imsi '+imsi)
+        self.assert_(('% No subscriber found for imsi ' + imsi) == res)
 
 
     def testSubscriberCreateDelete(self):
@@ -413,12 +413,12 @@
         self.assert_(res.find("    IMSI: "+imsi) > 0)
 
         # Delete it
-        res = self.vty.command('subscriber delete imsi '+imsi)
-        self.assert_(res != "")
+        res = self.vty.command('subscriber imsi ' + imsi + ' delete')
+        self.assert_("" == res)
 
         # Now it should not be there anymore
         res = self.vty.command('show subscriber imsi '+imsi)
-        self.assert_(res != '% No subscriber found for imsi '+imsi)
+        self.assert_(('% No subscriber found for imsi ' + imsi) == res)
 
     def testSubscriberSettings(self):
         self.vty.enable()
@@ -456,16 +456,18 @@
         self.assertTrue(self.vty.verify("subscriber-create-on-demand random 221 222", ['']))
         self.vty.command("end")
 
+        # create subscriber with extension in a configured interval
         res = self.vty.command('subscriber create imsi ' + imsi2)
         self.assert_(res.find("    IMSI: " + imsi2) > 0)
         self.assert_(res.find("221") > 0 or res.find("222") > 0)
         self.assert_(res.find("    Extension: ") > 0)
 
         # Delete it
-        res = self.vty.command('subscriber delete imsi '+imsi)
+        res = self.vty.command('subscriber imsi ' + imsi + ' delete')
         self.assert_(res != "")
-        res = self.vty.command('subscriber delete imsi ' + imsi2)
-        self.assert_(res != "")
+        # imsi2 is inactive so deletion should succeed
+        res = self.vty.command('subscriber imsi ' + imsi2 + ' delete')
+        self.assert_("" == res)
 
     def testShowPagingGroup(self):
         res = self.vty.command("show paging-group 255 1234567")

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b9376b4ac0ec066000545167de312ca4460493b
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list