Skip to content

Commit c777827

Browse files
committed
filter sensitive data for vhr request, and verify all TRAVIS tests pass
1 parent b22db13 commit c777827

File tree

4 files changed

+46
-6
lines changed

4 files changed

+46
-6
lines changed

spec/models/account_spec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ def post_job_for(team)
5656

5757
end
5858
end
59-
59+
60+
# BUG: This request does not produce the same results out of two calls, under the Account cassette.
61+
# Something is stomping its request.
62+
# 1st call, under record all will pass this test
63+
# 2nd call, under new or none will fail, returning a previously recorded request
6064
it 'should not create an account if stripe_card_token invalid' do
6165
# TODO: Refactor api calls to Sidekiq job
62-
VCR.use_cassette("Account") do
66+
VCR.use_cassette("Account_Invalid") do
6367

6468
account[:stripe_card_token] = "invalid"
6569
team.build_account(account)
@@ -124,6 +128,10 @@ def post_job_for(team)
124128
end
125129
end
126130

131+
# BUG: This request does not produce the same results out of two calls.
132+
# 1st call, under record all will pass this test
133+
# 2nd call, under non will fail to match with previously recorded request
134+
# 3rd call, under new will record a worket set of data for this test
127135
it 'should allow upgrade to monthly subscription' do
128136
# TODO: Refactor api calls to Sidekiq job
129137
VCR.use_cassette("Account") do

spec/models/badges/ashcat_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
let(:contributor) { Fabricate(:user, github_id: profile.github_id, github: 'dhh') }
44

55
it 'creates facts for each contributor' do
6-
VCR.use_cassette('ashcat_creates_facts_for_each_contributor') do
7-
# TODO: Refactor to utilize sidekiq job
6+
# TODO: Refactor to utilize sidekiq job
7+
VCR.use_cassette('Ashcat') do
88
Ashcat.perform
99

1010
contributor.build_github_facts

spec/models/github_profile_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def response_body(file)
2626

2727
describe 'facts' do
2828
let (:profile) {
29-
VCR.use_cassette('github_profile_for_mdeiters') do
29+
VCR.use_cassette('GithubProfile') do
3030
GithubProfile.for_username('mdeiters')
3131
end
3232
}

spec/vcr_helper.rb

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ def record_mode
77
:all
88
when 'new'
99
:new_episodes
10+
when 'once'
11+
:once
1012
else
1113
:none
1214
end
@@ -19,5 +21,35 @@ def record_mode
1921
c.default_cassette_options = { record: record_mode }
2022
c.allow_http_connections_when_no_cassette = false
2123
c.configure_rspec_metadata!
22-
end
24+
25+
# Github
26+
c.filter_sensitive_data('<GITHUB_ADMIN_USER_PASSWORD>') { ENV['GITHUB_ADMIN_USER_PASSWORD'] }
27+
c.filter_sensitive_data('<GITHUB_CLIENT_ID>') { ENV['GITHUB_CLIENT_ID'] }
28+
c.filter_sensitive_data('<GITHUB_SECRET>') { ENV['GITHUB_SECRET'] }
29+
30+
# LinkedIn
31+
c.filter_sensitive_data('<LINKEDIN_KEY>') { ENV['LINKEDIN_KEY'] }
32+
c.filter_sensitive_data('<LINKEDIN_SECRET>') { ENV['LINKEDIN_SECRET'] }
33+
34+
# Mailgun
35+
c.filter_sensitive_data('<MAILGUN_API_KEY>') { ENV['MAILGUN_API_KEY'] }
36+
c.filter_sensitive_data('<MAILGUN_TOKEN>') { ENV['MAILGUN_TOKEN'] }
2337

38+
# Mixpanel
39+
c.filter_sensitive_data('<MIXPANEL_API_SECRET>') { ENV['MIXPANEL_API_SECRET'] }
40+
c.filter_sensitive_data('<MIXPANEL_TOKEN>') { ENV['MIXPANEL_TOKEN'] }
41+
42+
# Twitter
43+
c.filter_sensitive_data('<TWITTER_ACCOUNT_ID>') { ENV['TWITTER_ACCOUNT_ID'] }
44+
c.filter_sensitive_data('<TWITTER_CONSUMER_KEY>') { ENV['TWITTER_CONSUMER_KEY'] }
45+
c.filter_sensitive_data('<TWITTER_CONSUMER_SECRET>') { ENV['TWITTER_CONSUMER_SECRET'] }
46+
c.filter_sensitive_data('<TWITTER_OAUTH_SECRET>') { ENV['TWITTER_OAUTH_SECRET'] }
47+
c.filter_sensitive_data('<TWITTER_OAUTH_TOKEN>') { ENV['TWITTER_OAUTH_TOKEN'] }
48+
49+
# Stripe
50+
c.filter_sensitive_data('<STRIPE_PUBLISHABLE_KEY>') { ENV['STRIPE_PUBLISHABLE_KEY'] }
51+
c.filter_sensitive_data('<STRIPE_SECRET_KEY>') { ENV['STRIPE_SECRET_KEY'] }
52+
53+
# Akismet
54+
c.filter_sensitive_data('<AKISMET_KEY>') { ENV['AKISMET_KEY'] }
55+
end

0 commit comments

Comments
 (0)