-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKBClientTest.m
More file actions
57 lines (42 loc) · 1.42 KB
/
Copy pathKBClientTest.m
File metadata and controls
57 lines (42 loc) · 1.42 KB
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
//
// KBClientTest.m
// KBKeybaseAPI
//
// Created by Gabriel on 7/15/15.
// Copyright (c) 2015 Gabriel Handford. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import <KBKeybaseAPI/KBKeybaseAPI.h>
@interface KBClientTest : XCTestCase
@end
@implementation KBClientTest
- (void)testLogin {
XCTestExpectation *expectation = [self expectationWithDescription:@"Login"];
KBAPIClient *client = [[KBAPIClient alloc] initWithAPIHost:KBAPIKeybaseIOHost crypto:nil];
[client logInWithEmailOrUserName:@"gbrl24" password:@"toomanysecrets" success:^(KBSession *session) {
[client nextSequence:^(NSNumber *sequenceNumber, NSString *previousBlockHash) {
[expectation fulfill];
} failure:^(NSError *error) {
XCTFail(@"%@", error);
}];
} failure:^(NSError *error) {
XCTFail(@"%@", error);
}];
[self waitForExpectationsWithTimeout:10.0 handler:^(NSError *error) {
if (error) XCTFail();
}];
}
- (void)testSearch {
XCTestExpectation *expectation = [self expectationWithDescription:@"Search"];
KBAPIClient *client = [[KBAPIClient alloc] initWithAPIHost:KBAPIKeybaseIOHost crypto:nil];
[client searchUsersWithQuery:@"gabriel" success:^(NSArray *searchResults) {
[expectation fulfill];
} failure:^(NSError *error) {
XCTFail(@"%@", error);
}];
[self waitForExpectationsWithTimeout:10.0 handler:^(NSError *error) {
if (error) XCTFail();
}];
}
@end