|
8 | 8 | using System.Net;
|
9 | 9 | using System.Threading;
|
10 | 10 | using System.Threading.Tasks;
|
11 |
| -using Microsoft.AspNetCore.Authentication; |
12 | 11 | using Microsoft.AspNetCore.Authorization;
|
13 | 12 | using Microsoft.AspNetCore.Mvc;
|
14 | 13 | using Microsoft.Azure.WebJobs.Host.Scale;
|
|
17 | 16 | using Microsoft.Azure.WebJobs.Script.Scale;
|
18 | 17 | using Microsoft.Azure.WebJobs.Script.WebHost.Controllers;
|
19 | 18 | using Microsoft.Azure.WebJobs.Script.WebHost.Management;
|
20 |
| -using Microsoft.Azure.WebJobs.Script.WebHost.Security; |
21 | 19 | using Microsoft.Extensions.Logging;
|
22 | 20 | using Microsoft.Extensions.Options;
|
23 | 21 | using Microsoft.WebJobs.Script.Tests;
|
@@ -103,46 +101,6 @@ public async Task SetState_Succeeds(string desiredState, ScriptHostState current
|
103 | 101 | }
|
104 | 102 | }
|
105 | 103 |
|
106 |
| - [Fact] |
107 |
| - public void GetAdminToken_Succeeds() |
108 |
| - { |
109 |
| - // Arrange |
110 |
| - _mockEnvironment.Setup(p => p.GetEnvironmentVariable(It.Is<string>(k => k == EnvironmentSettingNames.ContainerName))).Returns<string>(v => v = "ContainerName"); |
111 |
| - |
112 |
| - var key = TestHelpers.GenerateKeyBytes(); |
113 |
| - var stringKey = TestHelpers.GenerateKeyHexString(key); |
114 |
| - using (new TestScopedEnvironmentVariable(EnvironmentSettingNames.WebSiteAuthEncryptionKey, stringKey)) |
115 |
| - { |
116 |
| - // Act |
117 |
| - ObjectResult result = (ObjectResult)_hostController.GetAdminToken(); |
118 |
| - HttpStatusCode resultStatus = (HttpStatusCode)result.StatusCode; |
119 |
| - string token = (string)result.Value; |
120 |
| - |
121 |
| - // Assert |
122 |
| - Assert.Equal(HttpStatusCode.OK, resultStatus); |
123 |
| - Assert.True(SimpleWebTokenHelper.ValidateToken(token, new SystemClock())); |
124 |
| - } |
125 |
| - } |
126 |
| - |
127 |
| - [Fact] |
128 |
| - public void GetAdminToken_Fails_NotLinuxContainer() |
129 |
| - { |
130 |
| - // Arrange |
131 |
| - _mockEnvironment.Setup(p => p.GetEnvironmentVariable(It.Is<string>(k => k == EnvironmentSettingNames.ContainerName))).Returns<string>(v => v = null); |
132 |
| - |
133 |
| - var key = TestHelpers.GenerateKeyBytes(); |
134 |
| - var stringKey = TestHelpers.GenerateKeyHexString(key); |
135 |
| - using (new TestScopedEnvironmentVariable(EnvironmentSettingNames.WebSiteAuthEncryptionKey, stringKey)) |
136 |
| - { |
137 |
| - // Act |
138 |
| - ObjectResult result = (ObjectResult)_hostController.GetAdminToken(); |
139 |
| - HttpStatusCode resultStatus = (HttpStatusCode)result.StatusCode; |
140 |
| - |
141 |
| - // Assert |
142 |
| - Assert.Equal(HttpStatusCode.BadRequest, resultStatus); |
143 |
| - } |
144 |
| - } |
145 |
| - |
146 | 104 | [Fact]
|
147 | 105 | public async Task GetScaleStatus_RuntimeScaleModeEnabled_Succeeds()
|
148 | 106 | {
|
|
0 commit comments