feat: usos sign-in, private calendar feed and timetable archive
This commit is contained in:
commit
7d4e21f977
33 files changed
+3270
No files matched your search
@@ -0,0 +1,39 @@
|
||||
package usos
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSignatureMatchesPublishedVector(t *testing.T) {
|
||||
params := url.Values{
|
||||
"include_entities": {"true"},
|
||||
"status": {"Hello Ladies + Gentlemen, a signed OAuth request!"},
|
||||
"oauth_consumer_key": {"xvz1evFS4wEEPTGEFPHBog"},
|
||||
"oauth_nonce": {"kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg"},
|
||||
"oauth_signature_method": {"HMAC-SHA1"},
|
||||
"oauth_timestamp": {"1318622958"},
|
||||
"oauth_token": {"370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb"},
|
||||
"oauth_version": {"1.0"},
|
||||
}
|
||||
got := signature(
|
||||
"POST", "https://api.twitter.com/1.1/statuses/update.json", params,
|
||||
"kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw", "LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE",
|
||||
)
|
||||
if want := "hCtSmYh+iHYCEqBWrE7C7hYmtUk="; got != want {
|
||||
t.Fatalf("signature = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPercentEncode(t *testing.T) {
|
||||
cases := map[string]string{
|
||||
"studies|offline_access": "studies%7Coffline_access",
|
||||
"a b+c~d": "a%20b%2Bc~d",
|
||||
"Poznań": "Pozna%C5%84",
|
||||
}
|
||||
for in, want := range cases {
|
||||
if got := percentEncode(in); got != want {
|
||||
t.Errorf("percentEncode(%q) = %q, want %q", in, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user