@@ -786,20 +786,26 @@ def create_release(self, tag_name, target_commitish=None, name=None,
786
786
return Release (json , self )
787
787
788
788
@requires_auth
789
- def create_status (self , sha , state , target_url = '' , description = '' , context = '' ):
789
+ def create_status (self , sha , state , target_url = None , description = None ,
790
+ context = 'default' ):
790
791
"""Create a status object on a commit.
791
792
792
793
:param str sha: (required), SHA of the commit to create the status on
793
794
:param str state: (required), state of the test; only the following
794
795
are accepted: 'pending', 'success', 'error', 'failure'
795
796
:param str target_url: (optional), URL to associate with this status.
796
797
:param str description: (optional), short description of the status
798
+ :param str context: (optional), A string label to differentiate this
799
+ status from the status of other systems
800
+ :returns: the status created if successful
801
+ :rtype: :class:`~github3.repos.status.Status`
797
802
"""
798
- json = {}
803
+ json = None
799
804
if sha and state :
800
805
data = {'state' : state , 'target_url' : target_url ,
801
806
'description' : description , 'context' : context }
802
807
url = self ._build_url ('statuses' , sha , base_url = self ._api )
808
+ self ._remove_none (data )
803
809
json = self ._json (self ._post (url , data = data ), 201 )
804
810
return Status (json ) if json else None
805
811
0 commit comments