mirror of
https://github.com/internetee/registry.git
synced 2025-07-31 23:16:23 +02:00
Add test
This commit is contained in:
parent
3e3688358b
commit
261e2d3162
1 changed files with 25 additions and 0 deletions
25
test/integration/repp/v1/stats/market_share_test.rb
Normal file
25
test/integration/repp/v1/stats/market_share_test.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ReppV1StatsMarketShareTest < ActionDispatch::IntegrationTest
|
||||
def setup
|
||||
@user = users(:api_bestnames)
|
||||
token = Base64.encode64("#{@user.username}:#{@user.plain_text_password}")
|
||||
token = "Basic #{token}"
|
||||
|
||||
@auth_headers = { 'Authorization' => token }
|
||||
end
|
||||
|
||||
def test_shows_market_share_data
|
||||
get '/repp/v1/stats/market_share', headers: @auth_headers
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_response :ok
|
||||
assert_equal 1000, json[:code]
|
||||
assert_equal 'Command completed successfully', json[:message]
|
||||
|
||||
assert json[:data].is_a? Array
|
||||
assert json[:data][0].is_a? Hash
|
||||
assert_equal json[:data][0][:name], 'Best Names'
|
||||
assert json[:data][0][:selected]
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue