@@ -15,7 +15,7 @@ def test_0_attachment_meta(self):
15
15
# we have no control over server side upload limit
16
16
self .assertIn ("uploadLimit" , meta )
17
17
18
- def test_1_add_remove_attachment (self ):
18
+ def test_1_add_remove_attachment_using_filestream (self ):
19
19
issue = self .jira .issue (self .issue_1 )
20
20
with open (TEST_ATTACH_PATH , "rb" ) as f :
21
21
attachment = self .jira .add_attachment (issue , f , "new test attachment" )
@@ -27,3 +27,17 @@ def test_1_add_remove_attachment(self):
27
27
)
28
28
# JIRA returns a HTTP 204 upon successful deletion
29
29
self .assertEqual (attachment .delete ().status_code , 204 )
30
+
31
+ def test_2_add_remove_attachment_using_filename (self ):
32
+ issue = self .jira .issue (self .issue_1 )
33
+ attachment = self .jira .add_attachment (
34
+ issue , TEST_ATTACH_PATH , "new test attachment"
35
+ )
36
+ new_attachment = self .jira .attachment (attachment .id )
37
+ msg = "attachment %s of issue %s" % (new_attachment .__dict__ , issue )
38
+ self .assertEqual (new_attachment .filename , "new test attachment" , msg = msg )
39
+ self .assertEqual (
40
+ new_attachment .size , os .path .getsize (TEST_ATTACH_PATH ), msg = msg
41
+ )
42
+ # JIRA returns a HTTP 204 upon successful deletion
43
+ self .assertEqual (attachment .delete ().status_code , 204 )
0 commit comments