@@ -28,7 +28,7 @@ class TestRelease(UnitHelper):
2828 "updated_at" : "2013-02-27T19:35:32Z"
2929 }],
3030 "assets_url" : url_for ("/1/assets" ),
31- "upload_url" : url_for ("/1/assets{?name}" ),
31+ "upload_url" : url_for ("/1/assets{?name}{&label} " ),
3232 "id" : 1 ,
3333 "tag_name" : "v1.0.0" ,
3434 "target_commitish" : "master" ,
@@ -82,6 +82,35 @@ def test_delete(self):
8282 headers = {'Accept' : 'application/vnd.github.manifold-preview' }
8383 )
8484
85+ def test_upload_asset (self ):
86+ self .session .post .return_value = mock .Mock (
87+ status_code = 201 , json = lambda : self .example_data ["assets" ][0 ])
88+ with open (__file__ ) as fd :
89+ content = fd .read ()
90+ self .instance .upload_asset (
91+ 'text/plain' , 'test_repos_release.py' , content ,
92+ )
93+ self .post_called_with (
94+ url_for ('/1/assets?name=%s' % 'test_repos_release.py' ),
95+ data = content ,
96+ headers = None
97+ )
98+
99+ def test_upload_asset_with_a_label (self ):
100+ self .session .post .return_value = mock .Mock (
101+ status_code = 201 , json = lambda : self .example_data ["assets" ][0 ])
102+ with open (__file__ ) as fd :
103+ content = fd .read ()
104+ self .instance .upload_asset (
105+ 'text/plain' , 'test_repos_release.py' , content , 'test-label'
106+ )
107+ self .post_called_with (
108+ url_for ('/1/assets?name=%s&label=%s' % (
109+ 'test_repos_release.py' , 'test-label' )),
110+ data = content ,
111+ headers = None
112+ )
113+
85114
86115class TestReleaseIterators (UnitIteratorHelper ):
87116
0 commit comments