This repository has been archived by the owner on Jan 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from 18F/pass-access-token
Pass the access token to the upstream server
- Loading branch information
Showing
7 changed files
with
305 additions
and
9 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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
import ( | ||
"crypto/aes" | ||
"github.com/bmizerany/assert" | ||
"testing" | ||
) | ||
|
||
func TestEncodeAndDecodeAccessToken(t *testing.T) { | ||
const key = "0123456789abcdefghijklmnopqrstuv" | ||
const access_token = "my access token" | ||
c, err := aes.NewCipher([]byte(key)) | ||
assert.Equal(t, nil, err) | ||
|
||
encoded_token, err := encodeAccessToken(c, access_token) | ||
assert.Equal(t, nil, err) | ||
|
||
decoded_token, err := decodeAccessToken(c, encoded_token) | ||
assert.Equal(t, nil, err) | ||
|
||
assert.NotEqual(t, access_token, encoded_token) | ||
assert.Equal(t, access_token, decoded_token) | ||
} |
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
Oops, something went wrong.