forked from OAuthSwift/OAuthSwift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtilsTests.swift
51 lines (35 loc) · 1.08 KB
/
UtilsTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// Utils.swift
// OAuthSwift
//
// Created by phimage on 06/10/16.
// Copyright © 2016 Dongri Jin. All rights reserved.
//
import Foundation
import XCTest
@testable import OAuthSwift
class UtilsTest: XCTestCase {
func testMergeNilDictionaryWithOp() {
var nilDico: OAuthSwift.Headers? = nil
let addDico = ["Auth": "Bearer"]
nilDico += addDico
guard let dico = nilDico else {
XCTFail()
return
}
XCTAssertEqualDictionaries(dico, addDico)
}
func testMergeDictionary() {
var dico: [String: String] = ["param": "value"]
let addDico = ["Auth": "Bearer"]
dico.merge(addDico)
XCTAssertEqualDictionaries(dico, dico + addDico)
XCTAssertEqualDictionaries(dico, ["param": "value", "Auth": "Bearer"])
}
func testGenerateState() {
for l in 0 ..< 20 {
let str = generateState(withLength: l)
XCTAssertEqual(str.characters.count, l)
}
}
}