fix test cleanup
This commit is contained in:
parent
53ae6426bd
commit
17b6bb8bc2
1 changed files with 6 additions and 3 deletions
|
|
@ -19,7 +19,13 @@ final class PasswordStoreTest: XCTestCase {
|
||||||
let url = Globals.sharedContainerURL.appendingPathComponent("Library/password-store-test/")
|
let url = Globals.sharedContainerURL.appendingPathComponent("Library/password-store-test/")
|
||||||
|
|
||||||
Defaults.isEnableGPGIDOn = true
|
Defaults.isEnableGPGIDOn = true
|
||||||
|
defer {
|
||||||
|
Defaults.isEnableGPGIDOn = false
|
||||||
|
}
|
||||||
let passwordStore = PasswordStore(url: url)
|
let passwordStore = PasswordStore(url: url)
|
||||||
|
defer {
|
||||||
|
passwordStore.erase()
|
||||||
|
}
|
||||||
try passwordStore.cloneRepository(remoteRepoURL: remoteRepoURL, branchName: "master")
|
try passwordStore.cloneRepository(remoteRepoURL: remoteRepoURL, branchName: "master")
|
||||||
expectation(for: NSPredicate { _, _ in FileManager.default.fileExists(atPath: url.path) }, evaluatedWith: nil)
|
expectation(for: NSPredicate { _, _ in FileManager.default.fileExists(atPath: url.path) }, evaluatedWith: nil)
|
||||||
waitForExpectations(timeout: 3, handler: nil)
|
waitForExpectations(timeout: 3, handler: nil)
|
||||||
|
|
@ -47,9 +53,6 @@ final class PasswordStoreTest: XCTestCase {
|
||||||
let testPasswordEntity = try passwordStore.add(password: testPassword)!
|
let testPasswordEntity = try passwordStore.add(password: testPassword)!
|
||||||
let testPasswordPlain = try passwordStore.decrypt(passwordEntity: testPasswordEntity, requestPGPKeyPassphrase: requestPGPKeyPassphrase)
|
let testPasswordPlain = try passwordStore.decrypt(passwordEntity: testPasswordEntity, requestPGPKeyPassphrase: requestPGPKeyPassphrase)
|
||||||
XCTAssertEqual(testPasswordPlain.plainText, "testpassword")
|
XCTAssertEqual(testPasswordPlain.plainText, "testpassword")
|
||||||
|
|
||||||
passwordStore.erase()
|
|
||||||
Defaults.isEnableGPGIDOn = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func decrypt(passwordStore: PasswordStore, path: String, passphrase _: String) throws -> Password {
|
private func decrypt(passwordStore: PasswordStore, path: String, passphrase _: String) throws -> Password {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue