@@ -880,6 +880,7 @@ def test_newtask(self):
880880 res = self .app .get (url )
881881 assert res .data == '{}' , res .data
882882
883+ @with_context
883884 @patch ('pybossa.repositories.project_repository.uploader' )
884885 def test_project_delete_deletes_zip_files (self , uploader ):
885886 """Test API project delete deletes also zip files of tasks and taskruns"""
@@ -894,6 +895,7 @@ def test_project_delete_deletes_zip_files(self, uploader):
894895 call ('1_project1_task_run_csv.zip' , 'user_1' )]
895896 assert uploader .delete_file .call_args_list == expected
896897
898+ @with_context
897899 def test_project_post_with_reserved_fields_returns_error (self ):
898900 user = UserFactory .create ()
899901 CategoryFactory .create ()
@@ -916,6 +918,7 @@ def test_project_post_with_reserved_fields_returns_error(self):
916918 error = json .loads (res .data )
917919 assert error ['exception_msg' ] == "Reserved keys in payload" , error
918920
921+ @with_context
919922 def test_project_put_with_reserved_returns_error (self ):
920923 user = UserFactory .create ()
921924 project = ProjectFactory .create (owner = user )
@@ -929,6 +932,7 @@ def test_project_put_with_reserved_returns_error(self):
929932 error = json .loads (res .data )
930933 assert error ['exception_msg' ] == "Reserved keys in payload" , error
931934
935+ @with_context
932936 def test_project_post_with_published_attribute_is_forbidden (self ):
933937 user = UserFactory .create ()
934938 data = dict (
@@ -947,6 +951,7 @@ def test_project_post_with_published_attribute_is_forbidden(self):
947951 assert res .status_code == 403 , res .status_code
948952 assert error_msg == 'You cannot publish a project via the API' , res .data
949953
954+ @with_context
950955 def test_project_update_with_published_attribute_is_forbidden (self ):
951956 user = UserFactory .create ()
952957 project = ProjectFactory .create (owner = user )
@@ -960,6 +965,7 @@ def test_project_update_with_published_attribute_is_forbidden(self):
960965 assert res .status_code == 403 , res .status_code
961966 assert error_msg == 'You cannot publish a project via the API' , res .data
962967
968+ @with_context
963969 def test_project_delete_with_results (self ):
964970 """Test API delete project with results cannot be deleted."""
965971 result = self .create_result ()
@@ -970,6 +976,7 @@ def test_project_delete_with_results(self):
970976 res = self .app .delete (url )
971977 assert_equal (res .status , '403 FORBIDDEN' , res .status )
972978
979+ @with_context
973980 def test_project_delete_with_results_var (self ):
974981 """Test API delete project with results cannot be deleted by admin."""
975982 root = UserFactory .create (admin = True )
0 commit comments