2020-04-11 23:23:38 -07:00
|
|
|
//
|
|
|
|
|
// PasswordStoreTest.swift
|
|
|
|
|
// passKitTests
|
|
|
|
|
//
|
|
|
|
|
// Copyright © 2020 Bob Sun. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
import XCTest
|
|
|
|
|
import ObjectiveGit
|
|
|
|
|
|
|
|
|
|
@testable import passKit
|
|
|
|
|
|
|
|
|
|
class PasswordStoreTest: XCTestCase {
|
2020-04-12 19:32:58 -07:00
|
|
|
let cloneOptions: [String : GTCredentialProvider] = {
|
|
|
|
|
let credentialProvider = GTCredentialProvider { (_, _, _) -> (GTCredential?) in
|
|
|
|
|
try? GTCredential(userName: "", password: "")
|
|
|
|
|
}
|
|
|
|
|
return [GTRepositoryCloneOptionsCredentialProvider: credentialProvider]
|
|
|
|
|
}()
|
|
|
|
|
let remoteRepoURL = URL(string: "https://github.com/mssun/passforios-password-store.git")!
|
|
|
|
|
|
|
|
|
|
func testClone() throws {
|
|
|
|
|
let url = URL(fileURLWithPath: "\(Globals.repositoryPath)-test")
|
|
|
|
|
let passwordStore = PasswordStore(url: url)
|
|
|
|
|
|
|
|
|
|
try passwordStore.cloneRepository(
|
|
|
|
|
remoteRepoURL: remoteRepoURL,
|
|
|
|
|
options: cloneOptions,
|
|
|
|
|
branchName: "master",
|
|
|
|
|
transferProgressBlock: { _, _ in },
|
|
|
|
|
checkoutProgressBlock: { _, _, _ in }
|
|
|
|
|
)
|
|
|
|
|
passwordStore.erase()
|
|
|
|
|
}
|
2020-04-11 23:23:38 -07:00
|
|
|
}
|