Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: attestation - remove mocha arrow functions #23789

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,33 +141,33 @@ describe("AttestationClient in Browser", function () {
"RHZvOGgyazVkdTFpV0RkQmtBbiswaWlBPT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0" +
"tLQoA";

it("#AttestOpenEnclaveShared", async () => {
it("#AttestOpenEnclaveShared", async function () {
await testOpenEnclave("Shared");
});

it("#AttestOpenEnclaveAad", async () => {
it("#AttestOpenEnclaveAad", async function () {
await testOpenEnclave("AAD");
});

it("#AttestOpenEnclaveIsolated", async () => {
it("#AttestOpenEnclaveIsolated", async function () {
await testOpenEnclave("Isolated");
});

it("#AttestSgxEnclaveShared", async () => {
it("#AttestSgxEnclaveShared", async function () {
await testSgxEnclave("Shared");
});

it("#AttestSgxEnclaveAad", async () => {
it("#AttestSgxEnclaveAad", async function () {
await testSgxEnclave("AAD");
});

it("#AttestSgxEnclaveIsolated", async () => {
it("#AttestSgxEnclaveIsolated", async function () {
await testSgxEnclave("Isolated");
});

/* TPM Attestation can only be performed on an AAD or isolated mode client.
*/
it("#attestTpm", async () => {
it("#attestTpm", async function () {
const client = createRecordedClient(recorder, "AAD", true);
const adminClient = createRecordedAdminClient(recorder, "AAD");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,33 +141,33 @@ describe("[AAD] Attestation Client", function () {
"RHZvOGgyazVkdTFpV0RkQmtBbiswaWlBPT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0" +
"tLQoA";

it("#AttestOpenEnclaveShared", async () => {
it("#AttestOpenEnclaveShared", async function () {
await testOpenEnclave("Shared");
});

it("#AttestOpenEnclaveAad", async () => {
it("#AttestOpenEnclaveAad", async function () {
await testOpenEnclave("AAD");
});

it("#AttestOpenEnclaveIsolated", async () => {
it("#AttestOpenEnclaveIsolated", async function () {
await testOpenEnclave("Isolated");
});

it("#AttestSgxEnclaveShared", async () => {
it("#AttestSgxEnclaveShared", async function () {
await testSgxEnclave("Shared");
});

it("#AttestSgxEnclaveAad", async () => {
it("#AttestSgxEnclaveAad", async function () {
await testSgxEnclave("AAD");
});

it("#AttestSgxEnclaveIsolated", async () => {
it("#AttestSgxEnclaveIsolated", async function () {
await testSgxEnclave("Isolated");
});

/* TPM Attestation can only be performed on an AAD or isolated mode client.
*/
it("#attestTpm", async () => {
it("#attestTpm", async function () {
const client = createRecordedClient(recorder, "AAD", true);
const adminClient = createRecordedAdminClient(recorder, "AAD");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("AttestationTokenTests", function () {
await recorder.stop();
});

it("#testUtf8ConversionFunctions", async () => {
it("#testUtf8ConversionFunctions", async function () {
const buffer = stringToBytes("ABCDEF");
assert.equal(65, buffer[0]);
assert.equal(66, buffer[1]);
Expand All @@ -42,7 +42,7 @@ describe("AttestationTokenTests", function () {
assert.equal("ABCDEF", str);
});

it("#createRsaSigningKey", async () => {
it("#createRsaSigningKey", async function () {
const [privKey, pubKey] = createRSAKey();
const cert = createX509Certificate(privKey, pubKey, "testCert");
assert.isTrue(privKey.length !== 0);
Expand All @@ -52,7 +52,7 @@ describe("AttestationTokenTests", function () {
assert.isTrue(signingKey.certificate.length !== 0);
});

it("#createEcdsSigningKey", async () => {
it("#createEcdsSigningKey", async function () {
const [privKey, pubKey] = createECDSKey();
const cert = createX509Certificate(privKey, pubKey, "testCert");
assert.isTrue(privKey.length !== 0);
Expand All @@ -64,7 +64,7 @@ describe("AttestationTokenTests", function () {

// Create a signing key, but use the wrong key - this should throw an
// exception, because the key doesn't match the certificate.
it("#createSigningKeyWrongKey", async () => {
it("#createSigningKeyWrongKey", async function () {
const [privKey, pubKey] = createECDSKey();
const cert = createX509Certificate(privKey, pubKey, "testCert");

Expand All @@ -79,7 +79,7 @@ describe("AttestationTokenTests", function () {
/**
* Creates an unsecured attestation token.
*/
it("#createUnsecuredAttestationToken", async () => {
it("#createUnsecuredAttestationToken", async function () {
const sourceObject = JSON.stringify({ foo: "foo", bar: 10 });
const token = AttestationTokenImpl.create({ body: sourceObject });

Expand All @@ -91,7 +91,7 @@ describe("AttestationTokenTests", function () {
/**
* Creates an unsecured empty attestation token.
*/
it("#createUnsecuredEmptyAttestationToken", async () => {
it("#createUnsecuredEmptyAttestationToken", async function () {
const token = AttestationTokenImpl.create({});

// An empty unsecured attestation token has a well known value, check it.
Expand All @@ -104,7 +104,7 @@ describe("AttestationTokenTests", function () {
/**
* Creates a secured empty attestation token with the specified key.
*/
it("#createEmptySecuredAttestationToken", async () => {
it("#createEmptySecuredAttestationToken", async function () {
const [privKey, pubKey] = createRSAKey();
const cert = createX509Certificate(privKey, pubKey, "certificate");

Expand All @@ -131,7 +131,7 @@ describe("AttestationTokenTests", function () {
/**
* Creates a secured attestation token with the specified key.
*/
it("#createSecuredAttestationToken", async () => {
it("#createSecuredAttestationToken", async function () {
const [privKey, pubKey] = createRSAKey();
const cert = createX509Certificate(privKey, pubKey, "certificate");

Expand Down Expand Up @@ -167,7 +167,7 @@ describe("AttestationTokenTests", function () {
expect(token.issuer).to.equal("this is an issuer");
});

it("#verifyAttestationTokenCallback", async () => {
it("#verifyAttestationTokenCallback", async function () {
const sourceObject = JSON.stringify({ foo: "foo", bar: 10 });

const token = AttestationTokenImpl.create({ body: sourceObject });
Expand Down Expand Up @@ -196,7 +196,7 @@ describe("AttestationTokenTests", function () {
);
});

it("#verifyAttestationTokenIssuer", async () => {
it("#verifyAttestationTokenIssuer", async function () {
const currentTime = Math.floor(new Date().getTime() / 1000);
{
// Source expires in 30 seconds.
Expand Down Expand Up @@ -231,7 +231,7 @@ describe("AttestationTokenTests", function () {
);
}
});
it("#verifyAttestationTimeouts", async () => {
it("#verifyAttestationTimeouts", async function () {
const currentTime = Math.floor(new Date().getTime() / 1000);

{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ describe("PolicyGetSetTests ", function () {
await recorder.stop();
});

it("#GetPolicy SGX - Aad", async () => {
it("#GetPolicy SGX - Aad", async function () {
await testGetPolicy(KnownAttestationType.SgxEnclave, "AAD");
});

it("#GetPolicy SGX - Isolated", async () => {
it("#GetPolicy SGX - Isolated", async function () {
await testGetPolicy(KnownAttestationType.SgxEnclave, "Isolated");
});

it("#GetPolicy SGX - Shared", async () => {
it("#GetPolicy SGX - Shared", async function () {
await testGetPolicy(KnownAttestationType.SgxEnclave, "Shared");
});

it("Set Policy SGX - AAD Unsecured", async () => {
it("Set Policy SGX - AAD Unsecured", async function () {
await testSetPolicy(KnownAttestationType.SgxEnclave, "AAD");
});

it("Set Policy failure conditions", async () => {
it("Set Policy failure conditions", async function () {
const adminClient = createRecordedAdminClient(recorder, "AAD");

const minimalPolicy = "version=1.0; authorizationrules{=> permit();}; issuancerules{};";
Expand Down Expand Up @@ -91,7 +91,7 @@ describe("PolicyGetSetTests ", function () {
await adminClient.resetPolicy(KnownAttestationType.SgxEnclave);
});

it("Reset Policy failure conditions", async () => {
it("Reset Policy failure conditions", async function () {
const adminClient = createRecordedAdminClient(recorder, "AAD");

const [rsaKey, rsapubKey] = createRSAKey();
Expand Down Expand Up @@ -138,7 +138,7 @@ describe("PolicyGetSetTests ", function () {
await testSetPolicy(KnownAttestationType.SgxEnclave, "Isolated", getIsolatedSigningKey());
});

it("Reset Policy SGX - AAD Unsecured", async () => {
it("Reset Policy SGX - AAD Unsecured", async function () {
await testResetPolicy(KnownAttestationType.SgxEnclave, "AAD");
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("PolicyManagementTests ", function () {
await recorder.stop();
});

it("#getPolicyCertificates - AAD", async () => {
it("#getPolicyCertificates - AAD", async function () {
const client = createRecordedAdminClient(recorder, "AAD");

const policyResult = await client.getPolicyManagementCertificates();
Expand All @@ -43,7 +43,7 @@ describe("PolicyManagementTests ", function () {
assert(result, "Expected a token from the service but did not receive one");
});

it("#getPolicyCertificates - Shared", async () => {
it("#getPolicyCertificates - Shared", async function () {
const client = createRecordedAdminClient(recorder, "Shared");
const policyResult = await client.getPolicyManagementCertificates();

Expand All @@ -52,7 +52,7 @@ describe("PolicyManagementTests ", function () {
assert(result, "Expected a token from the service but did not receive one");
});

it("#getPolicyCertificates - Isolated", async () => {
it("#getPolicyCertificates - Isolated", async function () {
const client = createRecordedAdminClient(recorder, "Isolated");
const policyResult = await client.getPolicyManagementCertificates();

Expand All @@ -62,7 +62,7 @@ describe("PolicyManagementTests ", function () {
assert(policyResult.body.length !== 0);
});

it("Add Policy Certificates failure conditions", async () => {
it("Add Policy Certificates failure conditions", async function () {
const adminClient = createRecordedAdminClient(recorder, "Isolated");

const [rsaKey, rsapubKey] = createRSAKey();
Expand All @@ -78,7 +78,7 @@ describe("PolicyManagementTests ", function () {
).to.be.rejectedWith("Key does not match Certificate");
});

it("Remove Policy failure conditions", async () => {
it("Remove Policy failure conditions", async function () {
const adminClient = createRecordedAdminClient(recorder, "Isolated");

const [rsaKey, rsapubKey] = createRSAKey();
Expand Down
12 changes: 6 additions & 6 deletions sdk/attestation/attestation/test/public/tokenCertTests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ describe("TokenCertTests", function () {
await recorder.stop();
});

it("#GetCertificateAAD", async () => {
it("#GetCertificateAAD", async function () {
const client = createRecordedClient(recorder, "AAD");
await getCertificatesTest(client);
});

it("#GetCertificatesIsolated", async () => {
it("#GetCertificatesIsolated", async function () {
const client = createRecordedClient(recorder, "Isolated");
await getCertificatesTest(client);
});

it("#GetCertificatesShared", async () => {
it("#GetCertificatesShared", async function () {
const client = createRecordedClient(recorder, "Shared");
await getCertificatesTest(client);
});
Expand All @@ -56,17 +56,17 @@ describe("TokenCertTests", function () {
}
}

it("#GetMetadataConfigAAD", async () => {
it("#GetMetadataConfigAAD", async function () {
const client = createRecordedClient(recorder, "AAD");
await getMetadataConfigTest(client, getAttestationUri("AAD"));
});

it("#GetMetadataConfigIsolated", async () => {
it("#GetMetadataConfigIsolated", async function () {
const client = createRecordedClient(recorder, "Isolated");
await getMetadataConfigTest(client, getAttestationUri("Isolated"));
});

it("#GetMetadataConfigShared", async () => {
it("#GetMetadataConfigShared", async function () {
const client = createRecordedClient(recorder, "Shared");
await getMetadataConfigTest(client, getAttestationUri("Shared"));
});
Expand Down