{"action":"created","comment":{"url":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls/comments/55548259","id":55548259,"diff_hunk":"@@ -0,0 +1,242 @@\n+//\n+//  ConnectionDisconnectTests.m\n+//  RespokeSDK\n+//\n+//  Copyright 2015, Digium, Inc.\n+//  All rights reserved.\n+//\n+//  This source code is licensed under The MIT License found in the\n+//  LICENSE file in the root directory of this source tree.\n+//\n+//  For all details and documentation:  https://www.respoke.io\n+//\n+\n+#import <Foundation/Foundation.h>\n+\n+#import <UIKit/UIKit.h>\n+#import <XCTest/XCTest.h>\n+#import \"RespokeEndpoint+private.h\"\n+#import \"Respoke+private.h\"\n+#import \"RespokeClient+private.h\"\n+#import \"RespokeTestCase.h\"\n+#import \"RespokeGroup+private.h\"\n+#import \"RespokeConnection+private.h\"\n+#import \"RespokeGroupMessage.h\"\n+\n+\n+@interface ConnectionDisconnectTests : RespokeTestCase <RespokeClientDelegate, RespokeEndpointDelegate, RespokeGroupDelegate> {\n+    RespokeGroup *firstClientGroup;\n+    BOOL callbackDidSucceed;\n+    BOOL doCopySelf;\n+    RespokeEndpoint *recipientEndpoint;\n+    RespokeEndpoint *senderEndpoint;\n+}\n+\n+@end\n+\n+\n+@implementation ConnectionDisconnectTests\n+\n+- (void)setUp\n+{\n+    [super setUp];\n+    \n+    // Put setup code here. This method is called before the invocation of each test method in the class.\n+    callbackDidSucceed = NO;\n+}\n+\n+\n+- (void)tearDown\n+{\n+    // Put teardown code here. This method is called after the invocation of each test method in the class.\n+    [super tearDown];\n+}\n+\n+\n+/**\n+ *  This test should confirm that an error is thrown when sending an endpoint message when in the process of reconnecting\n+ */\n+- (void)testErrorWhenReconnectingEndpointMessage\n+{\n+    // Create a client to test with\n+    NSString *recipientEndpointID = [RespokeTestCase generateTestEndpointID];\n+    RespokeClient *recipientClient = [self createTestClientWithEndpointID:recipientEndpointID delegate:self];\n+    \n+    // Create a second client to test with\n+    NSString *senderEndpointID = [RespokeTestCase generateTestEndpointID];\n+    RespokeClient *senderClient = [self createTestClientWithEndpointID:senderEndpointID delegate:self];\n+    \n+    // Build references to each of the endpoints\n+    recipientEndpoint = [senderClient getEndpointWithID:recipientEndpointID skipCreate:NO];\n+    XCTAssertNotNil(recipientEndpoint, @\"Should create endpoint instance\");\n+    recipientEndpoint.delegate = self;\n+    \n+    senderEndpoint = [recipientClient getEndpointWithID:senderEndpointID skipCreate:NO];\n+    XCTAssertNotNil(senderEndpoint, @\"Should create endpoint instance\");\n+    senderEndpoint.delegate = self;\n+    \n+    // diconnect and immediately reconnect\n+    [senderClient disconnect];\n+    \n+    // message should error out\n+    asyncTaskDone = NO;\n+    callbackDidSucceed = NO;\n+    [recipientEndpoint sendMessage:TEST_MESSAGE push:NO ccSelf:NO successHandler:^{\n+        callbackDidSucceed = NO;\n+        asyncTaskDone = YES;\n+        XCTAssertTrue(NO, @\"Should not successfully send a message.\");\n+    } errorHandler:^(NSString *errorMessage){\n+        NSLog(@\"Error Message: %@\", errorMessage);\n+        callbackDidSucceed = YES;\n+        asyncTaskDone = YES;\n+    }];\n+    \n+    [self waitForCompletion:TEST_TIMEOUT];\n+    XCTAssertTrue(callbackDidSucceed, @\"sendMessage should call successHandler\");\n+}\n+\n+/**\n+ *  This test should confirm that an error is thrown when sending a group message when in the process of reconnecting\n+ */\n+- (void)testErrorWhenReconnectingGroupMessage\n+{\n+    // Create a client to test with\n+    NSString *recipientEndpointID = [RespokeTestCase generateTestEndpointID];\n+    \n+    // Create a second client to test with\n+    NSString *senderEndpointID = [RespokeTestCase generateTestEndpointID];\n+    RespokeClient *senderClient = [self createTestClientWithEndpointID:senderEndpointID delegate:self];\n+    \n+    // Join Group\n+    asyncTaskDone = NO;\n+    NSString *testGroupID = [@\"group\" stringByAppendingString:recipientEndpointID];\n+    [senderClient joinGroups:@[testGroupID] successHandler:^(NSArray *groups){\n+        firstClientGroup = [groups firstObject];\n+        asyncTaskDone = YES;\n+    } errorHandler:^(NSString *errorMessage){\n+        asyncTaskDone = YES;\n+    }];\n+    \n+    [self waitForCompletion:TEST_TIMEOUT];\n+    \n+    // diconnect and immediately reconnect\n+    [senderClient disconnect];\n+    [self createTestClientWithEndpointID:senderEndpointID delegate:self];\n+    \n+\n+    // message should error out\n+    asyncTaskDone = NO;\n+    callbackDidSucceed = NO;\n+    [firstClientGroup sendMessage:TEST_MESSAGE push:NO persist:NO successHandler:^{\n+        callbackDidSucceed = NO;\n+        asyncTaskDone = YES;\n+        XCTAssertTrue(NO, @\"Should not successfully send a group message.\");\n+    } errorHandler:^(NSString *errorMessage){\n+        NSLog(@\"Error Message: %@\", errorMessage);\n+        callbackDidSucceed = YES;\n+        asyncTaskDone = YES;\n+    }];\n+    \n+    [self waitForCompletion:TEST_TIMEOUT];\n+    XCTAssertTrue(callbackDidSucceed, @\"sendMessage should call successHandler\");","path":"RespokeSDKTests/Functional/ConnectionDisconnectTests.m","position":141,"original_position":141,"commit_id":"82bb6b69285cb050e0f447536cddbfffa7bab14c","original_commit_id":"82bb6b69285cb050e0f447536cddbfffa7bab14c","user":{"login":"mbrooks","id":73542,"avatar_url":"https://avatars.githubusercontent.com/u/73542?v=3","gravatar_id":"","url":"https://api.github.com/users/mbrooks","html_url":"https://github.com/mbrooks","followers_url":"https://api.github.com/users/mbrooks/followers","following_url":"https://api.github.com/users/mbrooks/following{/other_user}","gists_url":"https://api.github.com/users/mbrooks/gists{/gist_id}","starred_url":"https://api.github.com/users/mbrooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbrooks/subscriptions","organizations_url":"https://api.github.com/users/mbrooks/orgs","repos_url":"https://api.github.com/users/mbrooks/repos","events_url":"https://api.github.com/users/mbrooks/events{/privacy}","received_events_url":"https://api.github.com/users/mbrooks/received_events","type":"User","site_admin":false},"body":"Fixed","created_at":"2016-03-09T16:45:17Z","updated_at":"2016-03-09T16:45:17Z","html_url":"https://github.com/respoke/respoke-sdk-ios/pull/13#discussion_r55548259","pull_request_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls/comments/55548259"},"html":{"href":"https://github.com/respoke/respoke-sdk-ios/pull/13#discussion_r55548259"},"pull_request":{"href":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls/13","id":62254296,"html_url":"https://github.com/respoke/respoke-sdk-ios/pull/13","diff_url":"https://github.com/respoke/respoke-sdk-ios/pull/13.diff","patch_url":"https://github.com/respoke/respoke-sdk-ios/pull/13.patch","issue_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/issues/13","number":13,"state":"open","locked":false,"title":"tests for sending messages in disconnected state","user":{"login":"mbrooks","id":73542,"avatar_url":"https://avatars.githubusercontent.com/u/73542?v=3","gravatar_id":"","url":"https://api.github.com/users/mbrooks","html_url":"https://github.com/mbrooks","followers_url":"https://api.github.com/users/mbrooks/followers","following_url":"https://api.github.com/users/mbrooks/following{/other_user}","gists_url":"https://api.github.com/users/mbrooks/gists{/gist_id}","starred_url":"https://api.github.com/users/mbrooks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbrooks/subscriptions","organizations_url":"https://api.github.com/users/mbrooks/orgs","repos_url":"https://api.github.com/users/mbrooks/repos","events_url":"https://api.github.com/users/mbrooks/events{/privacy}","received_events_url":"https://api.github.com/users/mbrooks/received_events","type":"User","site_admin":false},"body":"This PR adds tests to make sure the SDK responds properly when sending endpoint and group messages during a disconnect / reconnect situation.\r\n\r\nAlso, updated the test instructions in the Readme.","created_at":"2016-03-09T16:22:01Z","updated_at":"2016-03-09T16:45:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"486890fb0e863a0afd3f444da28334d7cd8b98cf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls/13/commits","review_comments_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls/13/comments","review_comment_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls/comments{/number}","comments_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/issues/13/comments","statuses_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/statuses/82bb6b69285cb050e0f447536cddbfffa7bab14c","head":{"label":"respoke:connection-disconnect-tests","ref":"connection-disconnect-tests","sha":"82bb6b69285cb050e0f447536cddbfffa7bab14c","user":{"login":"respoke","id":7663021,"avatar_url":"https://avatars.githubusercontent.com/u/7663021?v=3","gravatar_id":"","url":"https://api.github.com/users/respoke","html_url":"https://github.com/respoke","followers_url":"https://api.github.com/users/respoke/followers","following_url":"https://api.github.com/users/respoke/following{/other_user}","gists_url":"https://api.github.com/users/respoke/gists{/gist_id}","starred_url":"https://api.github.com/users/respoke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/respoke/subscriptions","organizations_url":"https://api.github.com/users/respoke/orgs","repos_url":"https://api.github.com/users/respoke/repos","events_url":"https://api.github.com/users/respoke/events{/privacy}","received_events_url":"https://api.github.com/users/respoke/received_events","type":"Organization","site_admin":false},"repo":{"id":35462711,"name":"respoke-sdk-ios","full_name":"respoke/respoke-sdk-ios","owner":{"login":"respoke","id":7663021,"avatar_url":"https://avatars.githubusercontent.com/u/7663021?v=3","gravatar_id":"","url":"https://api.github.com/users/respoke","html_url":"https://github.com/respoke","followers_url":"https://api.github.com/users/respoke/followers","following_url":"https://api.github.com/users/respoke/following{/other_user}","gists_url":"https://api.github.com/users/respoke/gists{/gist_id}","starred_url":"https://api.github.com/users/respoke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/respoke/subscriptions","organizations_url":"https://api.github.com/users/respoke/orgs","repos_url":"https://api.github.com/users/respoke/repos","events_url":"https://api.github.com/users/respoke/events{/privacy}","received_events_url":"https://api.github.com/users/respoke/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/respoke/respoke-sdk-ios","description":"Respoke SDK for iOS","fork":false,"url":"https://api.github.com/repos/respoke/respoke-sdk-ios","forks_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/forks","keys_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/teams","hooks_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/hooks","issue_events_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/issues/events{/number}","events_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/events","assignees_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/assignees{/user}","branches_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/branches{/branch}","tags_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/tags","blobs_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/languages","stargazers_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/stargazers","contributors_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/contributors","subscribers_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/subscribers","subscription_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/subscription","commits_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/contents/{+path}","compare_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/merges","archive_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/downloads","issues_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/issues{/number}","pulls_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/labels{/name}","releases_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/releases{/id}","deployments_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/deployments","created_at":"2015-05-12T02:41:22Z","updated_at":"2016-02-16T07:04:15Z","pushed_at":"2016-03-09T16:22:01Z","git_url":"git://github.com/respoke/respoke-sdk-ios.git","ssh_url":"git@github.com:respoke/respoke-sdk-ios.git","clone_url":"https://github.com/respoke/respoke-sdk-ios.git","svn_url":"https://github.com/respoke/respoke-sdk-ios","homepage":null,"size":58958,"stargazers_count":53,"watchers_count":53,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":1,"forks":10,"open_issues":1,"watchers":53,"default_branch":"master"}},"base":{"label":"respoke:master","ref":"master","sha":"c8a0dbe0fe29bec7d67eba1fd3ad4ef86ca64ea9","user":{"login":"respoke","id":7663021,"avatar_url":"https://avatars.githubusercontent.com/u/7663021?v=3","gravatar_id":"","url":"https://api.github.com/users/respoke","html_url":"https://github.com/respoke","followers_url":"https://api.github.com/users/respoke/followers","following_url":"https://api.github.com/users/respoke/following{/other_user}","gists_url":"https://api.github.com/users/respoke/gists{/gist_id}","starred_url":"https://api.github.com/users/respoke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/respoke/subscriptions","organizations_url":"https://api.github.com/users/respoke/orgs","repos_url":"https://api.github.com/users/respoke/repos","events_url":"https://api.github.com/users/respoke/events{/privacy}","received_events_url":"https://api.github.com/users/respoke/received_events","type":"Organization","site_admin":false},"repo":{"id":35462711,"name":"respoke-sdk-ios","full_name":"respoke/respoke-sdk-ios","owner":{"login":"respoke","id":7663021,"avatar_url":"https://avatars.githubusercontent.com/u/7663021?v=3","gravatar_id":"","url":"https://api.github.com/users/respoke","html_url":"https://github.com/respoke","followers_url":"https://api.github.com/users/respoke/followers","following_url":"https://api.github.com/users/respoke/following{/other_user}","gists_url":"https://api.github.com/users/respoke/gists{/gist_id}","starred_url":"https://api.github.com/users/respoke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/respoke/subscriptions","organizations_url":"https://api.github.com/users/respoke/orgs","repos_url":"https://api.github.com/users/respoke/repos","events_url":"https://api.github.com/users/respoke/events{/privacy}","received_events_url":"https://api.github.com/users/respoke/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/respoke/respoke-sdk-ios","description":"Respoke SDK for iOS","fork":false,"url":"https://api.github.com/repos/respoke/respoke-sdk-ios","forks_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/forks","keys_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/teams","hooks_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/hooks","issue_events_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/issues/events{/number}","events_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/events","assignees_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/assignees{/user}","branches_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/branches{/branch}","tags_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/tags","blobs_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/languages","stargazers_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/stargazers","contributors_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/contributors","subscribers_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/subscribers","subscription_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/subscription","commits_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/contents/{+path}","compare_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/merges","archive_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/downloads","issues_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/issues{/number}","pulls_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/labels{/name}","releases_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/releases{/id}","deployments_url":"https://api.github.com/repos/respoke/respoke-sdk-ios/deployments","created_at":"2015-05-12T02:41:22Z","updated_at":"2016-02-16T07:04:15Z","pushed_at":"2016-03-09T16:22:01Z","git_url":"git://github.com/respoke/respoke-sdk-ios.git","ssh_url":"git@github.com:respoke/respoke-sdk-ios.git","clone_url":"https://github.com/respoke/respoke-sdk-ios.git","svn_url":"https://github.com/respoke/respoke-sdk-ios","homepage":null,"size":58958,"stargazers_count":53,"watchers_count":53,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":1,"forks":10,"open_issues":1,"watchers":53,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls/13"},"html":{"href":"https://github.com/respoke/respoke-sdk-ios/pull/13"},"issue":{"href":"https://api.github.com/repos/respoke/respoke-sdk-ios/issues/13"},"comments":{"href":"https://api.github.com/repos/respoke/respoke-sdk-ios/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/respoke/respoke-sdk-ios/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/respoke/respoke-sdk-ios/statuses/82bb6b69285cb050e0f447536cddbfffa7bab14c"}}}}