-
Notifications
You must be signed in to change notification settings - Fork 141
Fitbit Integration Tests Setup
In order to set up the Fitbit Integration Tests you need a few things
- NUnit installed
- A free Fitbit developer account (dev.fitbit.com)
- A consumer key / consumer secret, created in the Fitbit Dev site.
You'll walk through the OAuth procedure using NUnit and a web browser to finally obtain a permanent auth token that can be used to continuously test your code to and from Fitbit.
Step 1 - Configuration.cs Copy / Paste
- ConsumerKey
- ConsumerSecret
Now in NUnit, run the test "Can_Retrieve_Access_Token_Authorization_Url", If you inputed the Fitbit keys correctly it should succeed.
- Switch over to the Text Output from that test
- Copy the URL that it has created. It should be something like: https://api.fitbit.com/oauth/authorize?oauth_token=e1f10ab90170d71712345667789004
- Follow the Fitbit login / authorize screens
Step 2 After you've authorized, Fitbit will redirect you back to a URL you provided. Notice the URL bar has new temporary keys, oauth_token=, and oauth_verifier=
This next part is time sensitive, maybe even just a minute to exchange oauth_token and oauth_verifier for permanent credentials. Copy and paste quickly.
- Paste oauth_token and oauth_verifer in the Step 2 section of Configuration.cs
- Run the test "Can_Retrieve_Access_Token_And_Access_Token_Secret"
- Switch to Text Output mode. You should see the permanent keys and your user id
- Paste all 3 in to the Step 3 section of Integration tests.
You're done! Integration tests should run.
NOTE: This is the best way I could find to distribute integration tests without giving away a key that could be used by whomever. If anyone has a suggestion for how to minimize this, I'm up for discussion.