@@ -80,12 +80,14 @@ def test_capture_crash_sends_event_with_tags(transport):
8080 run_state .current_module = "my_module"
8181 run_state .current_frid = "2.1"
8282 run_state .current_render_state = "IMPLEMENTING_FRID"
83+ run_state .user_email = "user@codeplain.ai"
8384
8485 assert capture_crash (make_exc_info (KeyError ("boom" )), run_state , make_args (headless = True ))
8586 sentry_sdk .flush (timeout = 2 )
8687
8788 assert len (transport .events ) == 1
88- tags = transport .events [0 ]["tags" ]
89+ event = transport .events [0 ]
90+ tags = event ["tags" ]
8991 assert tags ["render_id" ] == run_state .render_id
9092 assert tags ["current_module" ] == "my_module"
9193 assert tags ["current_frid" ] == "2.1"
@@ -94,6 +96,19 @@ def test_capture_crash_sends_event_with_tags(transport):
9496 assert tags ["unittests_script_provided" ] is True
9597 assert tags ["conformance_tests_script_provided" ] is False
9698 assert tags ["prepare_environment_script_provided" ] is False
99+ assert event ["user" ]["email" ] == "user@codeplain.ai"
100+
101+
102+ def test_capture_crash_without_user_email (transport ):
103+ init_with_transport (transport )
104+
105+ run_state = RunState (spec_filename = "test.plain" )
106+
107+ assert capture_crash (make_exc_info (KeyError ("boom" )), run_state , make_args ())
108+ sentry_sdk .flush (timeout = 2 )
109+
110+ assert len (transport .events ) == 1
111+ assert "email" not in transport .events [0 ].get ("user" , {})
97112
98113
99114def test_capture_crash_without_run_state (transport ):
0 commit comments