changeset 5713:491961dfd0c8

pytest migration: files: convert to TestControllerPytest and parametrize Migrate the 'files' tests to pytest and its parametrize decorator. The syntax of this decorator is slightly different: a first argument is a comma-separated string with the method argument names for which the values are provided as second argument.
author Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
date Wed, 10 Feb 2016 18:30:27 +0100
parents 6b67bbc1652e
children b6c702202f82
files kallithea/tests/functional/test_files.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/functional/test_files.py	Wed Feb 10 18:30:13 2016 +0100
+++ b/kallithea/tests/functional/test_files.py	Wed Feb 10 18:30:27 2016 +0100
@@ -24,7 +24,7 @@
     Session().commit()
 
 
-class TestFilesController(TestController):
+class TestFilesController(TestControllerPytest):
 
     def test_index(self):
         self.log_user()
@@ -347,7 +347,7 @@
 
         self.checkSessionFlash(response, 'No filename')
 
-    @parameterized.expand([
+    @parametrize('location,filename', [
         ('/abs', 'foo'),
         ('../rel', 'foo'),
         ('file/../foo', 'foo'),
@@ -367,7 +367,7 @@
 
         self.checkSessionFlash(response, 'Location must be relative path and must not contain .. in path')
 
-    @parameterized.expand([
+    @parametrize('cnt,location,filename', [
         (1, '', 'foo.txt'),
         (2, 'dir', 'foo.rst'),
         (3, 'rel/dir', 'foo.bar'),
@@ -423,7 +423,7 @@
 
         self.checkSessionFlash(response, 'No filename')
 
-    @parameterized.expand([
+    @parametrize('location,filename', [
         ('/abs', 'foo'),
         ('../rel', 'foo'),
         ('file/../foo', 'foo'),
@@ -443,7 +443,7 @@
 
         self.checkSessionFlash(response, 'Location must be relative path and must not contain .. in path')
 
-    @parameterized.expand([
+    @parametrize('cnt,location,filename', [
         (1, '', 'foo.txt'),
         (2, 'dir', 'foo.rst'),
         (3, 'rel/dir', 'foo.bar'),