def test_all_tests_empty_folder(self, path_to_filepath, all_testfiles): path = "/" dirpath = "/root" path_to_filepath.return_value = dirpath all_testfiles.return_value = (f for f in []) expected = [] result = loading.all_tests(path) self.assertEquals(result, expected) all_testfiles.assert_called_once_with(dirpath)
def test_all_tests_two_level_root(self, load_test, path_to_filepath, all_testfiles): path = "/two/levels" dirpath = "/root/two/levels" filepath = "/root/two/levels/foo.md" urlpath = "/two/levels/foo.md" filename = "foo.md" path_to_filepath.return_value = dirpath all_testfiles.return_value = (f for f in [filename]) testcase = Mock() load_test.return_value = testcase expected = [testcase] result = loading.all_tests(path) path_to_filepath.assert_called_once_with(path) load_test.assert_called_once_with(urlpath, filepath) self.assertEquals(result, expected)
def list_tests(path): testcases = all_tests(path) folders = all_folders(path) return render_template('index.html', testcases=testcases, folders=folders)