Advertisement
nick_ponorets

tracker_smoth_spec

Jan 18th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. require 'spec_helper'
  2.  
  3. describe 'getCore tracker check' do
  4.  
  5. tracker_url = Airborne.configuration.tracker_url
  6. app1_url = Airborne.configuration.app1_url
  7. app2_url = Airborne.configuration.app2_url
  8. app3_url = Airborne.configuration.app3_url
  9. tracker_n_url = Airborne.configuration.tracker_n_url
  10.  
  11. appid_smooth = Airborne.configuration.appid_smooth
  12. vinject_smooth = Airborne.configuration.vinject_smooth
  13. beta = Airborne.configuration.beta
  14. udid = Airborne.configuration.udid
  15.  
  16. context 'CHECK_SMOOTH' do
  17. before(:all) do
  18. @tap = Airborne::TapcoreApi.new(tracker_n_url)
  19. @tap.get_core(tracker_n_url, vinject_smooth, beta, udid, appid_smooth)
  20. $smooth = json_body[:countries].empty?
  21. end
  22.  
  23. context 'RESPONSE' do
  24. it 'should be set' do
  25. expect(response).to_not be(nil)
  26. end
  27. end
  28.  
  29. context 'HEADERS' do
  30. it 'should be set' do
  31. puts "Response headers: #{headers}"
  32. expect(headers).to_not be(nil)
  33. end
  34.  
  35. it 'correct content-type' do
  36. expect_header('content-type', 'application/json; charset=utf-8')
  37. end
  38. end
  39.  
  40. context 'BODY' do
  41. it 'should be set' do
  42. puts "Response body size: #{body.size} B"
  43. expect(body).to_not be(nil)
  44. end
  45. end
  46.  
  47. context 'STATUS' do
  48. it 'should be set' do
  49. expect(status).to_not be(nil)
  50. end
  51.  
  52. it 'correct status' do
  53. expect_status 200
  54. end
  55. end
  56.  
  57. context 'JSON' do
  58. it 'should be set' do
  59. expect(body).to_not be(nil)
  60. end
  61.  
  62. it 'correct response code value' do
  63. expect(json_body[:vInject]).to eq(vinject_smooth)
  64. end
  65. end
  66.  
  67. context 'RESPONSE TIME' do
  68. it 'correct response time' do
  69. puts "Response time: #{response_time} sec"
  70. expect(response_time).to be < 20
  71. end
  72. end
  73. end
  74.  
  75. context 'SMOOTH_CORE_CHECK' do
  76. context 'SMOOTH_CORE_BY_TRACKER' do
  77. before(:all) do
  78. if $smooth
  79. @tap = Airborne::TapcoreApi.new(tracker_url)
  80. @tap.get_core(tracker_url, vinject_smooth, beta, udid, appid_smooth)
  81. end
  82. end
  83.  
  84. context 'RESPONSE' do
  85. it 'should be set' do
  86. if $smooth
  87. expect(response).to_not be(nil)
  88. end
  89. end
  90. end
  91.  
  92. context 'HEADERS' do
  93. it 'should be set' do
  94. puts "Response headers: #{headers}"
  95. if $smooth
  96. expect(headers).to_not be(nil)
  97. end
  98. end
  99.  
  100. it 'correct content-type' do
  101. if $smooth
  102. expect_header('content-type', 'text/html')
  103. end
  104. end
  105. end
  106.  
  107. context 'BODY' do
  108. it 'should be set' do
  109. puts "Response body size: #{body.size} B"
  110. if $smooth
  111. expect(body).to_not be(nil)
  112. end
  113. end
  114. end
  115.  
  116. context 'STATUS' do
  117. it 'should be set' do
  118. if $smooth
  119. expect(status).to_not be(nil)
  120. end
  121. end
  122.  
  123. it 'correct status' do
  124. if $smooth
  125. expect_status 200
  126. end
  127. end
  128. end
  129.  
  130. context 'JSON' do
  131. it 'should be set' do
  132. if $smooth
  133. expect(body).to_not be(nil)
  134. end
  135. end
  136.  
  137. it 'correct response code value' do
  138. if $smooth
  139. expect(json_body[:vInject]).to eq(vinject_smooth)
  140. end
  141. end
  142. end
  143.  
  144. context 'RESPONSE TIME' do
  145. it 'correct response time' do
  146. puts "Response time: #{response_time} sec"
  147. expect(response_time).to be < 20
  148. end
  149. end
  150. end
  151. end
  152. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement