mirror of
https://github.com/xtool-org/xtool.git
synced 2026-11-15 20:15:01 +03:00
SPM-related refactoring
This commit is contained in:
committed by
Kabir Oberai
Unverified
parent
a501ccb3c5
commit
efed4185e2
@@ -0,0 +1,2 @@
|
||||
/Tests/SupersignTests/config/*
|
||||
!/Tests/SupersignTests/config/config-template.json
|
||||
@@ -58,6 +58,20 @@ let package = Package(
|
||||
],
|
||||
cSettings: cSettings
|
||||
),
|
||||
.testTarget(
|
||||
name: "SupersignTests",
|
||||
dependencies: [
|
||||
"Supersign",
|
||||
.product(name: "SuperutilsTestSupport", package: "SuperchargeCore")
|
||||
],
|
||||
exclude: [
|
||||
"config/config-template.json",
|
||||
],
|
||||
resources: [
|
||||
.copy("config/config.json"),
|
||||
.copy("config/test.app"),
|
||||
]
|
||||
),
|
||||
.target(
|
||||
name: "SupersignCLI",
|
||||
dependencies: [
|
||||
|
||||
+4
-2
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import SuperutilsTestSupport
|
||||
import Supersign
|
||||
|
||||
class SupersignDeveloperServicesTests: XCTestCase {
|
||||
@@ -15,6 +16,7 @@ class SupersignDeveloperServicesTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
_ = addMockSigner
|
||||
client = .test()
|
||||
}
|
||||
|
||||
@@ -29,11 +31,11 @@ class SupersignDeveloperServicesTests: XCTestCase {
|
||||
let teams = try XCTTry(client.sendTest(listTeams))
|
||||
let team = teams.first { $0.status == "active" && $0.memberships.contains { $0.platform == .iOS } }!
|
||||
|
||||
let bundle = Bundle(for: Self.self)
|
||||
let source = try XCTUnwrap(bundle.url(forResource: "test", withExtension: "app"))
|
||||
let source = try XCTUnwrap(Bundle.module.url(forResource: "test", withExtension: "app"))
|
||||
|
||||
let context = try XCTTry(SigningContext(
|
||||
udid: Config.current.udid,
|
||||
deviceName: SigningContext.hostName,
|
||||
teamID: team.id,
|
||||
client: client,
|
||||
signingInfoManager: MemoryBackedSigningInfoManager()
|
||||
+2
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import SuperutilsTestSupport
|
||||
@testable import Supersign
|
||||
|
||||
class TwoFactorAuthenticator: TwoFactorAuthDelegate {
|
||||
@@ -23,6 +24,7 @@ class SupersignGrandSlamTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
_ = addMockSigner
|
||||
client = .test()
|
||||
authenticator = TwoFactorAuthenticator()
|
||||
}
|
||||
+10
-2
@@ -6,7 +6,12 @@
|
||||
// Copyright © 2019 Kabir Oberai. All rights reserved.
|
||||
//
|
||||
|
||||
// TODO: Test using mock signer
|
||||
|
||||
#if false
|
||||
|
||||
import XCTest
|
||||
import SuperutilsTestSupport
|
||||
import Supersign
|
||||
|
||||
class SupersignSigningTests: XCTestCase {
|
||||
@@ -18,11 +23,11 @@ class SupersignSigningTests: XCTestCase {
|
||||
// swiftlint:disable force_try
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
_ = addMockSigner
|
||||
client = .test()
|
||||
signerImpl = try! SignerImpl.first()
|
||||
|
||||
let bundle = Bundle(for: Self.self)
|
||||
let source = try! XCTUnwrap(bundle.url(forResource: "test", withExtension: "app"))
|
||||
let source = try! XCTUnwrap(Bundle.module.url(forResource: "test", withExtension: "app"))
|
||||
let tmp = FileManager.default.temporaryDirectory
|
||||
app = tmp.appendingPathComponent(source.lastPathComponent)
|
||||
if FileManager.default.fileExists(atPath: app.path) {
|
||||
@@ -48,6 +53,7 @@ class SupersignSigningTests: XCTestCase {
|
||||
|
||||
let context = try XCTTry(SigningContext(
|
||||
udid: Config.current.udid,
|
||||
deviceName: SigningContext.hostName,
|
||||
teamID: team.id,
|
||||
client: client,
|
||||
signingInfoManager: MemoryBackedSigningInfoManager(),
|
||||
@@ -82,3 +88,5 @@ class SupersignSigningTests: XCTestCase {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
+1
-2
@@ -23,8 +23,7 @@ struct Config: Decodable {
|
||||
let udid: String
|
||||
|
||||
static let current: Config = {
|
||||
class ConfigDummy {}
|
||||
let url = Bundle(for: ConfigDummy.self).url(forResource: "config", withExtension: "json")!
|
||||
let url = Bundle.module.url(forResource: "config", withExtension: "json")!
|
||||
// swiftlint:disable:next force_try
|
||||
let data = try! Data(contentsOf: url)
|
||||
// swiftlint:disable:next force_try
|
||||
+4
@@ -10,6 +10,8 @@ import Foundation
|
||||
import XCTest
|
||||
@testable import Supersign
|
||||
|
||||
#if false
|
||||
|
||||
extension TCPAnisetteDataProvider {
|
||||
|
||||
static func test() -> TCPAnisetteDataProvider {
|
||||
@@ -26,6 +28,8 @@ extension NetcatAnisetteDataProvider {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
extension SupersetteDataProvider {
|
||||
|
||||
static func test() -> SupersetteDataProvider {
|
||||
@@ -0,0 +1,16 @@
|
||||
import Foundation
|
||||
import SignerSupport
|
||||
|
||||
let addMockSigner: () = {
|
||||
add_signer(
|
||||
"MockSigner",
|
||||
{ appDir, certData, certLen, privKeyData, privKeyLen, entitlements, numEntitlements, progress, exception in
|
||||
exception.initialize(to: strdup("Mock signer not implemented"))
|
||||
return 1
|
||||
},
|
||||
{ path, outLen, exception in
|
||||
exception.initialize(to: strdup("Mock analyzer not implemented"))
|
||||
return nil
|
||||
}
|
||||
)
|
||||
}()
|
||||
Reference in New Issue
Block a user