sambatool tests: make assertMatch use assertIn
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 9 Mar 2018 02:20:53 +0000 (15:20 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Sat, 5 May 2018 02:32:42 +0000 (04:32 +0200)
With a note to tidy this up at some point

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
python/samba/tests/samba_tool/base.py

index de257e3db09a96476337e26e0bb1bb2559e4adfa..89a09225e643513642f59518e9161a510592a845 100644 (file)
@@ -96,10 +96,11 @@ class SambaToolCmdTest(samba.tests.BlackboxTestCase):
         self.assertIsNotNone(val, msg)
 
     def assertMatch(self, base, string, msg=None):
         self.assertIsNotNone(val, msg)
 
     def assertMatch(self, base, string, msg=None):
+        # Note: we should stop doing this and just use self.assertIn()
         if msg is None:
             msg = "%r is not in %r" % (truncate_string(string),
                                        truncate_string(base))
         if msg is None:
             msg = "%r is not in %r" % (truncate_string(string),
                                        truncate_string(base))
-        self.assertTrue(string in base, msg)
+        self.assertIn(string, base, msg)
 
     def randomName(self, count=8):
         """Create a random name, cap letters and numbers, and always starting with a letter"""
 
     def randomName(self, count=8):
         """Create a random name, cap letters and numbers, and always starting with a letter"""