-
-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathAPNSClientTests.swift
52 lines (47 loc) · 1.62 KB
/
APNSClientTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//===----------------------------------------------------------------------===//
//
// This source file is part of the APNSwift open source project
//
// Copyright (c) 2022 the APNSwift project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of APNSwift project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
@testable import APNSCore
import APNS
import Crypto
import XCTest
final class APNSClientTests: XCTestCase {
func testShutdown() async throws {
let client = self.makeClient()
try await client.shutdown()
}
// MARK: - Helper methods
private func makeClient() -> APNSClient<JSONDecoder, JSONEncoder> {
APNSClient(
configuration: .init(
authenticationMethod: .jwt(
privateKey: try! P256.Signing.PrivateKey(pemRepresentation: self.jwtPrivateKey),
keyIdentifier: "MY_KEY_ID",
teamIdentifier: "MY_TEAM_ID"
),
environment: .development
),
eventLoopGroupProvider: .createNew,
responseDecoder: JSONDecoder(),
requestEncoder: JSONEncoder()
)
}
private let jwtPrivateKey = """
-----BEGIN PRIVATE KEY-----
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQg2sD+kukkA8GZUpmm
jRa4fJ9Xa/JnIG4Hpi7tNO66+OGgCgYIKoZIzj0DAQehRANCAATZp0yt0btpR9kf
ntp4oUUzTV0+eTELXxJxFvhnqmgwGAm1iVW132XLrdRG/ntlbQ1yzUuJkHtYBNve
y+77Vzsd
-----END PRIVATE KEY-----
"""
}