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

RSA7a4 #433

Merged
merged 2 commits into from
Apr 29, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Spec/Auth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,31 @@ class Auth : QuickSpec {

expect(ARTRest(options: clientOptions).options.clientId).to(equal("String"))
}

// RSA7a4
it("ClientOptions#clientId takes precendence when a clientId value is provided in both ClientOptions#clientId and ClientOptions#defaultTokenParams") {
let options = AblyTests.clientOptions()
options.clientId = "john"
options.authCallback = { tokenParams, completion in
expect(tokenParams.clientId).to(equal(options.clientId))
completion(getTestToken(clientId: tokenParams.clientId), nil)
}
options.defaultTokenParams = ARTTokenParams(clientId: "tester")
let client = ARTRest(options: options)
let channel = client.channels.get("test")

expect(client.auth.clientId).to(equal("john"))
waitUntil(timeout: testTimeout) { done in
channel.publish(nil, data: "message") { error in
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't prove that it's using the right client ID for Auth operations. I think you should at least remove the key from options and set the authCallback, and check that the client ID passed to the authCallback is the right one.

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 e8f618e.

expect(error).to(beNil())
channel.history() { paginatedResult, error in
let message = paginatedResult!.items.first as! ARTMessage
expect(message.clientId).to(equal("john"))
done()
}
}
}
}

// RSA12
context("Auth#clientId attribute is null") {
Expand Down