File tree 3 files changed +35
-0
lines changed
readthedocs/rtd_tests/tests
3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -862,6 +862,22 @@ def setUp(self):
862
862
},
863
863
}
864
864
865
+ def test_webhook_skipped_project (self , trigger_build ):
866
+ client = APIClient ()
867
+ self .project .skip = True
868
+ self .project .save ()
869
+
870
+ response = client .post (
871
+ '/api/v2/webhook/github/{0}/' .format (
872
+ self .project .slug ,
873
+ ),
874
+ self .github_payload ,
875
+ format = 'json' ,
876
+ )
877
+ self .assertDictEqual (response .data , {'detail' : 'This project is currently disabled' })
878
+ self .assertEqual (response .status_code , status .HTTP_406_NOT_ACCEPTABLE )
879
+ self .assertFalse (trigger_build .called )
880
+
865
881
def test_github_webhook_for_branches (self , trigger_build ):
866
882
"""GitHub webhook API."""
867
883
client = APIClient ()
Original file line number Diff line number Diff line change @@ -18,6 +18,18 @@ def setUp(self):
18
18
self .project = get (Project , container_time_limit = None )
19
19
self .version = get (Version , project = self .project )
20
20
21
+ @mock .patch ('readthedocs.projects.tasks.update_docs_task' )
22
+ def test_trigger_skipped_project (self , update_docs_task ):
23
+ self .project .skip = True
24
+ self .project .save ()
25
+ result = trigger_build (
26
+ project = self .project ,
27
+ version = self .version ,
28
+ )
29
+ self .assertEqual (result , (None , None ))
30
+ self .assertFalse (update_docs_task .signature .called )
31
+ self .assertFalse (update_docs_task .signature ().apply_async .called )
32
+
21
33
@mock .patch ('readthedocs.projects.tasks.update_docs_task' )
22
34
def test_trigger_custom_queue (self , update_docs ):
23
35
"""Use a custom queue when routing the task"""
Original file line number Diff line number Diff line change @@ -30,6 +30,13 @@ def test_subproject_queryset_as_manager_gets_correct_class(self):
30
30
'ManagerFromParentRelatedProjectQuerySetBase'
31
31
)
32
32
33
+ def test_is_active (self ):
34
+ project = fixture .get (Project , skip = False )
35
+ self .assertTrue (Project .objects .is_active (project ))
36
+
37
+ project = fixture .get (Project , skip = True )
38
+ self .assertFalse (Project .objects .is_active (project ))
39
+
33
40
34
41
class FeatureQuerySetTests (TestCase ):
35
42
You can’t perform that action at this time.
0 commit comments