This repository was archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathCAPTCHATest.swift
101 lines (94 loc) · 3.4 KB
/
CAPTCHATest.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//
// CAPTCHATest.swift
// reddift
//
// Created by sonson on 2015/05/07.
// Copyright (c) 2015年 sonson. All rights reserved.
//
import Foundation
import XCTest
#if os(iOS)
import UIKit
#endif
class CAPTCHATest: SessionTestSpec {
// now, CAPTCHA API does not work.....?
// func testCheckWhetherCAPTCHAIsNeededOrNot() {
// let msg = "is true or false as Bool"
// print(msg)
// var check_result: Bool? = nil
// let documentOpenExpectation = self.expectation(description: msg)
// do {
// try self.session?.checkNeedsCAPTCHA({(result) -> Void in
// switch result {
// case .failure(let error):
// print(error)
// case .success(let check):
// check_result = check
// }
// XCTAssert(check_result != nil, msg)
// documentOpenExpectation.fulfill()
// })
// } catch { XCTFail((error as NSError).description) }
// self.waitForExpectations(timeout: self.timeoutDuration, handler: nil)
// }
// now, CAPTCHA API does not work.....?
// func testGetIdenForNewCAPTCHA() {
// let msg = "is String"
// print(msg)
// var iden: String? = nil
// let documentOpenExpectation = self.expectation(description: msg)
// do {
// try self.session?.getIdenForNewCAPTCHA({ (result) -> Void in
// switch result {
// case .failure(let error):
// print(error.description)
// case .success(let identifier):
// iden = identifier
// }
// XCTAssert(iden != nil, msg)
// documentOpenExpectation.fulfill()
// })
// } catch { XCTFail((error as NSError).description) }
// self.waitForExpectations(timeout: self.timeoutDuration, handler: nil)
// }
// now, CAPTCHA API does not work.....?
// func testSizeOfNewImageGeneratedUsingIden() {
// let msg = "is 120x50"
// print(msg)
//#if os(iOS) || os(tvOS)
// var size: CGSize? = nil
//#elseif os(macOS)
// var size: NSSize? = nil
//#endif
// let documentOpenExpectation = self.expectation(description: msg)
// do {
// try self.session?.getIdenForNewCAPTCHA({ (result) -> Void in
// switch result {
// case .failure(let error):
// print(error.description)
// case .success(let string):
// try! self.session?.getCAPTCHA(string, completion: { (result) -> Void in
// switch result {
// case .failure(let error):
// print(error.description)
// case .success(let image):
// size = image.size
// }
// documentOpenExpectation.fulfill()
// })
// }
// })
// } catch { XCTFail((error as NSError).description) }
// self.waitForExpectations(timeout: self.timeoutDuration, handler: nil)
//
// if let size = size {
//#if os(iOS)
// XCTAssert(size == CGSize(width: 120, height: 50), msg)
//#elseif os(macOS)
// XCTAssert(size == NSSize(width: 120, height: 50), msg)
//#endif
// } else {
// XCTFail(msg)
// }
// }
}