specs, fix mockapi in auth scenarios (#4740)

for invalid case, test is considered pass on 403 response code.
This commit is contained in:
Weidong Xu 2024-10-16 00:28:30 +08:00 коммит произвёл GitHub
Родитель 0487edc372
Коммит 657d4a0f1c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -1,8 +1,8 @@
import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api";
import { json, passOnCode, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api";
export const Scenarios: Record<string, ScenarioMockApi> = {};
Scenarios.Authentication_ApiKey_invalid = passOnSuccess({
Scenarios.Authentication_ApiKey_invalid = passOnCode(403, {
uri: `/authentication/api-key/invalid`,
method: `get`,
request: {

Просмотреть файл

@ -1,4 +1,4 @@
import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api";
import { json, passOnCode, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api";
export const Scenarios: Record<string, ScenarioMockApi> = {};
@ -16,12 +16,12 @@ Scenarios.Authentication_Http_Custom_valid = passOnSuccess({
kind: "MockApiDefinition",
});
Scenarios.Authentication_Http_Custom_invalid = passOnSuccess({
Scenarios.Authentication_Http_Custom_invalid = passOnCode(403, {
uri: `/authentication/http/custom/invalid`,
method: "get",
request: {
headers: {
authorization: "SharedAccessKey valid-key",
authorization: "SharedAccessKey invalid-key",
},
status: 403,
},

Просмотреть файл

@ -1,4 +1,4 @@
import { json, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api";
import { json, passOnCode, passOnSuccess, ScenarioMockApi } from "@typespec/spec-api";
export const Scenarios: Record<string, ScenarioMockApi> = {};
@ -16,7 +16,7 @@ Scenarios.Authentication_OAuth2_valid = passOnSuccess({
kind: "MockApiDefinition",
});
Scenarios.Authentication_OAuth2_invalid = passOnSuccess({
Scenarios.Authentication_OAuth2_invalid = passOnCode(403, {
uri: `/authentication/oauth2/invalid`,
method: "get",
request: {