climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1563524 - /incubator/climate/trunk/ocw-ui/backend/tests/test_directory_helpers.py
Date Sat, 01 Feb 2014 23:57:23 GMT
Author: joyce
Date: Sat Feb  1 23:57:23 2014
New Revision: 1563524

URL: http://svn.apache.org/r1563524
Log:
CLIMATE-326 - Add /dir/list valid directory path testing

Modified:
    incubator/climate/trunk/ocw-ui/backend/tests/test_directory_helpers.py

Modified: incubator/climate/trunk/ocw-ui/backend/tests/test_directory_helpers.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw-ui/backend/tests/test_directory_helpers.py?rev=1563524&r1=1563523&r2=1563524&view=diff
==============================================================================
--- incubator/climate/trunk/ocw-ui/backend/tests/test_directory_helpers.py (original)
+++ incubator/climate/trunk/ocw-ui/backend/tests/test_directory_helpers.py Sat Feb  1 23:57:23
2014
@@ -7,6 +7,22 @@ from ..directory_helpers import _get_cle
 
 test_app = TestApp(app)
 
+class TestDirectoryPathList(unittest.TestCase):
+    PATH_LEADER = '/usr/local/rcmes'
+
+    if not os.path.exists(PATH_LEADER): os.mkdir(PATH_LEADER)
+    if not os.path.exists(PATH_LEADER + '/bar'):
+        os.mkdir(PATH_LEADER + '/bar')
+    if not os.path.exists(PATH_LEADER + '/baz.txt'):
+        open(PATH_LEADER + '/baz.txt', 'a').close()
+    if not os.path.exists(PATH_LEADER + '/test.txt'):
+        open(PATH_LEADER + '/test.txt', 'a').close()
+
+    def test_valid_path_listing(self):
+        expected_return = {"listing": ["/bar/", "/baz.txt", "/test.txt"]}
+        response = test_app.get('http://localhost:8082/dir/list//')
+        self.assertDictEqual(response.json, expected_return)
+
 class TestDirectoryPathCleaner(unittest.TestCase):
     PATH_LEADER = '/tmp/foo'
     VALID_CLEAN_DIR = '/tmp/foo/bar'



Mime
View raw message