@@ -5917,45 +5917,6 @@ def setUp(self):
59175917
59185918 self .client .force_authenticate (user = self .user )
59195919
5920- def test_create_challenge_using_github_success (self ):
5921- self .url = reverse_lazy (
5922- "challenges:create_or_update_github_challenge" ,
5923- kwargs = {"challenge_host_team_pk" : self .challenge_host_team .pk },
5924- )
5925-
5926- with mock .patch ("challenges.views.requests.get" ) as m :
5927- resp = mock .Mock ()
5928- resp .content = self .test_zip_file .read ()
5929- resp .status_code = 200
5930- m .return_value = resp
5931- response = self .client .post (
5932- self .url ,
5933- {
5934- "GITHUB_REPOSITORY" : "https://github.com/yourusername/repository" ,
5935- "GITHUB_BRANCH_NAME" : "refs/heads/challenge" ,
5936- "zip_configuration" : self .input_zip_file ,
5937- },
5938- format = "multipart" ,
5939- )
5940- expected = {
5941- "Success" : "Challenge Challenge Title has been created successfully and sent for review to EvalAI Admin."
5942- }
5943-
5944- self .assertEqual (response .status_code , 201 )
5945- self .assertEqual (response .json (), expected )
5946- self .assertEqual (Challenge .objects .count (), 1 )
5947- self .assertEqual (DatasetSplit .objects .count (), 1 )
5948- self .assertEqual (Leaderboard .objects .count (), 1 )
5949- self .assertEqual (ChallengePhaseSplit .objects .count (), 1 )
5950-
5951- # Verify github_branch is properly stored
5952- challenge = Challenge .objects .first ()
5953- self .assertEqual (
5954- challenge .github_repository ,
5955- "https://github.com/yourusername/repository" ,
5956- )
5957- self .assertEqual (challenge .github_branch , "refs/heads/challenge" )
5958-
59595920 def test_create_challenge_using_github_when_challenge_host_team_does_not_exist (
59605921 self ,
59615922 ):
@@ -5994,40 +5955,6 @@ def test_create_challenge_using_github_when_user_is_not_authenticated(
59945955 self .assertEqual (list (response .data .values ())[0 ], expected ["error" ])
59955956 self .assertEqual (response .status_code , status .HTTP_401_UNAUTHORIZED )
59965957
5997- def test_create_challenge_using_github_without_branch_name (self ):
5998- self .url = reverse_lazy (
5999- "challenges:create_or_update_github_challenge" ,
6000- kwargs = {"challenge_host_team_pk" : self .challenge_host_team .pk },
6001- )
6002-
6003- with mock .patch ("challenges.views.requests.get" ) as m :
6004- resp = mock .Mock ()
6005- resp .content = self .test_zip_file .read ()
6006- resp .status_code = 200
6007- m .return_value = resp
6008- response = self .client .post (
6009- self .url ,
6010- {
6011- "GITHUB_REPOSITORY" : "https://github.com/yourusername/repository" ,
6012- "zip_configuration" : self .input_zip_file ,
6013- },
6014- format = "multipart" ,
6015- )
6016- expected = {
6017- "Success" : "Challenge Challenge Title has been created successfully and sent for review to EvalAI Admin."
6018- }
6019-
6020- self .assertEqual (response .status_code , 201 )
6021- self .assertEqual (response .json (), expected )
6022-
6023- # Verify github_branch defaults to empty string when not provided
6024- challenge = Challenge .objects .first ()
6025- self .assertEqual (
6026- challenge .github_repository ,
6027- "https://github.com/yourusername/repository" ,
6028- )
6029- self .assertEqual (challenge .github_branch , "" )
6030-
60315958
60325959class ValidateChallengeTest (APITestCase ):
60335960 def setUp (self ):
0 commit comments