Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push Channels tests #708

Merged
merged 18 commits into from
Jul 13, 2018
Merged

Push Channels tests #708

merged 18 commits into from
Jul 13, 2018

Conversation

ricardopereira
Copy link
Contributor

No description provided.

@ricardopereira ricardopereira requested a review from funkyboy March 23, 2018 15:34
@ricardopereira ricardopereira force-pushed the push-device-auth branch 3 times, most recently from 4d514d0 to 3fe9980 Compare March 30, 2018 11:07
@ricardopereira ricardopereira changed the base branch from push-device-auth to push-device-auth-tests March 30, 2018 13:02
@ricardopereira ricardopereira changed the title Push Channels Push Channels tests Mar 30, 2018
Copy link
Contributor

@funkyboy funkyboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments and requested changes.

- (void)listSubscriptions:(void(^)(ARTPaginatedResult<ARTPushChannelSubscription *> *_Nullable, ARTErrorInfo *_Nullable))callback {
[self listSubscriptions:nil callback:callback];
}
- (BOOL)listSubscriptions:(NSDictionary<NSString *, NSString *> *)params callback:(void(^)(ARTPaginatedResult<ARTPushChannelSubscription *> *_Nullable, ARTErrorInfo *_Nullable))callback error:(NSError *_Nullable *_Nullable)errorPtr {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why we need to return a boolean.
We don't test it and the callback already handles both paginated results and potential errors.

If there isn't a good reason I'd go back to a method that returns void.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has a BOOL because it's how ObjC handle errors. We should respect that for good Swift/ObjC interoperability. An ObjC method with an NSError ** as last parameter and a BOOL return type will bridge to a Swift method that throw an error.

if (!device) {
- (ARTLocalDevice *)getDevice:(void(^_Nullable)(ARTErrorInfo *_Nullable))callback {
ARTLocalDevice *device = [_channel device];
if (![device isRegistered]) {
if (callback) callback([ARTErrorInfo createWithCode:0 message:@"cannot use device before ARTRest.push.activate has finished"]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we should mention "ARTRest.push.activate".
I think "... before device activation has finished" is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accepted acd4100 👍

}
}

// RSH7a2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is RSH7b2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 2dba0b0 👍


it("should return a paginated result with PushChannelSubscription filtered by channel and client") {
let params = [
"clientId": "tester",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably better to reuse rest.options.clientId

expect { try channel.push.listSubscriptions(params) { _, _ in } }.to(throwError { (error: NSError) in
expect(error.code).to(equal(ARTDataQueryError.invalidParameters.rawValue))
})
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test in which you actually subscribe and then you check that the result of listSubscriptions actually includes the result of the subscription.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 720d602 but it doesn't pass. I already reported that issue in Slack.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you put a breakpoint on this line you'll get

(lldb) po channel.name
"test-2-pushenabled:foo"

(lldb) 

Copy link
Contributor

@funkyboy funkyboy Jun 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 02b4d05

@ricardopereira ricardopereira changed the base branch from push-device-auth-tests to push May 4, 2018 11:08
@ricardopereira ricardopereira force-pushed the push-channels branch 3 times, most recently from 58633b7 to 3a7fa24 Compare May 4, 2018 13:03
@ricardopereira
Copy link
Contributor Author

ricardopereira commented May 4, 2018

Test should_return_a_paginated_result_with_PushChannelSubscription still fails with "40100: push not enabled for this channel"

@ricardopereira
Copy link
Contributor Author

Rebased with push branch.

@funkyboy
Copy link
Contributor

@ricardopereira when you pull down this branch to run it locally it throws a bunch of compilation errors
screen shot 2018-06-12 at 16 51 04

@ricardopereira
Copy link
Contributor Author

@funkyboy You're working with Xcode 9.3?

@funkyboy
Copy link
Contributor

@ricardopereira no, 9.2. Afair you said you didn’t upgrade any project settings.

@ricardopereira
Copy link
Contributor Author

@funkyboy I did not update the project settings, I'm only using Xcode 9.3 #709 (comment)

@funkyboy
Copy link
Contributor

@ricardopereira Yup, the point is that it doesn’t compile on 9.2 :(
Anyway an upgrade is on the way, so this will soon be a non problem.

@ricardopereira
Copy link
Contributor Author

@funkyboy I think it's not a big deal. This won't affect users because it only affects tests and even so this is still in beta, from what I know.

@funkyboy
Copy link
Contributor

funkyboy commented Jun 14, 2018

@ricardopereira FYI I cherry-picked this commit 1845218 to both push and push-channels. Now Travis kicks in.

UPDATE: Sorry, I cherry-picked the commit ONLY to push. Feel free to propagate it as you see fit.

@funkyboy
Copy link
Contributor

@ricardopereira also, there's a consistent failure on this line https://github.com/ably/ably-ios/blob/push-channels/Spec/PushActivationStateMachine.swift#L584

Likely due to the fact that the previous test doesn't have a
defer { rest.device.setAndPersistIdentityTokenDetails(nil) }

@funkyboy
Copy link
Contributor

Rebased on push now.

@funkyboy funkyboy merged this pull request into push Jul 13, 2018
@funkyboy funkyboy deleted the push-channels branch July 13, 2018 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants