File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
tests/Aspire.Hosting.Tests Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1
1
// Licensed to the .NET Foundation under one or more agreements.
2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
+ using Aspire . Hosting . Dashboard ;
4
5
using Aspire . Hosting . Dcp ;
5
6
using Aspire . Hosting . Lifecycle ;
6
7
using Aspire . Hosting . Publishing ;
@@ -95,6 +96,28 @@ public void AppHostDirectoryAvailableViaConfig()
95
96
Assert . Equal ( appHostDirectory , config [ "AppHost:Directory" ] ) ;
96
97
}
97
98
99
+ [ Fact ]
100
+ public void ResourceServiceConfig_Secured ( )
101
+ {
102
+ var appBuilder = DistributedApplication . CreateBuilder ( ) ;
103
+ using var app = appBuilder . Build ( ) ;
104
+
105
+ var config = app . Services . GetRequiredService < IConfiguration > ( ) ;
106
+ Assert . Equal ( nameof ( ResourceServiceAuthMode . Unsecured ) , config [ "AppHost:ResourceService:AuthMode" ] ) ;
107
+ Assert . False ( string . IsNullOrEmpty ( config [ "AppHost:ResourceService:ApiKey" ] ) ) ;
108
+ }
109
+
110
+ [ Fact ]
111
+ public void ResourceServiceConfig_Unsecured ( )
112
+ {
113
+ var appBuilder = DistributedApplication . CreateBuilder ( args : [ $ "{ KnownConfigNames . DashboardUnsecuredAllowAnonymous } =true"] ) ;
114
+ using var app = appBuilder . Build ( ) ;
115
+
116
+ var config = app . Services . GetRequiredService < IConfiguration > ( ) ;
117
+ Assert . Equal ( nameof ( ResourceServiceAuthMode . Unsecured ) , config [ "AppHost:ResourceService:AuthMode" ] ) ;
118
+ Assert . True ( string . IsNullOrEmpty ( config [ "AppHost:ResourceService:ApiKey" ] ) ) ;
119
+ }
120
+
98
121
[ Fact ]
99
122
public void AddResource_DuplicateResourceNames_SameCasing_Error ( )
100
123
{
You can’t perform that action at this time.
0 commit comments