[GRASS-SVN] r74242 - in grass/trunk/scripts/v.db.droptable: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 13 11:33:02 PDT 2019


Author: lucadelu
Date: 2019-03-13 11:33:02 -0700 (Wed, 13 Mar 2019)
New Revision: 74242

Added:
   grass/trunk/scripts/v.db.droptable/testsuite/
   grass/trunk/scripts/v.db.droptable/testsuite/test_v_db_droptable.py
Log:
v.db.droptable: added test, thanks to Sanjeet Bhatti

Added: grass/trunk/scripts/v.db.droptable/testsuite/test_v_db_droptable.py
===================================================================
--- grass/trunk/scripts/v.db.droptable/testsuite/test_v_db_droptable.py	                        (rev 0)
+++ grass/trunk/scripts/v.db.droptable/testsuite/test_v_db_droptable.py	2019-03-13 18:33:02 UTC (rev 74242)
@@ -0,0 +1,48 @@
+"""
+Created on Sun Jun 09 09:18:39 2018
+
+ at author: Sanjeet Bhatti
+"""
+
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
+from grass.gunittest.gmodules import SimpleModule
+
+from grass.script.core import run_command
+from grass.script.utils import decode
+
+
+class TestVDbDropTable(TestCase):
+    """Test v.db.droptable script"""
+
+    @classmethod
+    def setUpClass(cls):
+        """Copy vector."""
+        run_command('g.copy', vector='roadsmajor,myroads')
+
+    @classmethod
+    def tearDownClass(cls):
+        """Remove copied vector"""
+        run_command('g.remove', type='vector', name='myroads',
+                    flags='f')
+
+    def test_drop_table_check(self):
+        """Drop table check, the column should still be in the table"""
+        module = SimpleModule('v.db.droptable', map='myroads')
+        self.assertModule(module)
+
+        m = SimpleModule('db.tables', flags='p')
+        self.assertModule(m)
+        self.assertRegexpMatches(decode(m.outputs.stdout), 'myroads')
+
+    def test_drop_table_with_force(self):
+        """Drop table with force, the column should not be in the table"""
+        module = SimpleModule('v.db.droptable', map='myroads', flags='f')
+        self.assertModule(module)
+
+        m = SimpleModule('db.tables', flags='p')
+        self.assertModule(m)
+        self.assertNotRegexpMatches(decode(m.outputs.stdout), 'myroads')
+
+if __name__ == '__main__':
+    test()


Property changes on: grass/trunk/scripts/v.db.droptable/testsuite/test_v_db_droptable.py
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/x-python
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property


More information about the grass-commit mailing list