-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Increase version for Femtocleaner * femtocleaning * Fix tests * Update appveyor.yml
- Loading branch information
1 parent
7e2fd9e
commit d529347
Showing
4 changed files
with
58 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
julia 0.7-alpha | ||
FactCheck | ||
MbedTLS | ||
HTTP 0.6.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,40 @@ | ||
using OAuth | ||
using FactCheck | ||
|
||
facts("oauth_timestamp") do | ||
context("returns a string") do | ||
@fact typeof(oauth_timestamp()) <: AbstractString --> true | ||
end | ||
|
||
context("returns a value representing a time after 2014-01-25 20:25:00") do | ||
@fact parse(Int, oauth_timestamp()) > 1422235471 --> true | ||
end | ||
end | ||
|
||
facts("ouath_nonce") do | ||
context("returns a string") do | ||
@fact typeof(oauth_nonce(15)) <: AbstractString --> true | ||
end | ||
|
||
context("with a length equal to the parameter length") do | ||
@fact length(oauth_nonce(15)) --> 15 | ||
@fact length(oauth_nonce(20)) --> 20 | ||
@fact length(oauth_nonce(25)) --> 25 | ||
@fact length(oauth_nonce(30)) --> 30 | ||
@fact length(oauth_nonce(32)) --> 32 | ||
end | ||
end | ||
|
||
facts("oauth_sign_hmac_sha1") do | ||
context("provides a consistent string") do | ||
expected = "dR8PcWvTl2FyvVM417iTe/p1XV8=" | ||
@fact oauth_sign_hmac_sha1("randy", "zwitch") --> expected | ||
end | ||
end | ||
|
||
facts("oauth_signing_key") do | ||
context("returns a concatenation of values, seperated by &") do | ||
result = oauth_signing_key("9djdj82h48djs9d2", "kkk9d7dh3k39sjv7") | ||
expected = "9djdj82h48djs9d2&kkk9d7dh3k39sjv7" | ||
@fact result --> expected | ||
end | ||
end | ||
|
||
facts("oauth_signature_base_string") do | ||
context("returns a concatinated and percent-encoded string") do | ||
result = oauth_signature_base_string( | ||
"POST", "http://example.com", "?julia=fast&lang=elegant" | ||
) | ||
expected = "POST&http%3A%2F%2Fexample.com&%3Fjulia%3Dfast%26lang%3Delegant" | ||
@fact result --> expected | ||
end | ||
end | ||
|
||
facts("oauth_percent_encode_keys!") do | ||
context("replaces un-encoded keys with their encoded versions") do | ||
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 = 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 = Dict("iv" => 10, "s" => "value!") | ||
expected = Dict("iv" => 10, "s" => "value%21") | ||
|
||
@fact encodeURI!(params) --> expected | ||
end | ||
end | ||
|
||
facts("oauth_body_hash_encode") do | ||
context("returns the base64 encoded SHA1 digest of the data") do | ||
result = oauth_body_hash_encode("Hello, World!") | ||
expected = "CgqfKmdylCVXq1NV12r0Qvj2XgE=" | ||
@fact result --> expected | ||
end | ||
end | ||
|
||
facts("oauth_body_hash_data") do | ||
context("returns a string of the oauth_body_hash key-value pair ") do | ||
result = oauth_body_hash_data("Hello, World!") | ||
encoded_hash = "CgqfKmdylCVXq1NV12r0Qvj2XgE=" | ||
expected = "oauth_body_hash=$encoded_hash" | ||
|
||
@fact result --> expected | ||
end | ||
end | ||
|
||
facts("oauth_body_hash_file") do | ||
context("returns a string of the oauth_body_hash key-value pair ") do | ||
test_file = joinpath(dirname(@__FILE__), "auth_body_hash_file.txt") | ||
result = oauth_body_hash_file(test_file) | ||
encoded_hash = "CgqfKmdylCVXq1NV12r0Qvj2XgE=" | ||
expected = "oauth_body_hash=$encoded_hash" | ||
|
||
@fact result --> expected | ||
end | ||
end | ||
using OAuth, Test | ||
|
||
|
||
#TODO | ||
#oauth_header() | ||
@test typeof(oauth_timestamp()) <: AbstractString | ||
|
||
@test parse(Int, oauth_timestamp()) > 1422235471 | ||
|
||
@test typeof(oauth_nonce(15)) <: AbstractString | ||
|
||
#TODO | ||
#oauth_request_resource() | ||
@test length(oauth_nonce(15)) == 15 | ||
@test length(oauth_nonce(20)) == 20 | ||
@test length(oauth_nonce(25)) == 25 | ||
@test length(oauth_nonce(30)) == 30 | ||
@test length(oauth_nonce(32)) == 32 | ||
|
||
@test oauth_sign_hmac_sha1("randy", "zwitch") == "dR8PcWvTl2FyvVM417iTe/p1XV8=" | ||
|
||
@test oauth_signing_key("9djdj82h48djs9d2", "kkk9d7dh3k39sjv7") == "9djdj82h48djs9d2&kkk9d7dh3k39sjv7" | ||
|
||
@test oauth_signature_base_string("POST", "http://example.com", "?julia=fast&lang=elegant") == | ||
"POST&http%3A%2F%2Fexample.com&%3Fjulia%3Dfast%26lang%3Delegant" | ||
|
||
@test oauth_percent_encode_keys!(Dict("badkey!" => "value", "goodkey" => "value")) == Dict("badkey%21" => "value", "goodkey" => "value") | ||
|
||
@test oauth_serialize_url_parameters(Dict("language" => "julia", "result" => "awesome")) == "language=julia&result=awesome" | ||
|
||
@test encodeURI!(Dict("iv" => 10, "s" => "value!")) == Dict("iv" => 10, "s" => "value%21") | ||
|
||
FactCheck.exitstatus() | ||
@test oauth_body_hash_encode("Hello, World!") == "CgqfKmdylCVXq1NV12r0Qvj2XgE=" | ||
|
||
@test oauth_body_hash_data("Hello, World!") == "oauth_body_hash=CgqfKmdylCVXq1NV12r0Qvj2XgE=" | ||
|
||
test_file = joinpath(dirname(@__FILE__), "auth_body_hash_file.txt") | ||
@test oauth_body_hash_file(test_file) == "oauth_body_hash=CgqfKmdylCVXq1NV12r0Qvj2XgE=" | ||
|
||
#TODO | ||
#oauth_header() | ||
|
||
#TODO | ||
#oauth_request_resource() |