From 96deaf7b57b071c6c18261ec015b4d7d1bc99c56 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 14 May 2024 03:33:21 +0900 Subject: [PATCH] Add test for bad request In this test, the web request triggers an exception which should be correctly caught by the store methods. --- osu.Framework.Tests/IO/TestOnlineStore.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Framework.Tests/IO/TestOnlineStore.cs b/osu.Framework.Tests/IO/TestOnlineStore.cs index 66f1c742cbc..2d10d37095c 100644 --- a/osu.Framework.Tests/IO/TestOnlineStore.cs +++ b/osu.Framework.Tests/IO/TestOnlineStore.cs @@ -107,5 +107,15 @@ public void TestFileUrlFails([Values(true, false)] bool async) Assert.That(result, Is.Null); } + + [Test] + public void TestBadWebRequest([ValueSource(nameof(protocols))] string protocol, [Values(true, false)] bool async) + { + byte[]? result = async + ? store.GetAsync($"{protocol}://{host}/status/500").GetResultSafely() + : store.Get($"{protocol}://{host}/status/500"); + + Assert.That(result, Is.Null); + } } }