<commit_before>//
//  VimeoClientFactory.swift
//  VimeoNetworking
//
//  Created by <NAME> on 10/14/19.
//  Copyright © 2019 Vimeo. All rights reserved.
//

import Foundation
@testable import VimeoNetworking


/// Factory method to create VimeoClient instances used in unit testing
/// - Parameters:
///   - reachabilityManager: The optional ReachabilityManaging instance to be used by the client
///   - sessionManager: The Network session manager associated with the client
///   - appConfiguration: the configuration to be used when setting up the client and session manager
func makeVimeoClient(
    reachabilityManager: ReachabilityManaging? = VimeoReachabilityProvider.reachabilityManager,
    sessionManager: SessionManaging & AuthenticationListeningDelegate = VimeoSessionManager.fake,
    appConfiguration: AppConfiguration = .fake
) -> VimeoClient {
    return VimeoClient(
        appConfiguration: appConfiguration,
        reachabilityManager: reachabilityManager,
        sessionManager: sessionManager
    )
}

private extension VimeoSessionManager {
    static let fake: VimeoSessionManager = .defaultSessionManager(
        appConfiguration: .fake,
        configureSessionManagerBlock: nil
    )
}

private extension AppConfiguration {
    static let fake: AppConfiguration = {
        return AppConfiguration(
            clientIdentifier: "{CLIENT_ID}",
            clientSecret: "{CLIENT_SECRET}",
            scopes: [.Public, .Private, .Purchased, .Create, .Edit, .Delete, .Interact, .Upload],
            keychainService: "com.vimeo.keychain_service",<commit_msg>Replaces dummy client id and secret with explicit fake naming<commit_after>//
//  VimeoClientFactory.swift
//  VimeoNetworking
//
//  Created by <NAME> on 10/14/19.
//  Copyright © 2019 Vimeo. All rights reserved.
//

import Foundation
@testable import VimeoNetworking


/// Factory method to create VimeoClient instances used in unit testing
/// - Parameters:
///   - reachabilityManager: The optional ReachabilityManaging instance to be used by the client
///   - sessionManager: The Network session manager associated with the client
///   - appConfiguration: the configuration to be used when setting up the client and session manager
func makeVimeoClient(
    reachabilityManager: ReachabilityManaging? = VimeoReachabilityProvider.reachabilityManager,
    sessionManager: SessionManaging & AuthenticationListeningDelegate = VimeoSessionManager.fake,
    appConfiguration: AppConfiguration = .fake
) -> VimeoClient {
    return VimeoClient(
        appConfiguration: appConfiguration,
        reachabilityManager: reachabilityManager,
        sessionManager: sessionManager
    )
}

private extension VimeoSessionManager {
    static let fake: VimeoSessionManager = .defaultSessionManager(
        appConfiguration: .fake,
        configureSessionManagerBlock: nil
    )
}

private extension AppConfiguration {
    static let fake: AppConfiguration = {
        return AppConfiguration(
            clientIdentifier: "FAKE_CLIENT_ID",
            clientSecret: "FAKE_CLIENT_SECRET",
            scopes: [.Public, .Private, .Purchased, .Create, .Edit, .Delete, .Interact, .Upload],
            keychainService: "com.vimeo.keychain_service",
{'fraction_non_alphanumeric': 0.07863777089783282, 'fraction_numerical': 0.006191950464396285, 'mean_word_length': 3.5507042253521126, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3816454', 'n_tokens_mistral': 855, 'n_tokens_neox': 836, 'n_words': 252}