Skip to content

Commit

Permalink
Merge pull request #12 from randyzwitch/fbot/deps
Browse files Browse the repository at this point in the history
Fix deprecations
  • Loading branch information
randyzwitch authored Aug 13, 2017
2 parents 954a6a7 + 65e9d26 commit ae7b516
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/OAuth.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ oauth_request_resource

#Get current timestamp
function oauth_timestamp()
"$(@compat round(Int, time()))"
"$(round(Int, time()))"
end

#Generate random string
Expand Down Expand Up @@ -151,13 +151,11 @@ function oauth_request_resource(endpoint::AbstractString, httpmethod::AbstractSt
oauth_header_val = oauth_header(httpmethod, endpoint, options, oauth_consumer_key, oauth_consumer_secret, oauth_token, oauth_token_secret)

#Make request
headers = @compat(
Dict{AbstractString,AbstractString}(
headers = Dict{AbstractString,AbstractString}(
"Content-Type" => "application/x-www-form-urlencoded",
"Authorization" => oauth_header_val,
"Accept" => "*/*"
)
)

if uppercase(httpmethod) == "POST"
return Requests.post(URI(endpoint), query_str; headers = headers)
Expand Down
12 changes: 6 additions & 6 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ facts("oauth_timestamp") do
end

context("returns a value representing a time after 2014-01-25 20:25:00") do
@compat @fact parse(Int, oauth_timestamp()) > 1422235471 --> true
@fact parse(Int, oauth_timestamp()) > 1422235471 --> true
end
end

Expand Down Expand Up @@ -54,25 +54,25 @@ end

facts("oauth_percent_encode_keys!") do
context("replaces un-encoded keys with their encoded versions") do
params = @compat Dict("badkey!" => "value", "goodkey" => "value")
expected = @compat Dict("badkey%21" => "value", "goodkey" => "value")
params = Dict("badkey!" => "value", "goodkey" => "value")
expected = Dict("badkey%21" => "value", "goodkey" => "value")

@fact oauth_percent_encode_keys!(params) --> expected
end
end

facts("oauth_serialize_url_parameters") do
context("returns an & concatinated string of key=value") do
params = @compat Dict("language" => "julia", "result" => "awesome")
params = Dict("language" => "julia", "result" => "awesome")
expected = "language=julia&result=awesome"
@fact oauth_serialize_url_parameters(params) --> expected
end
end

facts("encodeURI!") do
context("escapes all values in the parameters that are strings") do
params = @compat Dict("iv" => 10, "s" => "value!")
expected = @compat Dict("iv" => 10, "s" => "value%21")
params = Dict("iv" => 10, "s" => "value!")
expected = Dict("iv" => 10, "s" => "value%21")

@fact encodeURI!(params) --> expected
end
Expand Down

0 comments on commit ae7b516

Please sign in to comment.