Skip to content

Commit

Permalink
skipping twitter related tests (#362)
Browse files Browse the repository at this point in the history
Our twitter api key is broken, and twitter has been changing
how you can access tweets (one needs to be logged in). 
Because of that we are currently skipping twitter-related tests.
  • Loading branch information
vasconsaurus authored Jul 12, 2023
1 parent 2b34a24 commit 3d48a1f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions spec/requests/api/medias_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
end

it 'should return API limit reached error' do |example|
pending("twitter api key is not currently working")
assert_response_matches_metadata(example.metadata)

response_body = JSON.parse(response.body)
Expand Down
11 changes: 11 additions & 0 deletions test/controllers/medias_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def setup
end

test "should ask to refresh cache" do
skip("twitter api key is not currently working")
authenticate_with_token
get :index, params: { url: 'https://twitter.com/caiosba/status/742779467521773568', refresh: '1', format: :json }
first_parsed_at = Time.parse(JSON.parse(@response.body)['data']['parsed_at']).to_i
Expand All @@ -29,6 +30,7 @@ def setup
end

test "should not ask to refresh cache" do
skip("twitter api key is not currently working")
authenticate_with_token
get :index, params: { url: 'https://twitter.com/caiosba/status/742779467521773568', refresh: '0', format: :json }
first_parsed_at = Time.parse(JSON.parse(@response.body)['data']['parsed_at']).to_i
Expand Down Expand Up @@ -63,6 +65,7 @@ def setup
end

test "should return error message on hash if twitter url does not exist" do
skip("twitter api key is not currently working")
authenticate_with_token
get :index, params: { url: 'https://twitter.com/caiosba32153623', format: :json }
assert_response 200
Expand Down Expand Up @@ -112,6 +115,7 @@ def setup
end

test "should return error message on hash if twitter post url does not exist" do
skip("twitter api key is not currently working")
twitter_client, status, user = "" , "", ""
api={"error"=>{"message"=>"Twitter::Error::NotFound: 144 No status found with that ID.", "code"=>4}}
Media.any_instance.stubs(:twitter_client).returns(twitter_client)
Expand Down Expand Up @@ -216,6 +220,7 @@ def setup
end

test "should render custom HTML if provided by parser" do
skip("twitter api key is not currently working")
get :index, params: { url: 'https://twitter.com/caiosba/status/742779467521773568', format: :html }
assert_response :success
assert_match /twitter-tweet/, response.body
Expand Down Expand Up @@ -251,6 +256,7 @@ def setup
end

test "should clear cache for multiple URLs sent as array" do
skip("twitter api key is not currently working")
authenticate_with_token
url1 = 'http://ca.ios.ba'
url2 = 'https://twitter.com/caiosba/status/742779467521773568'
Expand Down Expand Up @@ -368,6 +374,7 @@ def setup
end

test "should not archive in any archiver when no archiver parameter is sent" do
skip("twitter api key is not currently working")
Media.any_instance.unstub(:archive_to_archive_org)

a = create_api_key application_settings: { 'webhook_url': 'https://example.com/webhook.php', 'webhook_token': 'test' }
Expand All @@ -387,6 +394,7 @@ def setup
end

test "should not archive when archiver parameter is none" do
skip("twitter api key is not currently working")
Media.any_instance.unstub(:archive_to_archive_org)
a = create_api_key application_settings: { 'webhook_url': 'https://example.com/webhook.php', 'webhook_token': 'test' }
WebMock.enable!
Expand Down Expand Up @@ -584,6 +592,7 @@ def setup
end

test "should add data url when on embed title metatag" do
skip("twitter api key is not currently working")
authenticate_with_token
twitter_client, status, user = "" , "", ""
api = {"full_text"=>"@InternetFF Our Meedani @WafHeikal will be joining the amazing line of participants at #IFF, come say hi and get a free trail to our verification tool @check" }
Expand Down Expand Up @@ -685,6 +694,7 @@ def setup
end

test "should cache json and html on file" do
skip("twitter api key is not currently working")
authenticate_with_token
url = 'https://twitter.com/meedan/status/1132948729424691201'
id = Media.get_id(url)
Expand Down Expand Up @@ -733,6 +743,7 @@ def setup
end

test "should return API limit reached error" do
skip("twitter api key is not currently working")
Twitter::REST::Client.any_instance.stubs(:user).raises(Twitter::Error::TooManyRequests)
Twitter::Error::TooManyRequests.any_instance.stubs(:rate_limit).returns(OpenStruct.new(reset_in: 123))

Expand Down
1 change: 1 addition & 0 deletions test/models/parser/page_item_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class PageItemIntegrationTest < ActiveSupport::TestCase
end

test "should parse url scheme https" do
skip("twitter api key is not currently working")
url = 'https://www.theguardian.com/politics/2016/oct/19/larry-sanders-on-brother-bernie-and-why-tony-blair-was-destructive'
m = create_media url: url
data = m.as_json
Expand Down
4 changes: 4 additions & 0 deletions test/models/parser/twitter_item_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class TwitterItemIntegrationTest < ActiveSupport::TestCase
test "should parse tweet" do
skip("twitter api key is not currently working")
m = create_media url: 'https://twitter.com/caiosba/status/742779467521773568'
data = m.as_json
assert_match 'I\'ll be talking in @rubyconfbr this year! More details soon...', data['title']
Expand All @@ -12,6 +13,7 @@ class TwitterItemIntegrationTest < ActiveSupport::TestCase
end

test "should parse valid link with spaces" do
skip("twitter api key is not currently working")
m = create_media url: ' https://twitter.com/caiosba/status/742779467521773568 '
data = m.as_json
assert_match 'I\'ll be talking in @rubyconfbr this year! More details soon...', data['title']
Expand All @@ -22,6 +24,7 @@ class TwitterItemIntegrationTest < ActiveSupport::TestCase
end

test "should fill in html when html parsing fails but API works" do
skip("twitter api key is not currently working")
url = 'https://twitter.com/codinghorror/status/1276934067015974912'
OpenURI.stubs(:open_uri).raises(OpenURI::HTTPError.new('','429 Too Many Requests'))
m = create_media url: url
Expand All @@ -48,6 +51,7 @@ class TwitterItemIntegrationTest < ActiveSupport::TestCase
end

test "should store oembed data of a twitter profile" do
skip("twitter api key is not currently working")
m = create_media url: 'https://twitter.com/meedan'
data = m.as_json

Expand Down
2 changes: 2 additions & 0 deletions test/models/parser/twitter_profile_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class TwitterProfileIntegrationTest < ActiveSupport::TestCase
test "should parse shortened URL" do
skip("twitter api key is not currently working")
m = create_media url: 'http://bit.ly/23qFxCn'
data = m.as_json
assert_equal 'https://twitter.com/caiosba', data['url']
Expand All @@ -14,6 +15,7 @@ class TwitterProfileIntegrationTest < ActiveSupport::TestCase
end

test "should store oembed data of a twitter profile" do
skip("twitter api key is not currently working")
m = create_media url: 'https://twitter.com/meedan'
data = m.as_json

Expand Down
3 changes: 3 additions & 0 deletions test/workers/archiver_worker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class ArchiverWorkerTest < ActiveSupport::TestCase

test "should update cache when video archiving fails the max retries" do
skip("twitter api key is not currently working")
Metrics.stubs(:schedule_fetching_metrics_from_facebook)
url = 'https://twitter.com/meedan/status/1202732707597307905'
m = create_media url: url
Expand All @@ -17,6 +18,7 @@ class ArchiverWorkerTest < ActiveSupport::TestCase
end

test "should update cache when Archive.org fails the max retries" do
skip("twitter api key is not currently working")
Media.any_instance.unstub(:archive_to_archive_org)
WebMock.enable!
allowed_sites = lambda{ |uri| uri.host != 'web.archive.org' }
Expand All @@ -43,6 +45,7 @@ class ArchiverWorkerTest < ActiveSupport::TestCase
end

test "should update cache when Archive.org raises since first attempt" do
skip("twitter api key is not currently working")
Media.any_instance.unstub(:archive_to_archive_org)
WebMock.enable!
allowed_sites = lambda{ |uri| uri.host != 'web.archive.org' }
Expand Down

0 comments on commit 3d48a1f

Please sign in to comment.