Skip to content

Commit 4412986

Browse files
Neno StefanovNenoStefanov
authored andcommitted
test: use service account authorization
1 parent 27c8952 commit 4412986

19 files changed

+71
-145
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,8 @@ jobs:
6565
with:
6666
xcode-version: '16.4'
6767
- name: Run integration tests
68-
env:
69-
TEST_ENVIRONMENT_URL: ${{ vars.TEST_ENVIRONMENT_URL }}
70-
TEST_CUV_CLIENT_SECRET: ${{ secrets.TEST_CUV_CLIENT_SECRET }}
71-
TEST_CUV_CLIENT_ID: ${{ vars.TEST_CUV_CLIENT_ID }}
68+
env:
7269
TEST_CUV_PROJECT_ID: ${{ vars.TEST_CUV_PROJECT_ID }}
73-
TEST_DV_CLIENT_SECRET: ${{ secrets.TEST_DV_CLIENT_SECRET }}
7470
TEST_DV_CLIENT_ID: ${{ vars.TEST_DV_CLIENT_ID }}
7571
TEST_DV_PROJECT_ID: ${{ vars.TEST_DV_PROJECT_ID }}
7672
TEST_ECV_PROJECT_ID: ${{ vars.TEST_ECV_PROJECT_ID }}
@@ -79,6 +75,7 @@ jobs:
7975
TEST_ECV_PROJECT_URL: ${{ vars.TEST_ECV_PROJECT_URL }}
8076
TEST_DV_PROJECT_URL: ${{ vars.TEST_DV_PROJECT_URL }}
8177
TEST_CUV_PROJECT_URL: ${{ vars.TEST_CUV_PROJECT_URL }}
78+
TEST_CUV_SERVICE_ACCOUNT_TOKEN: ${{ secrets.TEST_CUV_SERVICE_ACCOUNT_TOKEN }}
8279
run: |
8380
cd MIRACLTrust
8481
xcrun simctl erase "iPhone 16"

MIRACLTrust/MIRACLTrust.xcodeproj/xcshareddata/xcschemes/MIRACLTrust-IntegrationTests.xcscheme

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,11 @@
5252
</BuildableReference>
5353
</MacroExpansion>
5454
<EnvironmentVariables>
55-
<EnvironmentVariable
56-
key = "clientSecretCUV"
57-
value = "$(TEST_CUV_CLIENT_SECRET)"
58-
isEnabled = "YES">
59-
</EnvironmentVariable>
60-
<EnvironmentVariable
61-
key = "clientIdCUV"
62-
value = "$(TEST_CUV_CLIENT_ID)"
63-
isEnabled = "YES">
64-
</EnvironmentVariable>
6555
<EnvironmentVariable
6656
key = "projectIdCUV"
6757
value = "$(TEST_CUV_PROJECT_ID)"
6858
isEnabled = "YES">
6959
</EnvironmentVariable>
70-
<EnvironmentVariable
71-
key = "clientSecretDV"
72-
value = "$(TEST_DV_CLIENT_SECRET)"
73-
isEnabled = "YES">
74-
</EnvironmentVariable>
75-
<EnvironmentVariable
76-
key = "clientIdDV"
77-
value = "$(TEST_DV_CLIENT_ID)"
78-
isEnabled = "YES">
79-
</EnvironmentVariable>
8060
<EnvironmentVariable
8161
key = "projectIdDV"
8262
value = "$(TEST_DV_PROJECT_ID)"
@@ -112,6 +92,11 @@
11292
value = "$(TEST_ECV_PROJECT_URL)"
11393
isEnabled = "YES">
11494
</EnvironmentVariable>
95+
<EnvironmentVariable
96+
key = "serviceAccountTokenCUV"
97+
value = "$(TEST_CUV_SERVICE_ACCOUNT_TOKEN)"
98+
isEnabled = "YES">
99+
</EnvironmentVariable>
115100
</EnvironmentVariables>
116101
<CodeCoverageTargets>
117102
<BuildableReference

