File tree 3 files changed +32
-0
lines changed
readthedocs/rtd_tests/tests
3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -862,6 +862,19 @@ def setUp(self):
862
862
},
863
863
}
864
864
865
+ def test_webhook_skipped_project (self , trigger_build ):
866
+ client = APIClient ()
867
+ response = client .post (
868
+ '/api/v2/webhook/github/{0}/' .format (
869
+ self .project .slug ,
870
+ ),
871
+ {'ref' : 'master' },
872
+ format = 'json' ,
873
+ )
874
+ self .assertDictEqual (response .data , {'details' : 'This project is currently disabled' })
875
+ self .assertEqual (response .status , status .HTTP_406_NOT_ACCEPTABLE )
876
+ self .assertFalse (trigger_build .called )
877
+
865
878
def test_github_webhook_for_branches (self , trigger_build ):
866
879
"""GitHub webhook API."""
867
880
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