Message ID | 1459535615-16683-1-git-send-email-holger@freyther.de |
---|---|
State | Superseded |
Headers | show |
On Fri, Apr 01, 2016 at 08:33:33PM +0200, Holger Freyther wrote: > From: Holger Hans Peter Freyther <holger@moiji-mobile.com> > > Add testcase to issue the subscriber create twice. Could be nice to add this clarification in the test code as comment: > db_create_subscriber in db.c will first try to find the subscriber and if it > exists, it will update the "updated" column in the database. [...] > + > + # Lets create one > + res = self.vty.command('subscriber create imsi '+imsi) > + self.assert_(res.find(" IMSI: "+imsi) > 0) ... right here. > + res2 = self.vty.command('subscriber create imsi '+imsi) > + self.assert_(res2.find(" IMSI: "+imsi) > 0) > + self.assertEqual(res, res2) The test isn't testing the update of the 'updated' column, right? Why though would the db want to update the 'updated' column for such a noop anyway? ~Neels
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py index 8db0825..620254e 100644 --- a/openbsc/tests/vty_test_runner.py +++ b/openbsc/tests/vty_test_runner.py @@ -307,6 +307,34 @@ class TestVTYNITB(TestVTYGenericBSC): if classNum != 10: self.assertEquals(res.find("rach access-control-class " + str(classNum) + " barred"), -1) + def testSubscriberCreateDeleteTwice(self): + self.vty.enable() + + imsi = "204300854013739" + + # Initially we don't have this subscriber + self.vty.verify('show subscriber imsi '+imsi, ['% No subscriber found for imsi '+imsi]) + + # Lets create one + res = self.vty.command('subscriber create imsi '+imsi) + self.assert_(res.find(" IMSI: "+imsi) > 0) + res2 = self.vty.command('subscriber create imsi '+imsi) + self.assert_(res2.find(" IMSI: "+imsi) > 0) + self.assertEqual(res, res2) + + # Now we have it + res = self.vty.command('show subscriber imsi '+imsi) + self.assert_(res.find(" IMSI: "+imsi) > 0) + + # Delete it + res = self.vty.command('subscriber delete imsi '+imsi) + 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) + + def testSubscriberCreateDelete(self): self.vty.enable()
From: Holger Hans Peter Freyther <holger@moiji-mobile.com> Add testcase to issue the subscriber create twice. db_create_subscriber in db.c will first try to find the subscriber and if it exists, it will update the "updated" column in the database. Related: OS Issue #1657 --- openbsc/tests/vty_test_runner.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)