MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / test_access_token

Function test_access_token

tests_python/test_debugger_json.py:5684–5739  ·  view source on GitHub ↗
(case_setup_dap)

Source from the content-addressed store, hash-verified

5682
5683
5684def test_access_token(case_setup_dap):
5685
5686 def update_command_line_args(self, args):
5687 args.insert(1, "--json-dap-http")
5688 args.insert(2, "--access-token")
5689 args.insert(3, "bar123")
5690 args.insert(4, "--client-access-token")
5691 args.insert(5, "foo321")
5692 return args
5693
5694 with case_setup_dap.test_file("_debugger_case_pause_continue.py", update_command_line_args=update_command_line_args) as writer:
5695 json_facade = JsonFacade(writer)
5696
5697 response = json_facade.write_set_debugger_property(multi_threads_single_notification=True, success=False)
5698 assert response.message == "Client not authenticated."
5699
5700 response = json_facade.write_authorize(access_token="wrong", success=False)
5701 assert response.message == "Client not authenticated."
5702
5703 response = json_facade.write_set_debugger_property(multi_threads_single_notification=True, success=False)
5704 assert response.message == "Client not authenticated."
5705
5706 authorize_response = json_facade.write_authorize(access_token="bar123", success=True)
5707 # : :type authorize_response:PydevdAuthorizeResponse
5708 assert authorize_response.body.clientAccessToken == "foo321"
5709
5710 json_facade.write_set_debugger_property(multi_threads_single_notification=True)
5711 json_facade.write_launch()
5712
5713 break_line = writer.get_line_index_with_content("Pause here and change loop to False")
5714 json_facade.write_set_breakpoints(break_line)
5715 json_facade.write_make_initial_run()
5716
5717 json_facade.wait_for_json_message(ThreadEvent, lambda event: event.body.reason == "started")
5718 json_facade.wait_for_thread_stopped(line=break_line)
5719
5720 # : :type response: ThreadsResponse
5721 response = json_facade.write_list_threads()
5722 assert len(response.body.threads) == 1
5723 assert next(iter(response.body.threads))["name"] == "MainThread"
5724
5725 json_facade.write_disconnect()
5726
5727 response = json_facade.write_authorize(access_token="wrong", success=False)
5728 assert response.message == "Client not authenticated."
5729
5730 authorize_response = json_facade.write_authorize(access_token="bar123")
5731 assert authorize_response.body.clientAccessToken == "foo321"
5732
5733 json_facade.write_set_breakpoints(break_line)
5734 json_hit = json_facade.wait_for_thread_stopped(line=break_line)
5735 json_facade.write_set_variable(json_hit.frame_id, "loop", "False")
5736 json_facade.write_continue()
5737 json_facade.wait_for_terminated()
5738
5739 writer.finished_ok = True
5740
5741

Callers

nothing calls this directly

Calls 15

write_authorizeMethod · 0.95
write_launchMethod · 0.95
write_set_breakpointsMethod · 0.95
wait_for_json_messageMethod · 0.95
write_list_threadsMethod · 0.95
write_disconnectMethod · 0.95
write_set_variableMethod · 0.95
write_continueMethod · 0.95
wait_for_terminatedMethod · 0.95

Tested by

no test coverage detected