1- from io import BytesIO
2-
31from sentry .models .eventattachment import EventAttachment
4- from sentry .models .files .file import File
52from sentry .testutils .cases import APITestCase
63from sentry .testutils .helpers .datetime import before_now
74from sentry .testutils .skips import requires_snuba
@@ -21,14 +18,13 @@ def test_simple(self):
2118 data = {"fingerprint" : ["group1" ], "timestamp" : min_ago }, project_id = self .project .id
2219 )
2320
24- file1 = File .objects .create (name = "hello.png" , type = "event.attachment" )
25- file1 .putfile (BytesIO (b"File contents here" ))
2621 attachment1 = EventAttachment .objects .create (
2722 project_id = event1 .project_id ,
2823 event_id = event1 .event_id ,
2924 type = "event.attachment" ,
30- name = file1 .name ,
31- file_id = file1 .id ,
25+ name = "hello.png" ,
26+ content_type = "image/png" ,
27+ blob_path = ":File contents here" ,
3228 )
3329
3430 attachment2 = EventAttachment .objects .create (
@@ -39,7 +35,6 @@ def test_simple(self):
3935 content_type = "image/png" ,
4036 size = 1234 ,
4137 sha1 = "1234" ,
42- # NOTE: we are not actually attaching the `file_id` here
4338 )
4439
4540 path = f"/api/0/projects/{ event1 .project .organization .slug } /{ event1 .project .slug } /events/{ event1 .event_id } /attachments/"
@@ -82,26 +77,21 @@ def test_is_screenshot(self):
8277 data = {"fingerprint" : ["group1" ], "timestamp" : min_ago }, project_id = self .project .id
8378 )
8479
85- file = File .objects .create (name = "screenshot.png" , type = "image/png" )
8680 EventAttachment .objects .create (
8781 event_id = event1 .event_id ,
8882 project_id = event1 .project_id ,
89- file_id = file . id ,
90- name = file . name ,
83+ name = "screenshot.png" ,
84+ content_type = "image/png" ,
9185 )
92- file = File .objects .create (name = "crash_screenshot.png" )
9386 EventAttachment .objects .create (
9487 event_id = event1 .event_id ,
9588 project_id = event1 .project_id ,
96- file_id = file .id ,
97- name = file .name ,
89+ name = "crash_screenshot.png" ,
9890 )
99- file = File .objects .create (name = "foo.png" )
10091 EventAttachment .objects .create (
10192 event_id = event1 .event_id ,
10293 project_id = event1 .project_id ,
103- file_id = file .id ,
104- name = file .name ,
94+ name = "foo.png" ,
10595 )
10696
10797 path = f"/api/0/projects/{ event1 .project .organization .slug } /{ event1 .project .slug } /events/{ event1 .event_id } /attachments/"
0 commit comments