@@ -2845,3 +2845,29 @@ def test_server_config(mc: MerginClient):
2845
2845
assert "server_type" in config
2846
2846
assert "version" in config
2847
2847
assert "server_configured" in config
2848
+
2849
+
2850
+ def test_send_logs (mc : MerginClient , monkeypatch ):
2851
+ """Test that logs can be send to the server."""
2852
+ test_project = "test_logs_send"
2853
+ project = API_USER + "/" + test_project
2854
+ project_dir = os .path .join (TMP_DIR , test_project )
2855
+
2856
+ cleanup (mc , project , [project_dir ])
2857
+ # prepare local project
2858
+ shutil .copytree (TEST_DATA_DIR , project_dir )
2859
+
2860
+ # create remote project
2861
+ mc .create_project_and_push (project , directory = project_dir )
2862
+
2863
+ # patch mc.server_config() to return empty config which means that logs will be send to the server
2864
+ # but it is not configured to accept them so client error with message will be raised
2865
+ def server_config (self ):
2866
+ return {}
2867
+
2868
+ monkeypatch .setattr (mc , "server_config" , server_config .__get__ (mc ))
2869
+
2870
+ logs_path = os .path .join (project_dir , ".mergin" , "client-log.txt" )
2871
+
2872
+ with pytest .raises (ClientError , match = "The requested URL was not found on the server" ):
2873
+ mc .send_logs (logs_path )
0 commit comments