From 214ceda8903bafc28981b58a0530c2a15d7812cc Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 25 Apr 2019 19:03:46 +0800 Subject: Rename the cos service file. Fix a bug in test. --- Timeline.Tests/QCloudCosServiceUnitTest.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Timeline.Tests/QCloudCosServiceUnitTest.cs') diff --git a/Timeline.Tests/QCloudCosServiceUnitTest.cs b/Timeline.Tests/QCloudCosServiceUnitTest.cs index b0e6a868..0940c70d 100644 --- a/Timeline.Tests/QCloudCosServiceUnitTest.cs +++ b/Timeline.Tests/QCloudCosServiceUnitTest.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Net; +using System.Net.Http; using System.Threading.Tasks; using Timeline.Services; using Timeline.Tests.Helpers; @@ -80,8 +81,6 @@ namespace Timeline.Tests } } - // Although this test does not pass on my archlunux system. But the GenerateObjectGetUrl actually works well. - // And I don't know why. [Fact] public async Task GenerateObjectGetUrlTest() { @@ -90,7 +89,9 @@ namespace Timeline.Tests var services = serviceScope.ServiceProvider; var service = services.GetRequiredService(); var url = service.GenerateObjectGetUrl("avatar", "__default"); - using (var client = _factory.CreateClient()) + // never use the following line! Because client created by factory can't access Internet. + //using (var client = _factory.CreateClient()) + using (var client = services.GetRequiredService().CreateClient()) { var res = await client.GetAsync(url); Assert.Equal(HttpStatusCode.OK, res.StatusCode); -- cgit v1.2.3