MIRACLTrust/MIRACLTrustIntegrationTests/Cases/Objective-C/MIRACLTrustCompatibilityTests.m

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ - (void)setUp
9191
- (void)testVerificationConfirmationError
9292
{
9393
NSString *projectId = NSProcessInfo.processInfo.environment[@"projectIdCUV"];
94-
NSString *clientId = NSProcessInfo.processInfo.environment[@"clientIdCUV"];
95-
NSString *clientSecret = NSProcessInfo.processInfo.environment[@"clientSecretCUV"];
94+
NSString *serviceAccountToken = NSProcessInfo.processInfo.environment[@"serviceAccountTokenCUV"];
9695
NSString *projectURL = NSProcessInfo.processInfo.environment[@"projectURLCUV"];
9796

9897
NSString *deviceName = [[NSUUID UUID] UUIDString];
@@ -128,13 +127,12 @@ - (void)testVerificationConfirmationError
128127
toDate:[NSDate date]
129128
options: 0];
130129

131-
NSURL *verificationURL = [self.api getVerificaitonURLWithClientId:clientId
132-
clientSecret:clientSecret
133-
projectId:projectId
134-
projectURL:projectURL
135-
userId:self.userId
136-
accessId:self.session.accessId
137-
expiration:expirationDate];
130+
NSURL *verificationURL = [self.api getVerificaitonURLWithServiceAccountToken:serviceAccountToken
131+
projectId:projectId
132+
projectURL:projectURL
133+
userId:self.userId
134+
accessId:self.session.accessId
135+
expiration:expirationDate];
138136
NSNumber *sleepTime = @(expirationInSeconds.intValue + 1);
139137
sleep(sleepTime.intValue);
140138

@@ -189,7 +187,7 @@ - (void)testCompatibility
189187
}
190188

191189
projectId = NSProcessInfo.processInfo.environment[@"projectIdCUV"];
192-
NSString *clientId = NSProcessInfo.processInfo.environment[@"clientIdCUV"];
190+
NSString *serviceAccountToken = NSProcessInfo.processInfo.environment[@"serviceAccountTokenCUV"];
193191

194192
error = nil;
195193
[[MIRACLTrust getInstance] setProjectId:projectId];
@@ -199,7 +197,6 @@ - (void)testCompatibility
199197
return;
200198
}
201199

