passforios/passKitTests/Models/PasswordStoreTest.swift
2020-04-12 20:15:49 -07:00

36 lines
1.1 KiB
Swift

//
// PasswordStoreTest.swift
// passKitTests
//
// Copyright © 2020 Bob Sun. All rights reserved.
//
import Foundation
import XCTest
import ObjectiveGit
@testable import passKit
class PasswordStoreTest: XCTestCase {
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()
}
}