def test_failed(path): testcase = find_test(path) if not testcase: return ("Test not found", 404) models.save_failed(testcase) return redirect('/')
def test_find_test_file_does_not_exist(self, os_exists, path_to_filepath): path = "/foo/bar.md" filepath = "/root/foo/bar.md" os_exists.return_value = False path_to_filepath.return_value = filepath expected = None result = loading.find_test(path) os_exists.assert_called_once_with(filepath) self.assertEquals(result, expected)
def test_find_test(self, load_test, os_exists, path_to_filepath): path = "/foo/bar.md" filepath = "/root/foo/bar.md" testcase = Mock() load_test.return_value = testcase os_exists.return_value = True path_to_filepath.return_value = filepath result = loading.find_test(path) load_test.assert_called_once_with(path, filepath) self.assertEquals(result, testcase)
def execute_test(path): testcase = find_test(path) if not testcase: return ("Test not found", 404) return render_template('execute_test.html', testcase=testcase)