202-
NSString *clientSecret = NSProcessInfo.processInfo.environment[@"clientSecretCUV"];
203200
self.userId = @"[email protected]";
204201
self.api = [[PlatformAPIWrapper alloc] init];
205202
self.session = [self.api startSessionWithProjectId:projectId
@@ -280,13 +277,12 @@ - (void)testCompatibility
280277
XCTAssertFalse([dict[@"crossDeviceSession"] isEqual:[NSNull null]]);
281278
self.crossDeviceSession = (CrossDeviceSession *) dict[@"crossDeviceSession"];
282279

283-
NSURL *verificationURL = [self.api getVerificaitonURLWithClientId:clientId
284-
clientSecret:clientSecret
285-
projectId:projectId
286-
projectURL:projectURL
287-
userId:self.userId
288-
accessId:self.session.accessId
289-
expiration:nil];
280+
NSURL *verificationURL = [self.api getVerificaitonURLWithServiceAccountToken:serviceAccountToken
281+
projectId:projectId
282+
projectURL:projectURL
283+
userId:self.userId
284+
accessId:self.session.accessId
285+
expiration:nil];
290286
dict = [self.getActivationTokenCompatiblityCase getActivationTokenFrom:verificationURL];
291287
self.activationToken = dict[@"activationToken"];
292288

MIRACLTrust/MIRACLTrustIntegrationTests/Cases/Swift/AbortSessionIntergrationTest.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ class AbortSessionIntegrationTests: XCTestCase {
88

99
let platformURLCUV = ProcessInfo.processInfo.environment["projectURLCUV"]!
1010
let projectId = ProcessInfo.processInfo.environment["projectIdCUV"]!
11-
let clientId = ProcessInfo.processInfo.environment["clientIdCUV"]!
12-
let clientSecret = ProcessInfo.processInfo.environment["clientSecretCUV"]!
11+
let serviceAccountToken = ProcessInfo.processInfo.environment["serviceAccountTokenCUV"]!
1312

1413
var abortSessionTestCase = AbortSessionTestCase()
1514
var registrationTestCase = RegistrationTestCase()
@@ -39,8 +38,7 @@ class AbortSessionIntegrationTests: XCTestCase {
3938
let session = try XCTUnwrap(api.startSession(projectId: projectId, projectURL: platformURLCUV))
4039

4140
let (response, _) = getActivationToken.getActivationToken(
42-
clientId: clientId,
43-
clientSecret: clientSecret,
41+
serviceAccountToken: serviceAccountToken,
4442
projectId: projectId,
4543
projectURL: platformURLCUV,
4644
userId: userId,

MIRACLTrust/MIRACLTrustIntegrationTests/Cases/Swift/AuthenticationIntegrationTests.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ class AuthenticationIntegrationTests: XCTestCase {
1818

1919
let projectURL = ProcessInfo.processInfo.environment["projectURLCUV"]!
2020
let projectId = ProcessInfo.processInfo.environment["projectIdCUV"]!
21-
let clientId = ProcessInfo.processInfo.environment["clientIdCUV"]!
22-
let clientSecret = ProcessInfo.processInfo.environment["clientSecretCUV"]!
21+
let serviceAccountToken = ProcessInfo.processInfo.environment["serviceAccountTokenCUV"]!
2322

2423
let userId = "[email protected]"
2524
let randomPIN = String(Int32.random(in: 1000 ..< 9999))
@@ -44,8 +43,7 @@ class AuthenticationIntegrationTests: XCTestCase {
4443
try MIRACLTrust.configure(with: XCTUnwrap(configuration))
4544

4645
let (response, _) = getActivationToken.getActivationToken(
47-
clientId: clientId,
48-
clientSecret: clientSecret,
46+
serviceAccountToken: serviceAccountToken,
4947
projectId: projectId,
5048
projectURL: projectURL,
5149
userId: userId,

MIRACLTrust/MIRACLTrustIntegrationTests/Cases/Swift/CrossDeviceSessionAuthenticationIntegrationTest.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import Testing
33

44
struct CrossDeviceSessionAuthenticationIntegrationTest {
55
let projectId = ProcessInfo.processInfo.environment["projectIdCUV"]!
6-
let clientId = ProcessInfo.processInfo.environment["clientIdCUV"]!
7-
let clientSecret = ProcessInfo.processInfo.environment["clientSecretCUV"]!
6+
let serviceAccountToken = ProcessInfo.processInfo.environment["serviceAccountTokenCUV"]!
87
let projectURL = ProcessInfo.processInfo.environment["projectURLCUV"]!
98
let userId = "[email protected]"
109

@@ -36,8 +35,7 @@ struct CrossDeviceSessionAuthenticationIntegrationTest {
3635
let qrCode = "https://mcl.mpin.io#\(session.accessId)"
3736
crossDeviceSession = try await crossDeviceSessionCase.getCrossDeviceSessionForQRCode(qrCode: qrCode)
3837
let activationToken = try await activationTokenCase.getActivationToken(
39-
clientId: clientId,
40-
clientSecret: clientSecret,
38+
serviceAccountToken: serviceAccountToken,
4139
projectId: projectId,
4240
projectURL: projectURL,
4341
userId: userId

MIRACLTrust/MIRACLTrustIntegrationTests/Cases/Swift/CrossDeviceSessionIntegrationTest.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Testing
33

44
struct CrossDeviceSessionIntegrationTest {
55
let projectId = ProcessInfo.processInfo.environment["projectIdCUV"]!
6-
let clientId = ProcessInfo.processInfo.environment["clientIdCUV"]!
76
let url = ProcessInfo.processInfo.environment["projectURLCUV"]!
87
let expectedProjectId = ProcessInfo.processInfo.environment["projectIdDV"]!
98

MIRACLTrust/MIRACLTrustIntegrationTests/Cases/Swift/PushNotificationsIntegrationTest.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ class PushNotificationsIntegrationTest: XCTestCase {
1818

1919
let projectURL = ProcessInfo.processInfo.environment["projectURLCUV"]!
2020
let projectId = ProcessInfo.processInfo.environment["projectIdCUV"]!
21-
let clientId = ProcessInfo.processInfo.environment["clientIdCUV"]!
22-
let clientSecret = ProcessInfo.processInfo.environment["clientSecretCUV"]!
21+
let serviceAccountToken = ProcessInfo.processInfo.environment["serviceAccountTokenCUV"]!
2322

2423
let userId = "[email protected]"
2524
let randomPIN = String(Int32.random(in: 1000 ..< 9999))
@@ -51,8 +50,7 @@ class PushNotificationsIntegrationTest: XCTestCase {
5150
try MIRACLTrust.configure(with: XCTUnwrap(configuration))
5251

5352
let (response, _) = getActivationToken.getActivationToken(
54-
clientId: clientId,
55-
clientSecret: clientSecret,
53+
serviceAccountToken: serviceAccountToken,
5654
projectId: projectId,
5755
projectURL: projectURL,
5856
userId: userId,

MIRACLTrust/MIRACLTrustIntegrationTests/Cases/Swift/QRAuthenticationIntegrationTests.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ class QRAuthenticationIntegrationTests: XCTestCase {
1717
)
1818

1919
let projectId = ProcessInfo.processInfo.environment["projectIdCUV"]!
20-
let clientId = ProcessInfo.processInfo.environment["clientIdCUV"]!
21-
let clientSecret = ProcessInfo.processInfo.environment["clientSecretCUV"]!
20+
let serviceAccountToken = ProcessInfo.processInfo.environment["serviceAccountTokenCUV"]!
2221

2322
let userId = "[email protected]"
2423
let randomPIN = String(Int32.random(in: 1000 ..< 9999))
@@ -44,8 +43,7 @@ class QRAuthenticationIntegrationTests: XCTestCase {
4443
try MIRACLTrust.configure(with: XCTUnwrap(configuration))
4544

4645
let (response, _) = getActivationToken.getActivationToken(
47-
clientId: clientId,
48-
clientSecret: clientSecret,
46+
serviceAccountToken: serviceAccountToken,
4947
projectId: projectId,
5048
projectURL: projectURL,
5149
userId: userId,

MIRACLTrust/MIRACLTrustIntegrationTests/Cases/Swift/QuickCodeIntegrationTests.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ class QuickCodeIntegrationTests: XCTestCase {
1717

1818
let projectURL = ProcessInfo.processInfo.environment["projectURLCUV"]!
1919
let projectId = ProcessInfo.processInfo.environment["projectIdCUV"]!
20-
let clientId = ProcessInfo.processInfo.environment["clientIdCUV"]!
21-
let clientSecret = ProcessInfo.processInfo.environment["clientSecretCUV"]!
20+
let serviceAccountToken = ProcessInfo.processInfo.environment["serviceAccountTokenCUV"]!
2221

2322
let userId = "[email protected]"
2423
let randomPIN = String(Int32.random(in: 1000 ..< 9999))
@@ -45,8 +44,7 @@ class QuickCodeIntegrationTests: XCTestCase {
4544
authenticationTestCase.pinCode = randomPIN
4645

4746
let (response, _) = getActivationToken.getActivationToken(
48-
clientId: clientId,
49-
clientSecret: clientSecret,
47+
serviceAccountToken: serviceAccountToken,
5048
projectId: projectId,
5149
projectURL: projectURL,
5250
userId: userId,

0 commit comments

Comments
 (0)