How to use delete method of Airborne Package

Best Airborne code snippet using Airborne.delete

Ozone_Api_Specific_Functions.rb

Source:Ozone_Api_Specific_Functions.rb Github

copy

Full Screen

...54 response_code_validation("get")55 else56 #$log.info "Original headers: #{Airborne.configuration.headers} <br>"57 temp = Airborne.configuration.headers["Authorization"]58 Airborne.configuration.headers.delete("Authorization")59 Airborne.configuration.headers["Cookie"] = "#{$platform_session}"60 post "/web_setup/state",{"state" => "#{post_state}"}61 response_code_validation("get")62 #$log.info "Temp val: #{temp}"63 Airborne.configuration.headers["Authorization"] = temp64 Airborne.configuration.headers.delete("Cookie")65 $log.info "Val of header after restoring header to old val is: #{Airborne.configuration.headers} <br>"66 end67 end68 end69 def get_websetup_state(expected_state)70 it 'get state of web setup' do71 $log.info "Original headers: #{Airborne.configuration.headers} <br>"72 temp = Airborne.configuration.headers["Authorization"]73 Airborne.configuration.headers["Authorization"] = "Token token=#{$websetup_pin}"74 for i in 0..175 temp_headers = Airborne.configuration.headers76 # $log.info "global_etag: #{global_etag}"77 # etag_val = "#{global_etag}"78 # $log.info "etag_val: #{etag_val}"79 Airborne.configuration.headers["If-None-Match"] = "#{$etag}"80 #$log.info "Val of header is: #{Airborne.configuration.headers} <br>"81 api = '/web_setup/state'82 get api83 if $etag.empty?84 response_code_validation("get",api)85 expect_json('state',"#{expected_state}")86 #$log.info "Json response: #{json_body}"87 #$log.info "#{headers} <br>"88 $etag = headers["etag"]89 $log.info "$etag obtained is: #{$etag} <br>"90 else91 response_code_validation("notmod",api)92 $etag = ""93 end94 Airborne.configuration.headers.delete("If-None-Match")95 $log.info "Val of header after deleting 'if-none-match' is: #{Airborne.configuration.headers} <br>"96 end97 $log.info "Temp val: #{temp}"98 Airborne.configuration.headers["Authorization"] = temp99 #$log.info "Val of header after restoring header to old val is: #{Airborne.configuration.headers} <br>"100 end101 end102 def get_websetup_state_new(expected_state)103 it 'get state of web setup' do104 #$log.info "Original headers: #{Airborne.configuration.headers} <br>"105 temp = Airborne.configuration.headers["Authorization"]106 Airborne.configuration.headers.delete("Authorization")107 Airborne.configuration.headers["Cookie"] = "#{$platform_session}"108 for i in 0..1109 temp_headers = Airborne.configuration.headers110 # $log.info "global_etag: #{global_etag}"111 # etag_val = "#{global_etag}"112 # $log.info "etag_val: #{etag_val}"113 Airborne.configuration.headers["If-None-Match"] = "#{$etag}"114 puts "Val of header is: #{Airborne.configuration.headers} <br>"115 api = '/web_setup/state'116 get api117 if $etag.empty?118 response_code_validation("get",api)119 puts "Json response: #{json_body}"120 puts "#{headers} <br>"121 expect_json('state',"#{expected_state}")122 $etag = headers["etag"]123 puts "$etag obtained is: #{$etag} <br>"124 else125 response_code_validation("notmod",api)126 $etag = ""127 end128 Airborne.configuration.headers.delete("If-None-Match")129 puts "Val of header after deleting 'if-none-match' is: #{Airborne.configuration.headers} <br>"130 end131 #$log.info "Temp val: #{temp}"132 Airborne.configuration.headers["Authorization"] = temp133 Airborne.configuration.headers.delete("Cookie")134 puts "Val of header after restoring header to old val is: #{Airborne.configuration.headers} <br>"135 end136 end137 def get_tinyurl_from_cloud()138 it 'get tinyurl link from cloud(box call)' do139 api = '/switches/pin?shorten_url=true&'140 get api141 response_code_validation("get",api)142 puts "#{json_body} <br>"143 $tiny_url = json_body[:url]144 $websetup_pin = json_body[:pin]145 puts "Tinyurl obtained from cloud is: #{$tiny_url} <br>"146 #$log.info "#{headers} <br>"147 end148 end149 def launch_tinyurl(workflow)150 it 'launching websetup url' do151 if workflow == "negative"152 sleep(180)153 expected_response_code = 404154 else155 expected_response_code = 200156 end157 temp_base_url = Airborne.configuration.base_url158 temp_headers = Airborne.configuration.headers159 #$log.info "Airborne Base url is: #{Airborne.configuration.base_url} is stored temporarily. <br>"160 Airborne.configuration.base_url = nil161 Airborne.configuration.headers = nil162 #$log.info "Airborne Base url overwritten <br>"163 get $tiny_url164 response_code_validation("get", $tiny_url)165 # if workflow == "negative"166 # expect_status("404")167 # else168 # response_code_validation("get")169 # end170 Airborne.configuration.base_url = temp_base_url171 Airborne.configuration.headers = temp_headers172 #$log.info "Airborne Base url is restored <br>"173 end174 end175 def launch_setup(workflow)176 it 'launching websetup url' do177 if workflow == "negative"178 sleep(180)179 expected_response_code = 404180 else181 expected_response_code = 200182 end183 temp_base_url = Airborne.configuration.base_url184 temp_headers = Airborne.configuration.headers185 #$log.info "Airborne Base url is: #{Airborne.configuration.base_url} is stored temporarily. <br>"186 Airborne.configuration.base_url = nil187 Airborne.configuration.headers = nil188 #$log.info "Airborne Base url overwritten <br>"189 get $tiny_url190 response_code_validation("get", $tiny_url)191 #expect_status(expected_response_code)192 #puts "#{body}"193 #puts "#{headers}"194 #puts "#{headers["set_cookie"][0]}"195 $platform_session = headers["set_cookie"][0]196 puts "Cookie-Platform Session is: #{$platform_session}"197 #puts "#{json_body}"198 Airborne.configuration.base_url = temp_base_url199 Airborne.configuration.headers = temp_headers200 #$log.info "Airborne Base url is restored <br>"201 end202 end203 def post_pin_during_setup()204 it 'posts pin during websetup' do 205 #temp = Airborne.configuration.headers["Authorization"]206 Airborne.configuration.headers["Cookie"] = "#{$platform_session}"207 req_body = {"pin[pin]" => "#{$websetup_pin}"}208 puts "req body is: #{req_body}"209 post '/setup',req_body210 response_code_validation("get")211 puts "#{response}"212 puts "#{headers}"213 #puts "#{json_body}"214 Airborne.configuration.headers.delete("Cookie")215 end216 end217 def delete_all_extern_accs()218 it "should validate response of '/extern_account/delete_all' api" do219 delete '/extern_account/delete_all',{}220 # 1.Response Code Validation221 response_code_validation("get")222 #$log.info "Completed response code validation<br>"223 end224 end225 def post_services_switch_profile(services)226 it "should post services to switch which were selected during web setup" do227 req_body = ""228 #$log.info "Original headers: #{Airborne.configuration.headers} <br>"229 temp = Airborne.configuration.headers["Authorization"]230 Airborne.configuration.headers["Authorization"] = "Token token=#{$websetup_pin}"231 #Airborne.configuration.headers["Authorization"] = "Token token=da94"232 #$log.info "Val of header after modifying authorization key with the websetup pin' is: #{Airborne.configuration.headers}"233 if services == "all"234 $log.info "inside services=all"235 req_body = {"services" => ['amazon','hbogo','hulu','showtimeanytime','showtime','hbonow','vudu','youtube','netflixusa']}236 else237 req_body = {"services" => [services]}238 end239 post '/switches/profiles', req_body240 response_code_validation("get")241 #Airborne.configuration.headers.delete("Authorization")242 #$log.info "Temp val: #{temp}"243 Airborne.configuration.headers["Authorization"] = temp244 #$log.info "Val of header after restoring header to old val is: #{Airborne.configuration.headers} <br>"245 end246 end247 def post_services_switch_profile_new(services)248 it "should post services to switch which were selected during web setup" do249 req_body = ""250 #$log.info "Original headers: #{Airborne.configuration.headers} <br>"251 # temp = Airborne.configuration.headers["Authorization"]252 # Airborne.configuration.headers.delete("Authorization")253 # #Airborne.configuration.headers["Authorization"] = "Token token=#{$websetup_pin}"254 # Airborne.configuration.headers["Cookie"] = "#{$platform_session}"255 #Airborne.configuration.headers["Authorization"] = "Token token=da94"256 #$log.info "Val of header after modifying authorization key with the websetup pin' is: #{Airborne.configuration.headers}"257 if services == "all"258 $log.info "inside services=all"259 req_body = {"services" => ['amazon','hbogo','hulu','showtimeanytime','showtime','hbonow','vudu','youtube','netflixusa']}260 else261 req_body = {"services" => [services]}262 end263 post '/switches/profiles', req_body264 response_code_validation("get")265 # Airborne.configuration.headers.delete("Cookie")266 #$log.info "Temp val: #{temp}"267 # Airborne.configuration.headers["Authorization"] = temp268 #$log.info "Val of header after restoring header to old val is: #{Airborne.configuration.headers} <br>"269 end270 end271 def get_services_switch_profile(services)272 it "should get services selected during web setup" do273 api = '/switches/profiles'274 get api275 response_code_validation("get",api)276 #$log.info "#{json_body} <br>"277 if services == "all"278 expect_json("services",['amazon','hbogo','hulu','showtimeanytime','showtime','hbonow','vudu','youtube','netflixusa'])279 else280 req_body = {"services" => [services]}281 end282 #services_ = json_body[:services]283 end284 end285 def get_services_switch_profile_new(services)286 it "should get services selected during web setup" do287 get '/switches/profiles'288 response_code_validation("get")289 #$log.info "#{json_body} <br>"290 if services == "all"291 expect_json("services",['amazon','hbogo','hulu','showtimeanytime','showtime','hbonow','vudu','youtube','netflixusa'])292 else293 req_body = {"services" => [services]}294 end295 #services_ = json_body[:services]296 end297 end298 def post_externaccs_old(type)299 it "should post externaccs" do300 #Load the yml file which contains the test data301 test_data = YAML.load_file('spec/all_externacc_creation_spec/post_externaccs_testdata_old.yml')302 #Get the testdata303 completedata = test_data['testdata']304 reset_test_variables()305 datasets = completedata.keys306 if type == "websetup"307 #puts "Original headers: #{Airborne.configuration.headers} <br>"308 temp = Airborne.configuration.headers["Authorization"]309 Airborne.configuration.headers["Authorization"] = "Token token=#{$websetup_pin}"310 #puts "Val of header after modifying authorization key with the websetup pin' is: #{Airborne.configuration.headers}"311 elsif type == "websetup_new"312 temp = Airborne.configuration.headers["Authorization"]313 Airborne.configuration.headers.delete("Authorization")314 Airborne.configuration.headers["Cookie"] = "#{$platform_session}"315 end316 datasets.each do |individual_dataset|317 318 begin319 dataset = completedata[individual_dataset]320 service_name = dataset['service_name']321 #Form the complete api url322 api = dataset['api']323 api_url = $base_url + api324 #Get the request body325 req_body = dataset['request_body']326 req_body_class = req_body.class327 #puts "Request body class : #{req_body_class}<br>"328 #puts "Request body is : #{req_body}<br>"329 $total_count = $total_count + 1330 puts "Total count: #{$total_count}<br>"331 puts "The complete url to be tested is - #{api_url}<br>"332 post api, req_body333 # 1.Response Code Validation334 response_code_validation("post")335 puts "Completed response code validation<br>"336 $resp_code_validation_status = true337 338 rescue Exception => exp_err339 exception_handling(exp_err,dataset,api_url)340 ensure341 reset_iteration_variables()342 end343 pass_or_fail_test_based_on_exceptions_caught(api_url)344 end345 if type == "websetup"346 #puts "Temp val: #{temp}"347 Airborne.configuration.headers["Authorization"] = temp348 #puts "Val of header after restoring header to old val is: #{Airborne.configuration.headers} <br>"349 elsif type == "websetup_new"350 Airborne.configuration.headers.delete("Cookie")351 Airborne.configuration.headers["Authorization"] = temp352 end353 end354 end355 def post_externaccs(type)356 it "should post externaccs" do357 #Load the yml file which contains the test data358 test_data = YAML.load_file('spec/all_externacc_creation_spec/post_externaccs_testdata.yml')359 #Get the testdata360 completedata = test_data['testdata']361 reset_test_variables()362 datasets = completedata.keys363 if type == "websetup"364 #$log.info "Original headers: #{Airborne.configuration.headers} <br>"365 temp = Airborne.configuration.headers["Authorization"]366 Airborne.configuration.headers["Authorization"] = "Token token=#{$websetup_pin}"367 #$log.info "Val of header after modifying authorization key with the websetup pin' is: #{Airborne.configuration.headers}"368 elsif type == "websetup_new"369 temp = Airborne.configuration.headers["Authorization"]370 Airborne.configuration.headers.delete("Authorization")371 Airborne.configuration.headers["Cookie"] = "#{$platform_session}"372 end373 datasets.each do |individual_dataset|374 375 begin376 dataset = completedata[individual_dataset]377 service_name = dataset['service_name']378 #Form the complete api url379 api = dataset['api']380 api_url = $base_url + api381 #Get the request body382 req_body = dataset['request_body']383 req_body_class = req_body.class384 service_providers = req_body.keys385 if service_providers.length == 1386 #$log.info "Request body class : #{req_body_class}<br>"387 #$log.info "Request body is : #{req_body}<br>"388 $total_count = $total_count + 1389 $log.info "Total count: #{$total_count}<br>"390 $log.info "The complete url to be tested is - #{api_url}<br>"391 post api, req_body392 # 1.Response Code Validation393 response_code_validation("post")394 $log.info "Completed response code validation<br>"395 $resp_code_validation_status = true396 elsif service_providers.length == 3397 service_providers.each do |serv_provider|398 $log.info "Service provider is: #{serv_provider}"399 req_body_individual = req_body[serv_provider]400 set_auth_token_in_req_header(serv_provider)401 $total_count = $total_count + 1402 $log.info "Total count: #{$total_count}<br>"403 $log.info "The complete url to be tested is - #{api_url}<br>"404 post api, req_body_individual405 # 1.Response Code Validation406 response_code_validation("post")407 $log.info "Completed response code validation<br>"408 $resp_code_validation_status = true409 end410 set_auth_token_in_req_header("directv")411 end412 413 rescue Exception => exp_err414 exception_handling(exp_err,dataset,api_url)415 ensure416 reset_iteration_variables()417 end418 pass_or_fail_test_based_on_exceptions_caught(api_url)419 end420 if type == "websetup"421 #$log.info "Temp val: #{temp}"422 Airborne.configuration.headers["Authorization"] = temp423 #$log.info "Val of header after restoring header to old val is: #{Airborne.configuration.headers} <br>"424 elsif type == "websetup_new"425 Airborne.configuration.headers.delete("Cookie")426 Airborne.configuration.headers["Authorization"] = temp427 end428 end429 end430 def retry_post_extern_acc_old(array_of_failed_login_attempts)431 # it 'retry posting extern account which failed previously' do432 #Load the yml file which contains the test data433 puts "Inside retry post, loading yaml file"434 test_data = YAML.load_file('spec/all_externacc_creation_spec/post_externaccs_testdata.yml')435 puts "Array of failed services login: #{array_of_failed_login_attempts} "436 #Get the testdata437 completedata = test_data['testdata']438 reset_test_variables()439 datasets = completedata.keys440 441 datasets.each do |individual_dataset|442 puts "Inside each do loop"443 dataset = completedata[individual_dataset]444 service_name = dataset['service_name']445 puts "Current service to be posted is: #{service_name}" 446 if !array_of_failed_login_attempts.include? service_name447 puts "#{service_name} has been successfully logged into, hence going to next service without posting account once again"448 next449 else450 puts "#{service_name} had login failed status, hence going to post credentials once again"451 end452 #begin453 454 #Form the complete api url455 api = dataset['api']456 api_url = $base_url + api457 #Get the request body458 req_body = dataset['request_body']459 req_body_class = req_body.class460 #puts "Request body class : #{req_body_class}<br>"461 #puts "Request body is : #{req_body}<br>"462 $total_count = $total_count + 1463 puts "Total count: #{$total_count}<br>"464 puts "The complete url to be tested is - #{api_url}<br>"465 post api, req_body466 # 1.Response Code Validation467 response_code_validation("post")468 puts "Completed response code validation<br>"469 $resp_code_validation_status = true470 471 # rescue Exception => exp_err472 # exception_handling(exp_err,dataset,api_url)473 # ensure474 # reset_iteration_variables()475 # end476 # pass_or_fail_test_based_on_exceptions_caught(api_url)477 end478 #end479 end480 def retry_post_extern_acc(array_of_failed_login_attempts)481 # it 'retry posting extern account which failed previously' do482 #Load the yml file which contains the test data483 $log.info "Inside retry post, loading yaml file"484 test_data = YAML.load_file('spec/all_externacc_creation_spec/post_externaccs_testdata.yml')485 $log.info "Array of failed services login: #{array_of_failed_login_attempts}"486 #Get the testdata487 completedata = test_data['testdata']488 reset_test_variables()489 datasets = completedata.keys490 491 datasets.each do |individual_dataset|492 $log.info "Inside each do loop"493 dataset = completedata[individual_dataset]494 service_name = dataset['service_name']495 $log.info "Current service to be posted is: #{service_name}" 496 array_of_failed_login_attempts.each do |ind_hash|497 serv_prov = ind_hash.keys[0]498 arr_of_failed_logins = ind_hash[serv_prov]499 if !arr_of_failed_logins.include? service_name500 $log.info "#{service_name} has been successfully logged into, hence going to next service without posting account once again"501 next502 else503 $log.info "#{service_name} had login failed status, hence going to post credentials once again"504 end505 #begin506 $log.info "Service provider is: #{serv_prov}"507 req_body = dataset['request_body']508 req_body_individual = req_body[serv_provider]509 set_auth_token_in_req_header(serv_provider)510 #Form the complete api url511 api = dataset['api']512 api_url = $base_url + api513 $total_count = $total_count + 1514 $log.info "Total count: #{$total_count}<br>"515 $log.info "The complete url to be tested is - #{api_url}<br>"516 post api, req_body_individual517 # 1.Response Code Validation518 response_code_validation("post")519 $log.info "Completed response code validation<br>"520 $resp_code_validation_status = true521 end522 set_auth_token_in_req_header("directv")523 # rescue Exception => exp_err524 # exception_handling(exp_err,dataset,api_url)525 # ensure526 # reset_iteration_variables()527 # end528 # pass_or_fail_test_based_on_exceptions_caught(api_url)529 end530 #end531 end532 # def retry_post_extern_acc(array_of_failed_login_attempts)533 # # it 'retry posting extern account which failed previously' do534 # #Load the yml file which contains the test data535 # $log.info "Inside retry post, loading yaml file"536 # test_data = YAML.load_file('spec/all_externacc_creation_spec/post_externaccs_testdata.yml')537 # $log.info "Array of failed services login: #{array_of_failed_login_attempts}"538 # #Get the testdata539 # completedata = test_data['testdata']540 # reset_test_variables()541 # datasets = completedata.keys542 543 # datasets.each do |individual_dataset|544 # $log.info "Inside each do loop"545 # dataset = completedata[individual_dataset]546 # service_name = dataset['service_name']547 # $log.info "Current service to be posted is: #{service_name}" 548 # array_of_failed_login_attempts.each do |ind_hash|549 # serv_prov = ind_hash.keys[0]550 # arr_of_failed_logins = ind_hash[serv_prov]551 # if !arr_of_failed_logins.include? service_name552 # $log.info "#{service_name} has been successfully logged into, hence going to next service without posting account once again"553 # next554 # else555 # $log.info "#{service_name} had login failed status, hence going to post credentials once again"556 # end557 # #begin558 # $log.info "Service provider is: #{serv_prov}"559 # req_body = dataset['request_body']560 # req_body_individual = req_body[serv_provider]561 # set_auth_token_in_req_header(serv_provider)562 # #Form the complete api url563 # api = dataset['api']564 # api_url = $base_url + api565 # $total_count = $total_count + 1566 # $log.info "Total count: #{$total_count}<br>"567 # $log.info "The complete url to be tested is - #{api_url}<br>"568 # post api, req_body_individual569 # # 1.Response Code Validation570 # response_code_validation("post")571 # $log.info "Completed response code validation<br>"572 # $resp_code_validation_status = true573 # end574 # set_auth_token_in_req_header("directv")575 # # rescue Exception => exp_err576 # # exception_handling(exp_err,dataset,api_url)577 # # ensure578 # # reset_iteration_variables()579 # # end580 # # pass_or_fail_test_based_on_exceptions_caught(api_url)581 # end582 # #end583 # end584 def get_externacc_login_status_old()585 retry_attempt = 0586 it "should validate the login status of various services" do587 begin588 timestamp = Time.now.strftime("%d_%m_%Y_%H:%M")589 puts "#{timestamp}: Sleeping for 3 mins for login crawlers to complete<br>"590 sleep(180)591 api = '/extern_account'592 get api593 response_code_validation("get",api)594 puts "JSON response is: #{json_body} <br><br>"595 resp = json_body596 expect_json("*.login_status", "login_success")597 rescue Exception => exp598 puts "Increment of retry attempt"599 retry_attempt = retry_attempt + 1600 array_to_retry_extern_acc_post = populate_array_of_failed_services(resp)601 puts "Services to retry posting: #{array_to_retry_extern_acc_post}"602 retry_post_extern_acc(array_to_retry_extern_acc_post)603 sleep(20)604 if retry_attempt < 3605 puts "Retry attempt is lt 3, retrying again"606 retry607 else608 retry_attempt = 0609 raise "Extern acc login failure for the following services : #{array_to_retry_extern_acc_post}"610 end611 end612 end613 end614 def get_externacc_login_status()615 it "should validate the login status of various services" do616 timestamp = Time.now.strftime("%d_%m_%Y_%H:%M")617 array_to_retry_extern_acc_post = Array.new618 resp = nil619 wait_time = false620 (1..3).each do |i|621 $log.info "i try: #{i}"622 $all_service_providers.each do |serv_prov|623 begin624 if !wait_time625 $log.info "#{timestamp}: Sleeping for 3 mins for login crawlers to complete<br>"626 sleep(180)627 wait_time = true628 end629 set_auth_token_in_req_header(serv_prov)630 get '/extern_account'631 response_code_validation("get",'/extern_account')632 $log.info "JSON response is: #{json_body} <br><br>"633 resp = json_body634 expect_json("*.login_status", "login_success")635 rescue Exception => exp636 $log.info "Increment of retry attempt"637 populated_hash = populate_hash_of_failed_services(serv_prov,resp)638 if !populated_hash.empty?639 array_to_retry_extern_acc_post.push(populated_hash)640 end641 end642 $log.info "array_to_retry_extern_acc_post inside second loop: #{array_to_retry_extern_acc_post}"643 next644 end645 $log.info "array_to_retry_extern_acc_post inside first loop: #{array_to_retry_extern_acc_post}"646 if !array_to_retry_extern_acc_post.empty?647 retry_post_extern_acc(array_to_retry_extern_acc_post)648 $log.info "Services to retry posting: #{array_to_retry_extern_acc_post}"649 sleep(5)650 if i < 3651 $log.info "Retry attempt is lt 3, retrying again"652 wait_time = false653 timestamp = Time.now.strftime("%d_%m_%Y_%H:%M")654 array_to_retry_extern_acc_post = Array.new655 next656 else657 raise "Extern acc login failure for the following services : #{array_to_retry_extern_acc_post}"658 end659 else660 $log.info "Done with test"661 set_auth_token_in_req_header("directv")662 break663 end664 end665 end666 end667 def populate_hash_of_failed_services(serv_provider=nil,response)668 hash_of_failed_login_services = {}669 array_of_failed_login_services = Array.new670 resp_length = response.length671 for i in 0..resp_length-1672 status = response[i][:login_status]673 if status != "login_success"674 if status == "login_failed" or status == "captcha_asked"675 serv_name = response[i][:service]676 $log.info "Login status #{response[i][:login_status]} is seen for: #{serv_name} app with service provider #{serv_provider}"677 array_of_failed_login_services.push(serv_name)678 end679 end680 end681 if !array_of_failed_login_services.empty?682 hash_of_failed_login_services[serv_provider] = array_of_failed_login_services683 end684 hash_of_failed_login_services685 end686 def delete_tinyurl()687 it 'delete tinyurl link' do688 # $log.info "Original headers: #{Airborne.configuration.headers} <br>"689 temp = Airborne.configuration.headers["Authorization"]690 Airborne.configuration.headers["Authorization"] = "Token token=#{$websetup_pin}"691 #$log.info "Val of header after modifying authorization key with the websetup pin' is: #{Airborne.configuration.headers}"692 delete '/switches/pin'693 response_code_validation("get")694 # $log.info "Temp val: #{temp}"695 Airborne.configuration.headers["Authorization"] = temp696 #$log.info "Val of header after restoring header to old val is: #{Airborne.configuration.headers} <br>"697 end698 end699 def search_for_program_and_return_prog_id(program_name,log)700 begin701 search_api = "/voice_command?version=3&query=" + program_name702 get search_api703 #$log.info "Response is: #{json_body}"704 ott_search_index = get_index_of_ott_search_object(json_body)705 ott_search_resp = json_body[ott_search_index][:results]706 resp_len = ott_search_resp.length707 for i in 0..resp_len-1708 prog_obj = ott_search_resp[i][:object]709 if prog_obj[:long_title].casecmp(program_name).zero? and prog_obj[:show_type] == "SM"710 $log.info "Search successful and this series is available in cloud"711 prog_id = prog_obj[:id]712 break713 elsif i == resp_len-1714 $log.info "Program not available in cloud"715 prog_id = nil716 end717 end718 prog_id719 rescue Exception => ex720 #$log.info "Error!!!: #{ex} <br>"721 #log.error "Exception caught in iteration #{iter}!!!: #{ex} <br>"722 $log.info "Backtrace: #{ex.backtrace}<br>"723 log.error "Exception!!!: #{ex} <br"724 rescue Error => err725 #$log.info "Error!!!: #{ex} <br>"726 #log.error "Error in iteration #{iter}!!!: #{err} <br>"727 #$log.info "Backtrace: #{ex.backtrace}<br>"728 log.error "Error!!!: #{err} <br"729 end730 end731 def comprehensive_search_for_series_and_return_prog_id(program_name,service_name,year,seasons_on_portal,log)732 arr_matching_progs = Array.new733 search_term = program_name734 search_term=search_term.gsub(/[&]/, 'and')735 search_term=search_term.gsub(" ", '%20')736 search_term=search_term.gsub("'","%27")737 search_api = "/voice_search?q=" + search_term738 get search_api739 response_code_validation("get",search_api)740 program_name=program_name.downcase741 program_name = prepare_for_search_comparison(program_name)742 log.info "program_name after processing: #{program_name}"743 744 if !json_body.empty?745 log.info "Response is: #{json_body}"746 ott_search_index = get_index_of_ott_search_object(json_body,log)747 ott_search_resp = json_body[ott_search_index][:results]748 progids = Array.new749 resp_len = ott_search_resp.length750 for i in 0..resp_len-1751 log.info "For loop: To find matching programs by title"752 prog_obj = ott_search_resp[i][:object]753 long_title=prog_obj[:long_title].downcase754 long_title = prepare_for_search_comparison(long_title)755 log.info "long_title after processing: #{long_title}"756 original_title=prog_obj[:original_title].downcase757 original_title = prepare_for_search_comparison(original_title)758 log.info "original_title after processing: #{original_title}"759 760 alias_title=prog_obj[:alias_title].downcase761 alias_title = prepare_for_search_comparison(alias_title)762 log.info "alias_title after processing: #{alias_title}"763 764 show_type = prog_obj[:show_type]765 if (long_title.include? program_name or original_title.include? program_name or alias_title.include? program_name) and (show_type == "SM" or show_type == "SE")766 log.info "Search successful and this series is available in cloud"767 if show_type == "SM"768 prog_id = prog_obj[:id]769 rel_year = prog_obj[:release_year]770 seas_cnt = prog_obj[:season_cnt]771 elsif show_type == "SE"772 prog_id = prog_obj[:series_id]773 if progids.include? prog_id774 next775 end776 prog_api = "/programs/#{prog_id}"777 get prog_api778 response_code_validation("get",prog_api)779 rel_year = json_body[0][:release_year]780 seas_cnt = json_body[0][:season_cnt]781 end782 progids.push(prog_id)783 arr_matching_progs.push([prog_id,rel_year,seas_cnt])784 # if !arr_matching_progs.include? [prog_id,rel_year,seas_cnt]785 # arr_matching_progs.push([prog_id,rel_year,seas_cnt])786 # #break787 # end788 # elsif i == resp_len-1789 # $log.info "Program not available in cloud"790 # prog_id = nil791 end792 end793 log.info "END OF For loop: To find matching programs by title"794 matches_len = arr_matching_progs.length795 if matches_len == 0796 log.info "No matches found, prog id - nil"797 prog_id = nil798 elsif matches_len == 1799 log.info "Exactly 1 match found, program id to be returned is :#{arr_matching_progs[0][0]}"800 prog_id = arr_matching_progs[0][0]801 else802 log.info "More than one matching program by title, go deeper to find match"803 arr_matching_progs_after_rel_year_comp = Array.new804 for i in 0..matches_len-1805 log.info "For loop: To find matching programs by release year"806 # service_name807 # if series_name.include? "netflix"808 # approx_release_year = year.to_i - seasons_on_portal.to_i + 1809 # elsif series_name =="showtime"810 # approx_release_year = year.to_i811 # end812 if !service_name.nil? and service_name.include? "netflix"813 approx_release_year = year.to_i - seasons_on_portal.to_i + 1814 elsif !service_name.nil? and service_name =="showtime"815 approx_release_year = year.to_i816 else817 approx_release_year = year.to_i818 end819 approx_release_year_range = Array.new820 approx_release_year_range.push(approx_release_year)821 approx_release_year_range.push(approx_release_year+1)822 approx_release_year_range.push(approx_release_year-1)823 rel_year_of_match = arr_matching_progs[i][1]824 if approx_release_year_range.include? rel_year_of_match825 log.info "Approx release year match, push to array of programs matched by approx release year"826 arr_matching_progs_after_rel_year_comp.push(arr_matching_progs[i])827 end828 end829 log.info "END OF For loop: To find matching programs by release year"830 matches_after_rel_year_comp_len = arr_matching_progs_after_rel_year_comp.length831 if matches_after_rel_year_comp_len == 1832 log.info "1 program got after approx release year match, return prog if as #{arr_matching_progs_after_rel_year_comp[0][0]}"833 prog_id = arr_matching_progs_after_rel_year_comp[0][0]834 else835 if matches_after_rel_year_comp_len == 0836 log.info "No matches found by approx release year, proceed to approx season count check atleast"837 arr_matching_progs_after_seas_cnt_comp = Array.new838 approx_seas_cnt_range = Array.new839 for i in 0..matches_len-1840 #$log.info "For loop: To find matching programs by season count, if release year matches were not found"841 log.info "For loop: To find matching programs by season count, if release year matches were not found"842 sn_cnt = seasons_on_portal.to_i843 approx_seas_cnt_range.push(sn_cnt)844 approx_seas_cnt_range.push(sn_cnt+1)845 approx_seas_cnt_range.push(sn_cnt-1)846 seas_cnt_of_match = arr_matching_progs[i][2]847 if approx_seas_cnt_range.include? seas_cnt_of_match848 #$log.info "Approx season count match, push to array of programs matched by approx season count"849 log.info "Approx season count match, push to array of programs matched by approx season count"850 arr_matching_progs_after_seas_cnt_comp.push(arr_matching_progs[i])851 end852 end853 #$log.info "END OF For loop: To find matching programs by season count, if release year matches were not found"854 log.info "END OF For loop: To find matching programs by season count, if release year matches were not found"855 if arr_matching_progs_after_seas_cnt_comp.length > 0856 #$log.info "Programs matched by approx season count is 1 or more, take the first object as program id"857 log.info "Programs matched by approx season count is 1 or more, take the first object as program id"858 prog_id = arr_matching_progs_after_seas_cnt_comp[0][0]859 else860 #$log.info "Could match by season count too, even after no match was found by approx release year, return prog id as nil"861 log.info "Could'nt match by season count too, even after no match was found by approx release year, return prog id as nil"862 prog_id = nil863 end864 else865 log.info "More than 1 matches found by approx release year check, proceed to approx season count check."866 final_matching_progs = Array.new867 approx_seas_cnt_range = Array.new868 for i in 0..matches_after_rel_year_comp_len-1869 log.info "For loop: To find matching programs by season count, when more than 1 release year matches were found"870 sn_cnt = seasons_on_portal.to_i871 approx_seas_cnt_range.push(sn_cnt)872 approx_seas_cnt_range.push(sn_cnt+1)873 approx_seas_cnt_range.push(sn_cnt-1)874 seas_cnt_of_match = arr_matching_progs_after_rel_year_comp[i][2]875 if approx_seas_cnt_range.include? seas_cnt_of_match876 #$log.info "Match found with approx season count, push to array of final matching progs"877 log.info "Match found with approx season count, push to array of final matching progs"878 final_matching_progs.push(arr_matching_progs_after_rel_year_comp[i])879 end880 end881 #$log.info "END OF For loop: To find matching programs by season count, when more than 1 release year matches were found"882 log.info "END OF For loop: To find matching programs by season count, when more than 1 release year matches were found"883 if final_matching_progs.length > 0884 #$log.info "Final matching progs is 1 or more, take the first object as program id"885 log.info "Final matching progs is 1 or more, take the first object as program id"886 prog_id = final_matching_progs[0][0]887 else888 #$log.info "Take the first program which was matched with approx release year"889 log.info "Take the first program which was matched with approx release year"890 prog_id = arr_matching_progs_after_rel_year_comp[0][0]891 end892 end893 end894 end895 else896 $log.info "json body is empty, therefore return prog id-nil"897 log.info "json body is empty, therefore return prog id-nil"898 prog_id = nil899 end900 prog_id901 end902 def search_for_movie_and_return_prog_id(program_name,release_year,log)903 program_name=program_name.gsub(/[&]/, 'and')904 search_term=program_name905 search_term=search_term.gsub(" ","%20")906 search_term=search_term.gsub("'","%27")907 search_api = "/voice_command?version=3&query=" + search_term908 get search_api909 #$log.info "Response is: #{json_body}"910 log.info "Response is: #{json_body}"911 program_name = program_name.downcase912 program_name = prepare_for_search_comparison(program_name)913 #$log.info "program_name after processing: #{program_name}"914 log.info "program_name after processing: #{program_name}"915 ott_search_index = get_index_of_ott_search_object(json_body)916 ott_search_resp = json_body[ott_search_index][:results]917 resp_len = ott_search_resp.length918 release_year_range = Array.new919 release_year_range.push(release_year)920 release_year_range.push(release_year+1)921 release_year_range.push(release_year-1)922 for i in 0..resp_len-1923 prog_obj = ott_search_resp[i][:object]924 long_title=prog_obj[:long_title].downcase925 long_title = prepare_for_search_comparison(long_title)926 # $log.info "long_title after processing: #{long_title}"927 log.info "long_title after processing: #{long_title}"928 original_title=prog_obj[:original_title].downcase929 original_title = prepare_for_search_comparison(original_title)930 # $log.info "original_title after processing: #{original_title}"931 log.info "original_title after processing: #{original_title}"932 933 alias_title=prog_obj[:alias_title].downcase934 alias_title = prepare_for_search_comparison(alias_title)935 #$log.info "alias_title after processing: #{alias_title}"936 log.info "alias_title after processing: #{alias_title}"937 # if prog_obj[:long_title].casecmp(program_name).zero? and prog_obj[:show_type] == "MO" and release_year_range.include? prog_obj[:release_year]938 #if (program_name == long_title or program_name == original_title or program_name == alias_title) and prog_obj[:show_type] == "MO" and release_year_range.include? prog_obj[:release_year]939 if (long_title.include? program_name or original_title.include? program_name or alias_title.include? program_name) and prog_obj[:show_type] == "MO" and release_year_range.include? prog_obj[:release_year]940 #$log.info "Search successful and this movie is available in cloud"941 log.info "Search successful and this movie is available in cloud"942 prog_id = prog_obj[:id]943 break944 elsif i == resp_len-1945 # $log.info "Movie not available in cloud"946 log.info "Movie not available in cloud"947 prog_id = nil948 end949 end950 prog_id951 end952 def get_program_id_of_episode(prog_id,season_no,episode_no,log)953 begin954 api = "/programs/" + prog_id.to_s + "/episodes?season_number=" + season_no955 get api956 $log.info "Episode response is: #{json_body}"957 episode_obj_count = json_body.length958 for i in 0..episode_obj_count-1959 ep_obj = json_body[i]960 ep_no = episode_no.to_i961 #$log.info "Going to compare #{ep_obj[:episode_season_sequence]} and #{ep_no}"962 if ep_obj[:episode_season_sequence] == ep_no963 episode_program_id = ep_obj[:id]964 break965 else966 episode_program_id = nil967 end968 end969 episode_program_id970 rescue Exception => ex971 #$log.info "Error!!!: #{ex} <br>"972 #log.error "Exception caught in iteration #{iter}!!!: #{ex} <br>"973 #$log.info "Backtrace: #{ex.backtrace}<br>"974 log.error "Exception!!!: #{ex} <br"975 log.error "Backtrace: #{ex.backtrace}<br>"976 rescue Error => err977 #$log.info "Error!!!: #{ex} <br>"978 #log.error "Error in iteration #{iter}!!!: #{err} <br>"979 #$log.info "Backtrace: #{ex.backtrace}<br>"980 log.error "Error!!!: #{err} <br"981 end982 end983 def get_series_season_and_episode_number(prog_id,log)984 api = "/programs/" + prog_id.to_s985 get api986 expect_status('200')987 if !json_body.empty?988 resp = json_body[0]989 $log.info "Program response is: #{resp}"990 log.info "Program response is: #{resp}"991 show_type = resp[:show_type]992 if show_type == "SE"993 series_name = resp[:long_title]994 se_no = resp[:episode_season_number]995 ep_no = resp[:episode_season_sequence]996 ep_title = resp[:episode_title]997 arr = Array.new998 arr.push(series_name)999 arr.push(se_no)1000 arr.push(ep_no)1001 arr.push(ep_title)1002 $log.info "Array of series name,se no & episode no is: #{arr}"1003 log.info "Array of series name,se no & episode no is: #{arr}"1004 else1005 $log.info "Program not of type SE, but of type #{show_type}, hence give out an empty array"1006 log.error "Program not of type SE, but of type #{show_type}, hence give out an empty array"1007 arr = Array.new1008 end1009 else1010 $log.info "Program not available in cloud!!"1011 arr = Array.new1012 end1013 arr1014 end1015 def get_ott_links_from_mongo_db(client,prog,log)1016 #$log.info "Ozone Api Spec Functions::get_ott_links_from_mongo_db"1017 log.info "Ozone Api Spec Functions::get_ott_links_from_mongo_db"1018 index_pc_platform = nil1019 complete_video_list = nil1020 videos_list_got_from_rovi_dump = nil1021 dump_date = get_latest_rovi_ott_dump_date(client,log)1022 res_cnt = 01023 collection = client[:rovi_ott_links]1024 prog_id_query = prog.to_s1025 res = collection.find({:rovi_id => prog_id_query,:rovi_dump_date => { '$eq' => dump_date }}, {'availability' => 1}).limit(1).each do |doc|1026 res_cnt = res_cnt + 11027 1028 doc_json = doc.to_json1029 #$log.info doc_json1030 parsed_doc = JSON.parse(doc_json)1031 program_id = parsed_doc['rovi_id']1032 1033 #$log.info "Rovi Program id is: #{program_id}<br>"1034 log.info "Rovi Program id is: #{program_id}<br>"1035 videos = parsed_doc["availability"]["platform_availabilities"]1036 1037 for i in 0..videos.length1038 platform = videos[i]["platform_id"]1039 if platform == "pc"1040 #$log.info "PC platform videos appear in #{i}th index <br>"1041 log.info "PC platform videos appear in #{i}th index "1042 index_pc_platform = i1043 break1044 end1045 end1046 next if index_pc_platform.nil?1047 1048 if index_pc_platform && videos[index_pc_platform]["platform_id"] == "pc"1049 videos_list_got_from_rovi_dump = Array.new1050 complete_video_list = videos[index_pc_platform]['source_availabilities']1051 #$log.info "Complete video list is: #{complete_video_list} <br>"1052 for i in 0..complete_video_list.length-11053 video_obj = complete_video_list[i]1054 content_type = video_obj['content_form']1055 service_name = video_obj['source_id']1056 #$log.info content_type1057 if content_type == 'full' && service_name == $serv_name1058 #$log.info "inside if!!"1059 1060 video_obj.delete("cache_expiry_timestamp")1061 video_obj.delete("last_refreshed_timestamp")1062 video_obj.delete("updated_at")1063 video_obj.delete("refreshed_at")1064 video_obj.delete("content_expiry_timestamp")1065 video_obj.delete("price_currency")1066 video_obj.delete("source_program_id_space")1067 video_obj.delete("is_3d")1068 video_obj.delete("audio_languages")1069 video_obj.delete("subtitle_languages")1070 if video_obj["price"] == ""1071 video_obj["price"] = "0.0"1072 end1073 vid_price = video_obj["price"]1074 cld_price = vid_price.to_f.to_s1075 video_obj["price"] = cld_price1076 if video_obj["source_id"] == "hulu"1077 video_obj.delete("source_program_id")1078 end1079 if($serv_name == "netflixusa")1080 if !video_obj["link"]["uri"].include? "netflix"1081 next1082 end1083 end1084 if($serv_name == "showtime")1085 if video_obj["link"]["uri"].include? "showtimeanytime"1086 next1087 end1088 1089 if !video_obj["link"]["uri"].include? $serv_name1090 next1091 end1092 1093 end1094 1095 #$log.info "Video obj to be pushed is :#{video_obj}"1096 if !$hulu_vids_cloud.empty? and video_obj["source_id"] == "hulu"1097 log.info "Hulu links fetched from dump, skip it during the validation-don't add to array"1098 next1099 end1100 if !$vudu_vids_cloud.empty? and video_obj["source_id"] == "vudu"1101 log.info "Vudu links fetched from dump, skip it during the validation-don't add to array"1102 next1103 end1104 videos_list_got_from_rovi_dump.push(video_obj)1105 end1106 end1107 videos_list_got_from_rovi_dump = transform_keys_to_symbols(videos_list_got_from_rovi_dump)1108 #$log.info "Videos extracted from rovi dump: #{videos_list_got_from_rovi_dump} <br><br>"1109 log.info "Videos extracted from rovi dump: #{videos_list_got_from_rovi_dump}"1110 end1111 end1112 #end1113 if res_cnt == 01114 #$log.info "Program with rovi id #{prog} not available in rovi ott dump"1115 log.info "Program with rovi id #{prog} not available in rovi ott dump"1116 log.info "**************************************************************************************************************************************************************************************************************************************************************************"1117 videos_list_got_from_rovi_dump = Array.new1118 end1119 videos_list_got_from_rovi_dump1120 end1121 def get_rovi_ind_service_ott_links_from_mongo_db(client,prog,service_nm,log)1122 #$log.info "Ozone Api Spec Functions::get_ott_links_of_ind_services_from_mongo_db"1123 log.info "Ozone Api Spec Functions::get_ott_links_of_ind_services_from_mongo_db"1124 index_pc_platform = nil1125 complete_video_list = nil1126 dump_date = nil1127 ind_service_videos_list_got_from_rovi_dump = nil1128 prog_id = prog.to_s1129 coll_dump_date = client[:rovi_ott_links_dump_date]1130 query_dump_date = coll_dump_date.find({},{ "sort" =>{ "$natural" => -1}}).limit(1)1131 query_dump_date.each do |dt|1132 du_dt = dt.to_json1133 #$log.info du_dt1134 pars_dt = JSON.parse(du_dt)1135 date_str = pars_dt['ott_dump_date']1136 dump_date = Date.parse date_str1137 #$log.info dump_date.class1138 #$log.info "Last added dump date is: #{dump_date}<br>"1139 log.info "Last added dump date is: #{dump_date}<br>"1140 end1141 collection = client[:rovi_ott_links]1142 cnt = collection.count({:rovi_id => prog_id,:rovi_dump_date => { '$eq' => dump_date }}, {'availability' => 1})1143 if cnt == 01144 #$log.info "Program with rovi id #{prog} not available in rovi ott dump"1145 log.info "Program with rovi id #{prog} not available in rovi ott dump"1146 log.info "**************************************************************************************************************************************************************************************************************************************************************************"1147 log.info "**************************************************************************************************************************************************************************************************************************************************************************"1148 else1149 collection.find({:rovi_id => prog_id,:rovi_dump_date => { '$eq' => dump_date }}, {'availability' => 1}).each do |doc|1150 #=> Yields a BSON::Document.1151 #$log.info doc1152 doc_json = doc.to_json1153 #$log.info doc_json1154 parsed_doc = JSON.parse(doc_json)1155 program_id = parsed_doc['rovi_id']1156 1157 #$log.info "Rovi Program id is: #{program_id}<br>"1158 log.info "Rovi Program id is: #{program_id}<br>"1159 videos = parsed_doc["availability"]["platform_availabilities"]1160 #$log.info videos1161 #$log.info videos.class1162 for i in 0..videos.length1163 platform = videos[i]["platform_id"]1164 if platform == "pc"1165 #$log.info "PC platform videos appear in #{i}th index <br>"1166 log.info "PC platform videos appear in #{i}th index "1167 index_pc_platform = i1168 break1169 end1170 end1171 next if index_pc_platform.nil?1172 1173 if index_pc_platform && videos[index_pc_platform]["platform_id"] == "pc"1174 ind_service_videos_list_got_from_rovi_dump = Array.new1175 complete_video_list = videos[index_pc_platform]['source_availabilities']1176 #$log.info "Complete video list is: #{complete_video_list} <br>"1177 for i in 0..complete_video_list.length-11178 video_obj = complete_video_list[i]1179 content_type = video_obj['content_form']1180 service_name = video_obj['source_id']1181 #$log.info content_type1182 #$log.info service_name1183 if content_type == 'full' and $all_supported_services.include? service_name1184 if service_nm == service_name1185 #$log.info "Service match found for #{service_nm}"1186 log.info "Service match found for #{service_nm}"1187 video_obj.delete("cache_expiry_timestamp")1188 video_obj.delete("last_refreshed_timestamp")1189 video_obj.delete("updated_at")1190 video_obj.delete("refreshed_at")1191 video_obj.delete("content_expiry_timestamp")1192 video_obj.delete("price_currency")1193 video_obj.delete("source_program_id_space")1194 video_obj.delete("is_3d")1195 video_obj.delete("audio_languages")1196 video_obj.delete("subtitle_languages")1197 if video_obj["price"] == ""1198 video_obj["price"] = "0.0"1199 end1200 vid_price = video_obj["price"]1201 cld_price = vid_price.to_f.to_s1202 video_obj["price"] = cld_price1203 if video_obj["source_id"] == "hulu"1204 video_obj.delete("source_program_id")1205 end1206 if video_obj["link"]["uri"].include? "showtimeanytime"1207 video_obj["source_id"] = "showtimeanytime"1208 end1209 if video_obj["link"]["uri"].include? "hbonow"1210 video_obj["source_id"] = "hbonow"1211 end1212 #$log.info "Video obj to be pushed is :#{video_obj}"1213 ind_service_videos_list_got_from_rovi_dump.push(video_obj)1214 else1215 #$log.info "#{service_name} is not of type #{service_nm}, moving to next"1216 log.info "#{service_name} is not of type #{service_nm}, moving to next"1217 next1218 end1219 end1220 end1221 ind_service_videos_list_got_from_rovi_dump = transform_keys_to_symbols(ind_service_videos_list_got_from_rovi_dump)1222 #$log.info "Videos extracted from rovi dump: #{videos_list_got_from_rovi_dump} <br><br>"1223 log.info "Videos extracted from rovi dump: #{ind_service_videos_list_got_from_rovi_dump}"1224 end1225 end1226 end1227 ind_service_videos_list_got_from_rovi_dump1228 end1229 def get_rovi_ott_links_from_cloud(prog_id,log)1230 #$log.info "Ozone Api Spec Functions::get_rovi_ott_links_from_cloud"1231 log.info "Ozone Api Spec Functions::get_rovi_ott_links_from_cloud"1232 rovi_videos_list_got_from_cloud = Array.new1233 get "/programs/#{prog_id}/videos"1234 expect_status('200')1235 #$log.info json_body1236 len = json_body.length1237 if len > 01238 #$log.info "Inside if len > O"1239 log.info "Inside if len > O"1240 for i in 0..len-11241 video_obj_from_cloud = json_body[i]1242 if video_obj_from_cloud[:fetched_from].nil?1243 video_obj_from_cloud.delete(:platform)1244 video_obj_from_cloud.delete(:last_refreshed_timestamp)1245 video_obj_from_cloud.delete(:content_expiry_timestamp)1246 video_obj_from_cloud.delete(:cache_expiry_timestamp)1247 video_obj_from_cloud.delete(:launch_id)1248 video_obj_from_cloud.delete(:created_at)1249 video_obj_from_cloud.delete(:updated_at)1250 video_obj_from_cloud.delete(:refreshed_at)1251 video_obj_from_cloud.delete(:with_subscription)1252 video_obj_from_cloud.delete(:subscription_type)1253 video_obj_from_cloud.delete(:audio_languages)1254 if video_obj_from_cloud[:run_time].nil?1255 video_obj_from_cloud.delete(:run_time)1256 else1257 video_obj_from_cloud[:content_runtime_s] = video_obj_from_cloud[:run_time]1258 video_obj_from_cloud.delete(:run_time)1259 end1260 if video_obj_from_cloud[:constraints].empty?1261 video_obj_from_cloud.delete(:constraints)1262 end1263 if video_obj_from_cloud[:quality].nil?1264 video_obj_from_cloud.delete(:quality)1265 end1266 if video_obj_from_cloud[:purchase_type] == ""1267 video_obj_from_cloud.delete(:purchase_type)1268 end1269 if video_obj_from_cloud[:source_id] == "hulu"1270 video_obj_from_cloud.delete(:source_program_id)1271 end1272 rovi_videos_list_got_from_cloud.push(video_obj_from_cloud)1273 end1274 end1275 else1276 # $log.info "Inside else, empty cloud response"1277 log.info "Inside else, empty cloud response"1278 end1279 #$log.info "Rovi Videos got from cloud: #{rovi_videos_list_got_from_cloud}"1280 log.info "Rovi Videos got from cloud: #{rovi_videos_list_got_from_cloud}"1281 rovi_videos_list_got_from_cloud1282 end1283 def get_gracenote_ott_links_from_cloud(prog_id,log)1284 gn_videos_list_got_from_cloud = nil1285 begin1286 # $log.info "Ozone Api Spec Functions::get_gracenote_ott_links_from_cloud"1287 log.info "Ozone Api Spec Functions::get_gracenote_ott_links_from_cloud"1288 gn_videos_list_got_from_cloud = Array.new1289 get "/programs/#{prog_id}/videos"1290 expect_status('200')1291 #$log.info json_body1292 len = json_body.length1293 if len > 01294 # $log.info "Inside if len > O"1295 log.info "Inside if len > O"1296 for i in 0..len-11297 video_obj_from_cloud = json_body[i]1298 if video_obj_from_cloud[:fetched_from] == 'gracenote'1299 video_obj_from_cloud.delete(:platform)1300 video_obj_from_cloud.delete(:last_refreshed_timestamp)1301 video_obj_from_cloud.delete(:content_expiry_timestamp)1302 video_obj_from_cloud.delete(:cache_expiry_timestamp)1303 video_obj_from_cloud.delete(:launch_id)1304 video_obj_from_cloud.delete(:created_at)1305 video_obj_from_cloud.delete(:updated_at)1306 video_obj_from_cloud.delete(:refreshed_at)1307 video_obj_from_cloud.delete(:with_subscription)1308 video_obj_from_cloud.delete(:subscription_type)1309 video_obj_from_cloud.delete(:audio_languages)1310 if video_obj_from_cloud[:run_time].nil?1311 video_obj_from_cloud.delete(:run_time)1312 else1313 video_obj_from_cloud[:content_runtime_s] = video_obj_from_cloud[:run_time]1314 video_obj_from_cloud.delete(:run_time)1315 end1316 if video_obj_from_cloud[:constraints].empty?1317 video_obj_from_cloud.delete(:constraints)1318 end1319 if video_obj_from_cloud[:quality].nil?1320 video_obj_from_cloud.delete(:quality)1321 end1322 if video_obj_from_cloud[:purchase_type] == ""1323 video_obj_from_cloud.delete(:purchase_type)1324 end1325 if video_obj_from_cloud[:source_id] == "hulu"1326 video_obj_from_cloud.delete(:source_program_id)1327 end1328 gn_videos_list_got_from_cloud.push(video_obj_from_cloud)1329 end1330 end1331 else1332 #$log.info "Inside else, empty cloud response"1333 log.info "Inside else, empty cloud response"1334 end1335 #$log.info "GN Videos got from cloud: #{gn_videos_list_got_from_cloud}"1336 log.info "GN Videos got from cloud: #{gn_videos_list_got_from_cloud}"1337 1338 rescue Exception => ex1339 #$log.info "Error!!!: #{ex} <br>"1340 #log.error "Exception caught in iteration #{iter}!!!: #{ex} <br>"1341 #$log.info "Backtrace: #{ex.backtrace}<br>"1342 log.error "Exception!!!: #{ex} <br"1343 gn_videos_list_got_from_cloud = []1344 rescue Error => err1345 #$log.info "Error!!!: #{ex} <br>"1346 #log.error "Error in iteration #{iter}!!!: #{err} <br>"1347 #$log.info "Backtrace: #{ex.backtrace}<br>"1348 log.error "Error!!!: #{err} <br"1349 gn_videos_list_got_from_cloud = []1350 end1351 gn_videos_list_got_from_cloud1352 end1353 def get_ott_links_from_cloud(prog_id,log)1354 log.info "Ozone Api Spec Functions::get_ott_links_from_cloud"1355 rovi_videos_list_got_from_cloud = Array.new1356 gracenote_videos_list_got_from_cloud = Array.new1357 hulu_videos_list_got_from_cloud = Array.new1358 vudu_videos_list_got_from_cloud = Array.new1359 crawler_videos_list_got_from_cloud = Array.new1360 all_videos_list_got_from_cloud = Array.new1361 videos_got_from_cloud = {"Rovi Videos"=> [],"Gracenote Videos"=> [],"Hulu Videos"=> [],"Vudu Videos"=> [],"Crawler Videos"=>[],"All Videos" => []}1362 #videos_got_from_cloud = nil1363 #rovi_videos_list_got_from_cloud = nil1364 #gracenote_videos_list_got_from_cloud = nil1365 api = "/programs/#{prog_id}/videos"+ "?service="+ $serv_name1366 get api1367 response_code_validation("get",api)1368 log.info "json_body: #{json_body}"1369 len = json_body.length1370 if len > 01371 #$log.info "Inside if len > O"1372 log.info "Inside if len > O"1373 1374 for i in 0..len-11375 video_obj_from_cloud = json_body[i]1376 log.info "video_obj_from_cloud:: #{video_obj_from_cloud}"1377 video_obj_from_cloud.delete(:platform)1378 video_obj_from_cloud.delete(:last_refreshed_timestamp)1379 video_obj_from_cloud.delete(:content_expiry_timestamp)1380 video_obj_from_cloud.delete(:cache_expiry_timestamp)1381 video_obj_from_cloud.delete(:launch_id)1382 video_obj_from_cloud.delete(:created_at)1383 video_obj_from_cloud.delete(:updated_at)1384 video_obj_from_cloud.delete(:refreshed_at)1385 video_obj_from_cloud.delete(:with_subscription)1386 video_obj_from_cloud.delete(:subscription_type)1387 video_obj_from_cloud.delete(:audio_languages)1388 if video_obj_from_cloud[:run_time].nil?1389 video_obj_from_cloud.delete(:run_time)1390 else1391 video_obj_from_cloud[:content_runtime_s] = video_obj_from_cloud[:run_time]1392 video_obj_from_cloud.delete(:run_time)1393 end1394 if video_obj_from_cloud[:constraints].nil? or video_obj_from_cloud[:constraints].empty?1395 video_obj_from_cloud.delete(:constraints)1396 end1397 if video_obj_from_cloud[:quality].nil?1398 video_obj_from_cloud.delete(:quality)1399 end1400 if video_obj_from_cloud[:purchase_type] == ""1401 video_obj_from_cloud.delete(:purchase_type)1402 end1403 if video_obj_from_cloud[:source_id] == "hulu"1404 video_obj_from_cloud.delete(:source_program_id)1405 end1406 if video_obj_from_cloud[:fetched_from].nil?1407 rovi_videos_list_got_from_cloud.push(video_obj_from_cloud)1408 elsif video_obj_from_cloud[:fetched_from] == "gracenote"1409 # gn_url = video_obj_from_cloud[:link][:uri]1410 # gracenote_videos_list_got_from_cloud.push(gn_url)1411 gracenote_videos_list_got_from_cloud.push(video_obj_from_cloud)1412 elsif video_obj_from_cloud[:fetched_from] == "hulu"1413 hulu_videos_list_got_from_cloud.push(video_obj_from_cloud)1414 elsif video_obj_from_cloud[:fetched_from] == "vudu"1415 vudu_videos_list_got_from_cloud.push(video_obj_from_cloud)1416 elsif video_obj_from_cloud[:fetched_from] == "crawler"1417 crawler_videos_list_got_from_cloud.push(video_obj_from_cloud)1418 end1419 all_videos_list_got_from_cloud.push(video_obj_from_cloud)1420 end1421 else1422 #$log.info "Inside else, empty cloud response"1423 log.info "Inside else, empty cloud response"1424 end1425 videos_got_from_cloud = {"Rovi Videos"=> rovi_videos_list_got_from_cloud,"Gracenote Videos"=> gracenote_videos_list_got_from_cloud,"Hulu Videos"=> hulu_videos_list_got_from_cloud,"Vudu Videos"=> vudu_videos_list_got_from_cloud,"Crawler Videos"=>crawler_videos_list_got_from_cloud,"All Videos"=> all_videos_list_got_from_cloud}1426 log.info "Videos got from Rovi cloud: #{rovi_videos_list_got_from_cloud}"1427 log.info "Videos got from Gn cloud: #{gracenote_videos_list_got_from_cloud}"1428 #$log.info "Videos got from cloud: #{videos_got_from_cloud}"1429 log.info "Videos got from cloud: #{videos_got_from_cloud}"1430 videos_got_from_cloud1431 end1432 def get_ott_links_of_individual_service_from_cloud(prog_id,service,log)1433 #$log.info "Ozone Api Spec Functions::get_ott_links_of_individual_service_from_cloud"1434 log.info "Ozone Api Spec Functions::get_ott_links_of_individual_service_from_cloud"1435 videos_got_from_cloud = {"Rovi Videos"=> [],"Gracenote Videos"=> []}1436 rovi_videos_list_got_from_cloud = Array.new1437 gracenote_videos_list_got_from_cloud = Array.new1438 get "/programs/#{prog_id}/videos"1439 expect_status('200')1440 #$log.info json_body1441 len = json_body.length1442 if len > 01443 #$log.info "Inside if len > O"1444 log.info "Inside if len > O"1445 1446 for i in 0..len-11447 video_obj_from_cloud = json_body[i]1448 ind_service_name = video_obj_from_cloud[:source_id]1449 if service == ind_service_name1450 #$log.info "#{ind_service_name} is of type #{service}, going to process"1451 log.info "#{ind_service_name} is of type #{service}, going to process"1452 if video_obj_from_cloud[:fetched_from].nil?1453 #$log.info "Rovi object, hence remove all dynamic key-value pairs"1454 log.info "Rovi object, hence remove all dynamic key-value pairs"1455 video_obj_from_cloud.delete(:platform)1456 video_obj_from_cloud.delete(:last_refreshed_timestamp)1457 video_obj_from_cloud.delete(:content_expiry_timestamp)1458 video_obj_from_cloud.delete(:cache_expiry_timestamp)1459 video_obj_from_cloud.delete(:launch_id)1460 video_obj_from_cloud.delete(:created_at)1461 video_obj_from_cloud.delete(:updated_at)1462 video_obj_from_cloud.delete(:refreshed_at)1463 video_obj_from_cloud.delete(:with_subscription)1464 video_obj_from_cloud.delete(:subscription_type)1465 video_obj_from_cloud.delete(:audio_languages)1466 if video_obj_from_cloud[:run_time].nil?1467 video_obj_from_cloud.delete(:run_time)1468 else1469 video_obj_from_cloud[:content_runtime_s] = video_obj_from_cloud[:run_time]1470 video_obj_from_cloud.delete(:run_time)1471 end1472 if video_obj_from_cloud[:constraints].empty?1473 video_obj_from_cloud.delete(:constraints)1474 end1475 if video_obj_from_cloud[:quality].nil?1476 video_obj_from_cloud.delete(:quality)1477 end1478 if video_obj_from_cloud[:purchase_type] == ""1479 video_obj_from_cloud.delete(:purchase_type)1480 end1481 if video_obj_from_cloud[:source_id] == "hulu"1482 video_obj_from_cloud.delete(:source_program_id)1483 end1484 rovi_videos_list_got_from_cloud.push(video_obj_from_cloud)1485 elsif video_obj_from_cloud[:fetched_from] == "gracenote"1486 #$log.info "GN object, hence adding only url to array"1487 log.info "GN object, hence adding only url to array"1488 gn_url = video_obj_from_cloud[:link][:uri]1489 gracenote_videos_list_got_from_cloud.push(gn_url)1490 end1491 else1492 #$log.info "#{ind_service_name} is not of type #{service}, moving to next"1493 log.info "#{ind_service_name} is not of type #{service}, moving to next"1494 next1495 end1496 end1497 else1498 #$log.info "Inside else, empty cloud response"1499 log.info "Inside else, empty cloud response"1500 end1501 videos_got_from_cloud = {"Rovi Videos"=> rovi_videos_list_got_from_cloud,"Gracenote Videos"=> gracenote_videos_list_got_from_cloud}1502 1503 #$log.info "Videos got from cloud for the service #{service}: #{videos_got_from_cloud}"1504 log.info "Videos got from cloud for the service #{service}: #{videos_got_from_cloud}"1505 videos_got_from_cloud1506 end1507 def check_for_index_of_array_element(arr_of_airdate_programs,series_nm,se_num,ep_num,log)1508 indx = nil1509 arr_len = arr_of_airdate_programs.length1510 for i in 0..arr_len-11511 array_elem = arr_of_airdate_programs[i]1512 #$log.info "Going to compare csv value(series name):#{array_elem[0]} with #{series_nm},csv value(season num): #{array_elem[1]} with #{se_num} & csv value(episode num): #{array_elem[2]} with #{ep_num}"1513 log.info "Going to compare csv value(series name):#{array_elem[0]} with #{series_nm},csv value(season num): #{array_elem[1]} with #{se_num} & csv value(episode num): #{array_elem[2]} with #{ep_num}"1514 1515 if array_elem[0].casecmp(series_nm).zero? and array_elem[1].to_i == se_num and array_elem[2].to_i == ep_num1516 #$log.info "We've found a match return index #{i}"1517 log.info "We've found a match return index #{i}"1518 indx = i1519 break1520 end1521 end1522 indx1523 end1524 def categorise_video_links(ott_links_from_cloud,log)1525 #$log.info "Api_spec_functions:: categorise_video_links"1526 log.info "Api_spec_functions:: categorise_video_links"1527 amazon = Array.new1528 hulu = Array.new1529 vudu = Array.new1530 netflixusa = Array.new1531 showtimeanytime = Array.new1532 showtime = Array.new1533 hbogo = Array.new1534 hbonow = Array.new1535 youtube = Array.new1536 itunes = Array.new1537 if !ott_links_from_cloud.empty?1538 no_of_ott_links = ott_links_from_cloud.length1539 for i in 0..no_of_ott_links-11540 video_obj = ott_links_from_cloud[i]1541 ind_service_name = video_obj[:source_id]1542 ind_service_url = video_obj[:link][:uri]1543 case ind_service_name1544 when "amazon"1545 amazon.push(ind_service_url)1546 when "hulu"1547 hulu.push(ind_service_url)1548 when "vudu"1549 vudu.push(ind_service_url)1550 when "netflixusa"1551 netflixusa.push(ind_service_url)1552 when "showtimeanytime"1553 showtimeanytime.push(ind_service_url)1554 when "showtime"1555 showtime.push(ind_service_url)1556 when "hbogo"1557 hbogo.push(ind_service_url)1558 when "hbonow"1559 hbonow.push(ind_service_url)1560 when "youtube"1561 youtube.push(ind_service_url)1562 when "itunes"1563 itunes.push(ind_service_url)1564 end1565 end1566 end1567 ott_links_by_category = {"amazon" => amazon,"hbogo" => hbogo,"hulu" => hulu,"netflixusa" => netflixusa,"showtimeanytime" => showtimeanytime,"showtime" => showtime,"hbonow" => hbonow,"vudu" => vudu,"youtube" => youtube,"itunes" => itunes}1568 #$log.info "Links got from cloud: #{ott_links_by_category}"1569 log.info "Links got from cloud: #{ott_links_by_category}"1570 ott_links_by_category1571 end1572 def categorise_launch_ids_based_on_service(ott_links_from_cloud,show_type,log)1573 #$log.info "Api_spec_functions:: categorise_video_links"1574 log.info "Api_spec_functions:: categorise_video_links"1575 amazon = Array.new1576 hulu = Array.new1577 vudu = Array.new1578 netflixusa = Array.new1579 showtimeanytime = Array.new1580 showtime = Array.new1581 hbogo = Array.new1582 hbonow = Array.new1583 youtube = Array.new1584 itunes = Array.new1585 launch_id = nil1586 if !ott_links_from_cloud.empty?1587 no_of_ott_links = ott_links_from_cloud.length1588 for i in 0..no_of_ott_links-11589 video_obj = ott_links_from_cloud[i]1590 # ind_service_name = video_obj[:source_id] serv_name1591 ind_service_name = video_obj[:source_id]1592 ind_service_url = video_obj[:link][:uri]1593 case ind_service_name1594 when "amazon"1595 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?amazon\.com\/([a-zA-Z\/]*)\/([A-Za-z0-9]+)/)[3]1596 amazon.push(launch_id)1597 when "hulu"1598 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?hulu\.com\/watch\/([A-Za-z0-9]+)/)[2]1599 hulu.push(launch_id)1600 when "vudu"1601 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?vudu\.com\/movies\/#!content\/([A-Za-z0-9]+)/)[2]1602 vudu.push(launch_id)1603 when "netflixusa"1604 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?netflix\.com\/([a-zA-Z]+)\/([0-9]+)/)[3]1605 netflixusa.push(launch_id)1606 when "showtimeanytime"1607 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?showtime(anytime)?\.com\/#\/([a-zA-Z]+)\/([A-Za-z0-9]+)/)[4]1608 showtimeanytime.push(launch_id)1609 when "showtime"1610 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?showtime(anytime)?\.com\/#\/([a-zA-Z]+)\/([A-Za-z0-9]+)/)[4]1611 showtime.push(launch_id)1612 when "hbogo"1613 #launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?hbogo\.com\/#home\/([a-zA-Z&]+)=([A-Za-z0-9]+)/)[3]1614 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?hbogo\.com\/#([a-z]+)\/([a-zA-Z&;]+)=([A-Za-z0-9]+)/)[4]1615 hbogo.push(launch_id)1616 when "hbonow"1617 #launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?hbogo\.com\/#home\/([a-zA-Z&;]+)=([A-Za-z0-9]+)/)[3]1618 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?hbonow\.com\/(.+)\/(.+)\/(.+)\/(.+)/)[5]1619 hbonow.push(launch_id)1620 when "youtube"1621 #launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?youtube\.com\/([a-zA-Z]+)\?v=([A-Za-z0-9]+)/)[3]1622 # match(/http[s]?:\/\/(www.)?youtube\.com\/([a-zA-Z]+)\?v=([A-Za-z0-9]+)/)[3]1623 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?youtube\.com\/([a-zA-Z]+)\?v=(.+)+/)[3]1624 youtube.push(launch_id)1625 when "itunes"1626 if show_type == "MO"1627 log.info "Show type - MO"1628 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?itunes\.apple\.com\/us\/([a-zA-Z0-9\-\/]*)([a-zA-Z0-9\/\-\.]*)\/id([0-9]+)(\?i=)?([0-9]*)/)[4]1629 else1630 log.info "Show type - SE"1631 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?itunes\.apple\.com\/us\/([a-zA-Z0-9\-\/]*)([a-zA-Z0-9\/\-\.]*)\/id([0-9]+)(\?i=)?([0-9]*)/)[6]1632 end1633 itunes.push(launch_id)1634 end1635 end1636 end1637 ott_links_by_category = {"amazon" => amazon,"hbogo" => hbogo,"hulu" => hulu,"netflixusa" => netflixusa,"showtimeanytime" => showtimeanytime,"showtime" => showtime,"hbonow" => hbonow,"vudu" => vudu,"youtube" => youtube,"itunes" => itunes}1638 #$log.info "Links got from cloud: #{ott_links_by_category}"1639 log.info "Links got from cloud: #{ott_links_by_category}"1640 ott_links_by_category1641 end1642 def categorise_ozone_launch_ids_based_on_service(ott_links_from_cloud,show_type,log)1643 log.info "Api_spec_functions:: categorise_ozone_launch_ids_based_on_service"1644 amazon = Array.new1645 hulu = Array.new1646 vudu = Array.new1647 netflixusa = Array.new1648 showtimeanytime = Array.new1649 showtime = Array.new1650 hbogo = Array.new1651 hbonow = Array.new1652 youtube = Array.new1653 itunes = Array.new1654 launch_id = nil1655 if !ott_links_from_cloud.empty?1656 no_of_ott_links = ott_links_from_cloud.length1657 for i in 0..no_of_ott_links-11658 video_obj = ott_links_from_cloud[i]1659 #ind_service_name = $serv_name1660 ind_service_name = video_obj[:source_id]1661 log.info "Service name: #{ind_service_name}"1662 ind_service_url = video_obj[:link][:uri]1663 log.info "Service url: #{ind_service_url}"1664 case ind_service_name1665 when "amazon"1666 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?amazon\.com\/([a-zA-Z\/]*)\/([A-Za-z0-9]+)/)[3]1667 amazon.push(launch_id)1668 when "hulu"1669 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?hulu\.com\/watch\/([A-Za-z0-9]+)/)[2]1670 hulu.push(launch_id)1671 when "vudu"1672 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?vudu\.com\/movies\/#!content\/([A-Za-z0-9]+)/)[2]1673 vudu.push(launch_id)1674 when "netflixusa"1675 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?netflix\.com\/([a-zA-Z]+)\/([0-9]+)/)[3]1676 netflixusa.push(launch_id)1677 # Service url: http://www.netflix.com/WiPlayer?movieid=702741081678 when "showtimeanytime"1679 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?showtime(anytime)?\.com\/#\/([a-zA-Z]+)\/([A-Za-z0-9]+)/)[4]1680 showtimeanytime.push(launch_id)1681 when "showtime"1682 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?showtime(anytime)?\.com\/#\/([a-zA-Z]+)\/([A-Za-z0-9]+)/)[4]1683 showtime.push(launch_id)1684 when "hbogo"1685 #launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?hbogo\.com\/#home\/([a-zA-Z&;]+)=([A-Za-z0-9]+)/)[3]1686 if ind_service_url.include?"play"1687 log.info "The URL has play in it" 1688 launch_id = ind_service_url.gsub("https://play.hbogo.com/episode/urn:hbo:episode:","")1689 else1690 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?hbogo\.com\/#([a-z]+)\/([a-zA-Z&;]+)=([A-Za-z0-9]+)/)[4]1691 end 1692 log.info "Launch id: #{launch_id}"1693 hbogo.push(launch_id)1694 when "hbonow"1695 #launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?hbogo\.com\/#home\/([a-zA-Z&;]+)=([A-Za-z0-9]+)/)[3]1696 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?hbonow\.com\/(.+)\/(.+)\/(.+)\/(.+)/)[5]1697 hbonow.push(launch_id)1698 when "youtube"1699 #launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?youtube\.com\/([a-zA-Z]+)\?v=([A-Za-z0-9]+)/)[3]1700 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?youtube\.com\/([a-zA-Z]+)\?v=(.+)+/)[3]1701 youtube.push(launch_id)1702 when "itunes"1703 if show_type == "MO"1704 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?itunes\.apple\.com\/us\/([a-zA-Z0-9\-\/]*)([a-zA-Z0-9\/\-\.]*)\/id([0-9]+)(\?i=)?([0-9]*)/)[4]1705 else1706 launch_id = ind_service_url.match(/http[s]?:\/\/(www.)?itunes\.apple\.com\/us\/([a-zA-Z0-9\-\/]*)([a-zA-Z0-9\/\-\.]*)\/id([0-9]+)(\?i=)?([0-9]*)/)[6]1707 end1708 itunes.push(launch_id)1709 #Service url: https://itunes.apple.com/us/tv-season/season-3-episode-1-no-m%C3%A1s/id940287472?i=9426915901710 end1711 end1712 end1713 ott_links_by_category = {"amazon" => amazon,"hbogo" => hbogo,"hulu" => hulu,"netflixusa" => netflixusa,"showtimeanytime" => showtimeanytime,"showtime" => showtime,"hbonow" => hbonow,"vudu" => vudu,"youtube" => youtube,"itunes" => itunes}1714 #$log.info "Links got from cloud: #{ott_links_by_category}"1715 log.info "Links got from cloud: #{ott_links_by_category}"1716 ott_links_by_category1717 end1718 def make_one_single_array(arr_of_arr)1719 single_arr = Array.new1720 len = arr_of_arr.length1721 for i in 0..len-11722 if !arr_of_arr[i].empty?1723 arr_of_arr[i].each do |arr_elem|1724 single_arr.push(arr_elem)1725 end1726 end1727 end1728 single_arr1729 end1730 def get_categorised_gn_launch_ids(hash_of_gn_links,show_type,log)1731 log.info "API Specs::get_categorised_gn_launch_ids"1732 gn_categorised_launch_id_hash = {}1733 links = nil1734 arr_launch_ids = nil1735 gn_services = hash_of_gn_links.keys1736 gn_services.each do |service|1737 links = hash_of_gn_links[service]1738 arr_launch_ids = Array.new1739 case service1740 when "amazon"1741 links.each do |link|1742 launch_id = link.match(/http[s]?:\/\/(www.)?amazon\.com\/([a-zA-Z\/]*)\/([A-Za-z0-9]+)/)[3]1743 arr_launch_ids.push(launch_id)1744 end1745 when "hulu"1746 links.each do |link|1747 launch_id = link.match(/http[s]?:\/\/(www.)?hulu\.com\/watch\/([A-Za-z0-9]+)/)[2]1748 arr_launch_ids.push(launch_id)1749 end1750 when "vudu"1751 links.each do |link|1752 launch_id = link.match(/http[s]?:\/\/(www.)?vudu\.com\/movies\/#!content\/([A-Za-z0-9]+)/)[2]1753 arr_launch_ids.push(launch_id)1754 end1755 when "netflixusa"1756 links.each do |link|1757 launch_id = link.match(/http[s]?:\/\/(www.)?netflix\.com\/([a-zA-Z]+)\/([0-9]+)/)[3]1758 arr_launch_ids.push(launch_id)1759 end1760 when "showtimeanytime"1761 links.each do |link|1762 launch_id = link.match(/http[s]?:\/\/(www.)?showtime(anytime)?\.com\/#\/([a-zA-Z]+)\/([A-Za-z0-9]+)/)[4]1763 arr_launch_ids.push(launch_id)1764 end1765 when "showtime"1766 links.each do |link|1767 launch_id = link.match(/http[s]?:\/\/(www.)?showtime(anytime)?\.com\/#\/([a-zA-Z]+)\/([A-Za-z0-9]+)/)[4]1768 arr_launch_ids.push(launch_id)1769 end1770 when "hbo"1771 links.each do |link|1772 #launch_id = link.match(/http[s]?:\/\/(www.)?hbogo\.com\/#home\/([a-zA-Z&;]+)=([A-Za-z0-9]+)/)[3]1773 launch_id = link.match(/http[s]?:\/\/(www.)?hbogo\.com\/#([a-z]+)\/([a-zA-Z&;]+)=([A-Za-z0-9]+)/)[4]1774 arr_launch_ids.push(launch_id)1775 end1776 when "hbonow"1777 links.each do |link|1778 #launch_id = link.match(/http[s]?:\/\/(www.)?hbonow\.com\/([a-zA-Z0-9]+)\/(.+)+\/0\/(.+)/)[4]1779 launch_id = link.match(/http[s]?:\/\/(www.)?hbonow\.com\/(.+)\/(.+)\/(.+)\/(.+)/)[5]1780 arr_launch_ids.push(launch_id)1781 end1782 when "youtube"1783 links.each do |link|1784 #launch_id = link.match(/http[s]?:\/\/(www.)?youtube\.com\/([a-zA-Z]+)\?v=([A-Za-z0-9]+)/)[3]1785 launch_id = link.match(/http[s]?:\/\/(www.)?youtube\.com\/([a-zA-Z]+)\?v=(.+)+/)[3]1786 arr_launch_ids.push(launch_id)1787 end1788 when "itunes"1789 links.each do |link|1790 if show_type == "MO"1791 log.info "Show type - MO"1792 launch_id = link.match(/http[s]?:\/\/(www.)?itunes\.apple\.com\/us\/([a-zA-Z0-9\-\/]*)([a-zA-Z0-9\/\-\.]*)\/id([0-9]+)(\?i=)?([0-9]*)/)[4]1793 else1794 log.info "Show type - SE"1795 launch_id = link.match(/http[s]?:\/\/(www.)?itunes\.apple\.com\/us\/([a-zA-Z0-9\-\/]*)([a-zA-Z0-9\/\-\.]*)\/id([0-9]+)(\?i=)?([0-9]*)/)[6]1796 end1797 # launch_id = link.match(/http[s]?:\/\/(www.)?itunes\.apple\.com\/us\/([a-zA-Z0-9\-\/]*)([a-zA-Z0-9\/\-\.]*)\/id([0-9]+)(\?i=)?([0-9]*)/)[4]1798 arr_launch_ids.push(launch_id)1799 end1800 end1801 gn_categorised_launch_id_hash[service] = arr_launch_ids1802 log.info "Launch ids for #{service}: arr_launch_ids"1803 end1804 log.info "gn_categorised_launch_id_hash: #{gn_categorised_launch_id_hash}"1805 gn_categorised_launch_id_hash1806 end1807 def query_gn_dump_and_check_for_availability_of_movie_for_a_particular_service(client,movie_name,release_year,serv_name,log)1808 gn_coll = client[:GN_ott_episodes_ott]1809 dump_date = Date.today - 11810 gn_mongo = nil1811 cnt = gn_coll.count({"title" => /#{movie_name}/i,"release_year" => release_year,"show_type" => "MO","gn_dump_date" => dump_date})1812 if cnt == 01813 #$log.info "Can't find movie: #{movie_name} in GN dump with release_year: #{release_year}"1814 log.info "Can't find movie: #{movie_name} in GN dump with release_year: #{release_year}"1815 $arr_prog_ids.push([movie_name,release_year,"Movie not available on Rovi","Movie not available on Gracenote","FAIL"])1816 $not_avail_on_rovi_and_gn_cnt = $not_avail_on_rovi_and_gn_cnt + 11817 #$log.info "$not_avail_on_rovi_and_gn_cnt: #{$not_avail_on_rovi_and_gn_cnt}"1818 log.info "$not_avail_on_rovi_and_gn_cnt: #{$not_avail_on_rovi_and_gn_cnt}"1819 else1820 gn_coll.find({"title" => /#{movie_name}/i,"release_year" => release_year,"show_type" => "MO","gn_dump_date" => dump_date}).limit(1).each do |doc|1821 gn_mongo = nil1822 doc_json = doc.to_json1823 #log.info "Value from mongo: #{doc_json} before processing"1824 1825 parsed_doc = JSON.parse(doc_json)1826 #$log.info parsed_doc1827 log.info "Resp from GN dump: #{parsed_doc}"1828 #array_elem.push(parsed_doc)1829 gn_links_from_mongo = parsed_doc["Videos"]1830 if !gn_links_from_mongo.empty?1831 services_from_mongo = gn_links_from_mongo.keys1832 #$log.info "Filter out the GN Mongo response to contain only supported services"1833 log.info "Filter out the GN Mongo response to contain only supported services"1834 services_from_mongo.each do |key|1835 if key.downcase == serv_name1836 next1837 else1838 gn_links_from_mongo.delete(key)1839 end1840 end1841 #$log.info "gn_links_from_mongo for movie-#{movie_name} for service-#{serv_name}: #{gn_links_from_mongo}"1842 log.info "gn_links_from_mongo for movie-#{movie_name} for service-#{serv_name}: #{gn_links_from_mongo}"1843 gn_links_from_mongo_final = gn_links_from_mongo.values1844 gn_mongo = make_one_single_array(gn_links_from_mongo_final)1845 #$log.info "Main: gn_mongo for movie-#{movie_name}: #{gn_mongo}"1846 1847 else1848 gn_mongo = []1849 #$log.info "Main: GN Metadata available, but no valid gn links for program in dump"1850 log.info "Main: GN Metadata available, but no valid gn links for program in dump"1851 end1852 end1853 if !gn_mongo.empty?1854 log.info "Main: gn_mongo for movie-#{movie_name}: #{gn_mongo}"1855 $not_avail_on_rovi_but_avail_on_gn_cnt = $not_avail_on_rovi_but_avail_on_gn_cnt + 11856 #$log.info "not_avail_on_rovi_but_avail_on_gn_cnt: #{not_avail_on_rovi_but_avail_on_gn_cnt}"1857 log.info "$not_avail_on_rovi_but_avail_on_gn_cnt: #{$not_avail_on_rovi_but_avail_on_gn_cnt}"1858 $arr_prog_ids.push([movie_name,"MO",release_year,"Movie not available on Rovi","But movie available on GN.","GN links: #{gn_mongo}"])1859 else1860 $not_avail_on_rovi_and_gn_cnt = $not_avail_on_rovi_and_gn_cnt + 11861 #$log.info "$not_avail_on_rovi_and_gn_cnt: #{$not_avail_on_rovi_and_gn_cnt}"1862 log.info "$not_avail_on_rovi_and_gn_cnt: #{$not_avail_on_rovi_and_gn_cnt}"1863 $arr_prog_ids.push([movie_name,"MO",release_year,"Movie not available on Rovi","Movie not available on Gracenote","FAIL"])1864 end1865 end1866 end1867 def check_for_ingestion_of_particular_service_rovi_or_gn_ott_links_in_movie(ott_links_cloud,client,prog_id,movie_name,release_year,serv_name,log)1868 dump_date = Date.today - 11869 rovi_vids_cloud = ott_links_cloud["Rovi Videos"]1870 gn_vids_cloud = ott_links_cloud["Gracenote Videos"]1871 #$log.info rovi_vids_cloud1872 log.info "#{rovi_vids_cloud}"1873 if !rovi_vids_cloud.empty?1874 rovi_vids_mongo = get_rovi_ind_service_ott_links_from_mongo_db(client,prog_id,serv_name,log)1875 diff1 = rovi_vids_mongo - rovi_vids_cloud1876 #$log.info "Few Mongo vids are missing in cloud :#{diff1}"1877 log.info "Few Mongo vids are missing in cloud :#{diff1}"1878 diff2 = rovi_vids_cloud - rovi_vids_mongo1879 #$log.info "Extra vids in cloud which were not there in rovi dump :#{diff2}"1880 log.info "Extra vids in cloud which were not there in rovi dump :#{diff2}"1881 if diff1.empty? and diff2.empty?1882 #$log.info "Rovi Ingestion Status for movie-#{movie_name}: PASS"1883 log.info "Rovi Ingestion Status for movie-#{movie_name}: PASS"1884 $rovi_ingestion_status = "Rovi Ingestion Status: PASS"1885 $rovi_ingest_success_cnt = $rovi_ingest_success_cnt + 11886 #$log.info "Rovi Ingesion-PASS count: #{$rovi_ingest_success_cnt}"1887 log.info "Rovi Ingesion-PASS count: #{$rovi_ingest_success_cnt}"1888 else1889 #$log.info "Rovi Ingestion Status for movie-#{movie_name}: FAIL"1890 log.info "Rovi Ingestion Status for movie-#{movie_name}: FAIL"1891 $rovi_ingestion_status = "Rovi Ingestion Status: FAIL"1892 $rovi_ingest_failures_cnt = $rovi_ingest_failures_cnt + 11893 #$log.info "Rovi Ingesion-FAIL count: #{$rovi_ingest_failures_cnt}"1894 log.info "Rovi Ingesion-FAIL count: #{$rovi_ingest_failures_cnt}"1895 end1896 $arr_prog_ids.push([movie_name,"MO",release_year,prog_id,"Rovi Video Links available on cloud",$rovi_ingestion_status])1897 $avail_on_rovi_cnt = $avail_on_rovi_cnt + 11898 #$log.info "avail_on_rovi_cnt: #{$avail_on_rovi_cnt}"1899 log.info "avail_on_rovi_cnt: #{$avail_on_rovi_cnt}"1900 elsif !gn_vids_cloud.empty?1901 #$log.info "avail_on_gracenote_after_mapping_cnt: #{$avail_on_gracenote_after_mapping_cnt}"1902 log.info "avail_on_gracenote_after_mapping_cnt: #{$avail_on_gracenote_after_mapping_cnt}"1903 #gn_vids_cloud = ott_links_cloud["Gracenote Videos"]1904 # $log.info gn_vids_cloud1905 # log.info gn_vids_cloud1906 gn_coll = client[:GN_ott_episodes_ott]1907 cnt = gn_coll.count({"title" => /#{movie_name}/i,"release_year" => release_year,"show_type" => "MO","gn_dump_date" => dump_date})1908 if cnt == 01909 #$log.info "Can't find movie: #{movie_name} in GN dump with release_year: #{release_year}"1910 log.info "Can't find movie: #{movie_name} in GN dump with release_year: #{release_year}"1911 $arr_prog_ids.push([movie_name,"MO",release_year,"GN Video Links available in cloud","Unable to map with Gracenote dump,hence cannot check ingestion status"])1912 $avail_on_gracenote_and_unable_to_map_cnt = $avail_on_gracenote_and_unable_to_map_cnt + 11913 #$log.info "avail_on_gracenote_and_unable_to_map_cnt: #{$avail_on_gracenote_and_unable_to_map_cnt}"1914 log.info "avail_on_gracenote_and_unable_to_map_cnt: #{$avail_on_gracenote_and_unable_to_map_cnt}"1915 else1916 gn_coll.find({"title" => /#{movie_name}/i,"release_year" => release_year,"show_type" => "MO","gn_dump_date" => dump_date}).limit(1).each do |doc|1917 gn_vids_mongo = nil1918 doc_json = doc.to_json1919 #log.info "Value from mongo: #{doc_json} before processing"1920 1921 parsed_doc = JSON.parse(doc_json)1922 #$log.info parsed_doc1923 log.info "Resp from GN dump: #{parsed_doc}"1924 #array_elem.push(parsed_doc)1925 gn_links_from_mongo = parsed_doc["Videos"]1926 if !gn_links_from_mongo.empty?1927 services_from_mongo = gn_links_from_mongo.keys1928 #$log.info "Filter out the GN Mongo response to contain only #{serv_name} service"1929 log.info "Filter out the GN Mongo response to contain only #{serv_name} service"1930 services_from_mongo.each do |key|1931 if key.downcase == serv_name or serv_name.include? key.downcase1932 next1933 else1934 gn_links_from_mongo.delete(key)1935 end1936 end1937 else1938 gn_vids_mongo = []1939 #$log.info "Main: GN Metadata available, but no valid gn links for program in dump"1940 log.info "Main: GN Metadata available, but no valid gn links for program in dump"1941 end1942 #$log.info "gn_links_from_mongo for movie-#{movie_name}: #{gn_links_from_mongo}"1943 log.info "gn_links_from_mongo for movie-#{movie_name}: #{gn_links_from_mongo}"1944 gn_links_from_mongo_final = gn_links_from_mongo.values1945 gn_vids_mongo = make_one_single_array(gn_links_from_mongo_final)1946 #$log.info "Main: gn_vids_mongofor movie-#{movie_name}: #{gn_vids_mongo}"1947 log.info "Main: gn_vids_mongo for movie-#{movie_name}: #{gn_vids_mongo}"1948 if !gn_vids_mongo.empty? and !gn_vids_cloud.empty?1949 $avail_on_gracenote_after_mapping_cnt = $avail_on_gracenote_after_mapping_cnt + 11950 #$log.info "inside if both gn_vids_mongo and gn_vids_cloud are not empty, proceed to ingestion validation"1951 log.info "inside if both gn_vids_mongo and gn_vids_cloud are not empty, proceed to ingestion validation"1952 #$log.info "gn_vids_cloud: #{gn_vids_cloud}"1953 log.info "gn_vids_cloud: #{gn_vids_cloud}"1954 diff1 = gn_vids_mongo - gn_vids_cloud1955 #$log.info "Few GN Mongo vids are missing in cloud :#{diff1}"1956 log.info "Few GN Mongo vids are missing in cloud :#{diff1}"1957 diff2 = gn_vids_cloud - gn_vids_mongo1958 #$log.info "Extra GN vids in cloud which were not there in rovi dump :#{diff2}"1959 log.info "Extra GN vids in cloud which were not there in rovi dump :#{diff2}"1960 if diff1.empty? and diff2.empty?1961 #$log.info "GN Ingestion Status for movie-#{movie_name}: PASS"1962 log.info "GN Ingestion Status for movie-#{movie_name}: PASS"1963 $gn_ingestion_status = "GN Ingestion Status: PASS"1964 $gn_ingest_success_cnt = $gn_ingest_success_cnt + 11965 #$log.info "GN Ingestion Status: PASS count: #{$gn_ingest_success_cnt}"1966 log.info "GN Ingestion Status: PASS count: #{$gn_ingest_success_cnt}"1967 else1968 #$log.info "GN Ingestion Status for movie-#{movie_name}: FAIL"1969 log.info "GN Ingestion Status for movie-#{movie_name}: FAIL"1970 $gn_ingestion_status = "GN Ingestion Status: FAIL"1971 $gn_ingest_failures_cnt = $gn_ingest_failures_cnt + 11972 #$log.info "GN Ingestion Status: FAIL count: #{$gn_ingest_failures_cnt}"1973 log.info "GN Ingestion Status: FAIL count: #{$gn_ingest_failures_cnt}"1974 end1975 $arr_prog_ids.push([movie_name,"MO",release_year,"GN Video Links available in cloud",$gn_ingestion_status])1976 else1977 if gn_vids_mongo.empty? and gn_vids_cloud.empty?1978 #$log.info "inside if both gn_vids_mongo and gn_vids_cloud are empty"1979 log.info "inside if both gn_vids_mongo and gn_vids_cloud are empty"1980 $arr_prog_ids.push([movie_name,"MO",release_year,"Not available for Movie in Rovi & GN Dumps","Overall Status: FAIL"])1981 $not_avail_on_rovi_and_gn_cnt = $not_avail_on_rovi_and_gn_cnt + 11982 #$log.info "$not_avail_on_rovi_and_gn_cnt: #{$not_avail_on_rovi_and_gn_cnt}"1983 log.info "$not_avail_on_rovi_and_gn_cnt: #{$not_avail_on_rovi_and_gn_cnt}"1984 elsif gn_vids_mongo.empty? or gn_vids_cloud.empty?1985 $avail_on_gracenote_after_mapping_cnt = $avail_on_gracenote_after_mapping_cnt + 11986 #$log.info "One of gn_vids_mongo and gn_vids_cloud are empty, gn ingestion error"1987 log.info "One of gn_vids_mongo and gn_vids_cloud are empty, gn ingestion error"1988 $gn_ingestion_status = "GN Ingestion Status: FAIL"1989 $gn_ingest_failures_cnt = $gn_ingest_failures_cnt + 11990 #$log.info "GN Ingestion Status: FAIL count: #{$gn_ingest_failures_cnt}"1991 log.info "GN Ingestion Status: FAIL count: #{$gn_ingest_failures_cnt}"1992 $arr_prog_ids.push([movie_name,"MO",release_year,"GN Video Links available in cloud",$gn_ingestion_status])1993 end1994 end1995 end1996 end1997 $real_gn_ingestion_cnt = $avail_on_gracenote_after_mapping_cnt - $avail_on_gracenote_and_unable_to_map_cnt1998 else1999 $arr_prog_ids.push([movie_name,"MO",release_year,prog_id,"No Video Links Available in Cloud,though metadata is available","Rovi Video not Links available on cloud","GN Video Links not available in cloud","FAIL"])2000 end2001 end2002 def check_for_ingestion_of_particular_service_rovi_or_gn_ott_links_in_series_episode(ott_links_from_cloud,client,prog_id,serv_name,series_name,season_no,episode_no,episode_title,log)2003 ###################################2004 ###################################2005 #$log.info "API Spec Functions:: check_for_ingestion_of_particular_service_rovi_or_gn_ott_links_in_series_episode"2006 log.info "API Spec Functions:: check_for_ingestion_of_particular_service_rovi_or_gn_ott_links_in_series_episode"2007 dump_date = Date.today - 12008 rovi_vids_cloud = ott_links_from_cloud["Rovi Videos"]2009 gn_vids_cloud = ott_links_from_cloud["Gracenote Videos"]2010 crawler_vids_cloud = ott_links_from_cloud["Crawlers"]2011 if !rovi_vids_cloud.empty?2012 #$log.info "Episode has ott links from Rovi, proceed to validate rovi ingestion"2013 log.info "Episode has ott links from Rovi, proceed to validate rovi ingestion"2014 rovi_vids_mongo = get_rovi_ind_service_ott_links_from_mongo_db(client,prog_id,serv_name,log)2015 diff1 = rovi_vids_mongo - rovi_vids_cloud2016 #$log.info "Few Mongo vids are missing in cloud :#{diff1}"2017 log.info "Few Mongo vids are missing in cloud :#{diff1}"2018 diff2 = rovi_vids_cloud - rovi_vids_mongo2019 #$log.info "Extra vids in cloud which were not there in rovi dump :#{diff2}"2020 log.info "Extra vids in cloud which were not there in rovi dump :#{diff2}"2021 if diff1.empty? and diff2.empty?2022 #$log.info "Rovi Ingestion Status for #{series_name}, Se #{season_no}, Ep #{episode_no}: PASS"2023 log.info "Rovi Ingestion Status for #{series_name}, Se #{season_no}, Ep #{episode_no}: PASS"2024 $rovi_ingestion_status = "Rovi Ingestion Status: PASS"2025 $rovi_ingest_success_cnt = $rovi_ingest_success_cnt + 12026 #$log.info "Rovi Ingesion-PASS count: #{$rovi_ingest_success_cnt}"2027 log.info "Rovi Ingesion-PASS count: #{$rovi_ingest_success_cnt}"2028 else2029 #$log.info "Rovi Ingestion Status for #{series_name}, Se #{season_no}, Ep #{episode_no}: FAIL"2030 log.info "Rovi Ingestion Status for #{series_name}, Se #{season_no}, Ep #{episode_no}: FAIL"2031 $rovi_ingestion_status = "Rovi Ingestion Status: FAIL"2032 $rovi_ingest_failures_cnt = $rovi_ingest_failures_cnt + 12033 $episodes_with_ott_errors_cnt = $episodes_with_ott_errors_cnt + 12034 #$log.info "Rovi Ingesion-FAIL count: #{$rovi_ingest_failures_cnt}"2035 log.info "Rovi Ingesion-FAIL count: #{$rovi_ingest_failures_cnt}"2036 end2037 $arr_episode_prog_ids.push([series_name,season_no,episode_no,prog_id,"Rovi Video Links available on cloud",$rovi_ingestion_status])2038 $avail_on_rovi_cnt = $avail_on_rovi_cnt + 12039 #$log.info "avail_on_rovi_cnt: #{avail_on_rovi_cnt}"2040 log.info "avail_on_rovi_cnt: #{$avail_on_rovi_cnt}"2041 elsif !gn_vids_cloud.empty?2042 #$log.info "Episode has ott links from GN, proceed to validate gracenote ingestion"2043 log.info "Episode has ott links from GN, proceed to validate gracenote ingestion"2044 $avail_on_gracenote_after_mapping_cnt = $avail_on_gracenote_after_mapping_cnt + 12045 #$log.info "avail_on_gracenote_after_mapping_cnt: #{$avail_on_gracenote_after_mapping_cnt}"2046 log.info "avail_on_gracenote_after_mapping_cnt: #{$avail_on_gracenote_after_mapping_cnt}"2047 #gn_vids_cloud = ott_links_from_cloud["Gracenote Videos"]2048 # $log.info gn_vids_cloud2049 # log.info gn_vids_cloud2050 gn_coll = client[:GN_ott_episodes_ott]2051 cnt = gn_coll.count({"title" => /#{series_name}/i,"season_number" => "#{season_no}","episode_number" => "#{episode_no}","episode_title" => "#{episode_title}","gn_dump_date" => dump_date})2052 if cnt == 02053 #$log.info "Can't find #{series_name}, Se #{season_no}, Ep #{episode_no} in GN dump"2054 log.info "Can't find #{series_name}, Se #{season_no}, Ep #{episode_no} in GN dump"2055 $arr_episode_prog_ids.push([series_name,season_no,episode_no,prog_id,"GN Video Links are shown in cloud","Unable to map, cannot check ingestion status"])2056 $avail_on_gracenote_and_unable_to_map_cnt = $avail_on_gracenote_and_unable_to_map_cnt + 12057 #$log.info "avail_on_gracenote_and_unable_to_map_cnt: #{avail_on_gracenote_and_unable_to_map_cnt}"2058 log.info "avail_on_gracenote_and_unable_to_map_cnt: #{$avail_on_gracenote_and_unable_to_map_cnt}"2059 else2060 gn_coll.find({"title" => /#{series_name}/i,"season_number" => "#{season_no}","episode_number" => "#{episode_no}","episode_title" => "#{episode_title}","gn_dump_date" => dump_date}).limit(1).each do |doc|2061 gn_vids_mongo = nil2062 doc_json = doc.to_json2063 #log.info "Value from mongo: #{doc_json} before processing"2064 2065 parsed_doc = JSON.parse(doc_json)2066 #$log.info parsed_doc2067 log.info "Resp from GN dump: #{parsed_doc}"2068 #array_elem.push(parsed_doc)2069 gn_links_from_mongo = parsed_doc["Videos"]2070 if !gn_links_from_mongo.empty?2071 services_from_mongo = gn_links_from_mongo.keys2072 #$log.info "Filter out the GN Mongo response to contain only #{serv_name} service"2073 log.info "Filter out the GN Mongo response to contain only #{serv_name} service"2074 services_from_mongo.each do |key|2075 if key.downcase == serv_name or serv_name.include? key.downcase2076 next2077 else2078 gn_links_from_mongo.delete(key)2079 end2080 end2081 else2082 gn_vids_mongo = []2083 #$log.info "Main: GN Metadata available, but no valid gn links for program in dump"2084 log.info "Main: GN Metadata available, but no valid gn links for program in dump"2085 end2086 #$log.info "gn_links_from_mongo for #{series_name}, Se #{season_no}, Ep #{episode_no}: #{gn_links_from_mongo}"2087 log.info "gn_links_from_mongo for #{series_name}, Se #{season_no}, Ep #{episode_no}: #{gn_links_from_mongo}"2088 gn_links_from_mongo_final = gn_links_from_mongo.values2089 gn_vids_mongo = make_one_single_array(gn_links_from_mongo_final)2090 #$log.info "Main: gn_vids_mongofor #{series_name}, Se #{season_no}, Ep #{episode_no}: #{gn_vids_mongo}"2091 log.info "Main: gn_vids_mongo for #{series_name}, Se #{season_no}, Ep #{episode_no}: #{gn_vids_mongo}"2092 #$log.info "gn_vids_cloud: #{gn_vids_cloud}"2093 log.info "gn_vids_cloud: #{gn_vids_cloud}"2094 diff1 = gn_vids_mongo - gn_vids_cloud2095 #$log.info "Few GN Mongo vids are missing in cloud :#{diff1}"2096 log.info "Few GN Mongo vids are missing in cloud :#{diff1}"2097 diff2 = gn_vids_cloud - gn_vids_mongo2098 #$log.info "Extra GN vids in cloud which were not there in rovi dump :#{diff2}"2099 log.info "Extra GN vids in cloud which were not there in rovi dump :#{diff2}"2100 if diff1.empty? and diff2.empty?2101 #$log.info "GN Ingestion Status for #{series_name}, Se #{season_no}, Ep #{episode_no}: PASS"2102 log.info "GN Ingestion Status for #{series_name}, Se #{season_no}, Ep #{episode_no}: PASS"2103 $gn_ingestion_status = "GN Ingestion Status: PASS"2104 $gn_ingest_success_cnt = $gn_ingest_success_cnt + 12105 #$log.info "GN Ingestion Status: PASS count: #{$gn_ingest_success_cnt}"2106 log.info "GN Ingestion Status: PASS count: #{$gn_ingest_success_cnt}"2107 else2108 #$log.info "GN Ingestion Status for #{series_name}, Se #{season_no}, Ep #{episode_no}: FAIL"2109 log.info "GN Ingestion Status for #{series_name}, Se #{season_no}, Ep #{episode_no}: FAIL"2110 $gn_ingestion_status = "GN Ingestion Status: FAIL"2111 $gn_ingest_failures_cnt = $gn_ingest_failures_cnt + 12112 $episodes_with_ott_errors_cnt = $episodes_with_ott_errors_cnt + 12113 #$log.info "GN Ingestion Status: FAIL count: #{$gn_ingest_failures_cnt}"2114 log.info "GN Ingestion Status: FAIL count: #{$gn_ingest_failures_cnt}"2115 end2116 $arr_episode_prog_ids.push([series_name,season_no,episode_no,"GN Video Links available in cloud",$gn_ingestion_status])2117 end2118 end2119 elsif !crawler_vids_cloud.empty?2120 $episodes_with_ott_links_from_crawler = $episodes_with_ott_links_from_crawler + 12121 $arr_episode_prog_ids.push([series_name,season_no,episode_no,"Video Links available in cloud got from crawler"])2122 end2123 $real_gn_ingestion_cnt = $avail_on_gracenote_after_mapping_cnt - $avail_on_gracenote_and_unable_to_map_cnt2124 ###################################2125 ###################################2126 end2127 def validate_individual_service_links_in_all_series_episodes(client,series_name,prog_id,serv_name,netflix_no_of_seasons,log)2128 #$log.info "Ozone_Api_Specific_Functions::validate_individual_service_links_in_all_series_episodes"2129 log.info "Ozone_Api_Specific_Functions::validate_individual_service_links_in_all_series_episodes"2130 videos_got_from_cloud = {"Rovi Videos" => [],"Gracenote Videos" => [],"Crawlers" => []}2131 $episodes_without_ott_links_cnt = 02132 $episodes_cnt = 02133 $episodes_with_ott_errors_cnt = 02134 $episodes_with_ott_links_from_crawler = 02135 $rovi_ingest_success_cnt = 02136 $rovi_ingest_failures_cnt = 02137 $gn_ingest_failures_cnt = 02138 $gn_ingest_success_cnt = 02139 episodes_api = "/programs/#{prog_id}/episodes?ott=true&service=" + $serv_name2140 get episodes_api2141 response_code_validation("get",episodes_api)2142 resp = json_body2143 resp_len = resp.length2144 for i in 0..resp_len-12145 #$log.info "For loop: #{i}th episode object"2146 log.info "For loop: #{i}th episode object"2147 #$log.info "Object: #{resp[i]}"2148 log.info "Object: #{resp[i]}"2149 ott_links_from_cloud_for_ind_service = resp[i][:videos]2150 episode_title = resp[i][:original_episode_title]2151 #$log.info "Episode title: #{episode_title}"2152 log.info "Episode title: #{episode_title}"2153 ser_name = resp[i][:long_title]2154 #$log.info "Series: #{ser_name}"2155 log.info "Series: #{ser_name}"2156 seas_no = resp[i][:episode_season_number]2157 #$log.info "Season no: #{seas_no}"2158 log.info "Season no: #{seas_no}"2159 episode_no = resp[i][:episode_season_sequence]2160 #$log.info "Episode no: #{episode_no}"2161 log.info "Episode no: #{episode_no}"2162 ep_prog_id = resp[i][:id]2163 #$log.info "Episode prog id: #{ep_prog_id}"2164 log.info "Episode prog id: #{ep_prog_id}"2165 #$log.info "Seas_no type: #{seas_no.class}"2166 log.info "Seas_no type: #{seas_no.class}"2167 #$log.info "netflix_no_of_seasons type: #{netflix_no_of_seasons.class}"2168 log.info "netflix_no_of_seasonstype: #{netflix_no_of_seasons.class}"2169 if seas_no <= netflix_no_of_seasons.to_i2170 $episodes_cnt = $episodes_cnt + 12171 len = ott_links_from_cloud_for_ind_service.length2172 rovi_videos_list_got_from_cloud = Array.new2173 gracenote_videos_list_got_from_cloud = Array.new2174 crawler_videos_list_got_from_cloud = Array.new2175 if len > 02176 ##$log.info "Inside if len > O"2177 log.info "Inside if len > O"2178 2179 for i in 0..len-12180 #$log.info "FOR Loop: To iterate through all #{serv_name} ott objects of a single episode"2181 log.info "FOR Loop: To iterate through all #{serv_name} ott objects of a single episode"2182 video_obj_from_cloud = ott_links_from_cloud_for_ind_service[i]2183 ind_service_name = video_obj_from_cloud[:source_id]2184 if $serv_name == ind_service_name2185 #$log.info "#{ind_service_name} is of type #{serv_name}, going to process"2186 log.info "#{ind_service_name} is of type #{serv_name}, going to process"2187 if video_obj_from_cloud[:fetched_from].nil?2188 #$log.info "Rovi object, hence remove all dynamic key-value pairs"2189 log.info "Rovi object, hence remove all dynamic key-value pairs"2190 video_obj_from_cloud.delete(:platform)2191 video_obj_from_cloud.delete(:last_refreshed_timestamp)2192 video_obj_from_cloud.delete(:content_expiry_timestamp)2193 video_obj_from_cloud.delete(:cache_expiry_timestamp)2194 video_obj_from_cloud.delete(:launch_id)2195 video_obj_from_cloud.delete(:created_at)2196 video_obj_from_cloud.delete(:updated_at)2197 video_obj_from_cloud.delete(:refreshed_at)2198 video_obj_from_cloud.delete(:with_subscription)2199 video_obj_from_cloud.delete(:subscription_type)2200 video_obj_from_cloud.delete(:audio_languages)2201 if video_obj_from_cloud[:run_time].nil?2202 video_obj_from_cloud.delete(:run_time)2203 else2204 video_obj_from_cloud[:content_runtime_s] = video_obj_from_cloud[:run_time]2205 video_obj_from_cloud.delete(:run_time)2206 end2207 if video_obj_from_cloud[:constraints].empty?2208 video_obj_from_cloud.delete(:constraints)2209 end2210 if video_obj_from_cloud[:quality].nil?2211 video_obj_from_cloud.delete(:quality)2212 end2213 if video_obj_from_cloud[:purchase_type] == ""2214 video_obj_from_cloud.delete(:purchase_type)2215 end2216 if video_obj_from_cloud[:source_id] == "hulu"2217 video_obj_from_cloud.delete(:source_program_id)2218 end2219 rovi_videos_list_got_from_cloud.push(video_obj_from_cloud)2220 elsif video_obj_from_cloud[:fetched_from] == "gracenote"2221 #$log.info "GN object, hence adding only url to array"2222 log.info "GN object, hence adding only url to array"2223 gn_url = video_obj_from_cloud[:link][:uri]2224 gracenote_videos_list_got_from_cloud.push(gn_url)2225 elsif video_obj_from_cloud[:fetched_from] == "crawler"2226 #$log.info "Got from crawler, hence adding only url to array"2227 log.info "Got from crawler, hence adding only url to array"2228 crawler_url = video_obj_from_cloud[:link][:uri]2229 crawler_videos_list_got_from_cloud.push(crawler_url)2230 end2231 videos_got_from_cloud = {"Rovi Videos" => rovi_videos_list_got_from_cloud,"Gracenote Videos" => gracenote_videos_list_got_from_cloud,"Crawlers" => crawler_videos_list_got_from_cloud}2232 2233 #$log.info "Videos got from cloud for the service #{serv_name}: #{videos_got_from_cloud}"2234 log.info "Videos got from cloud for the service #{serv_name}: #{videos_got_from_cloud}"2235 #videos_got_from_cloud2236 #Addition of ingestion logic here2237 check_for_ingestion_of_particular_service_rovi_or_gn_ott_links_in_series_episode(videos_got_from_cloud,client,ep_prog_id,serv_name,ser_name,seas_no,episode_no,episode_title,log)2238 else2239 #$log.info "#{ind_service_name} is not of type #{serv_name}, moving to next"2240 log.info "#{ind_service_name} is not of type #{serv_name}, moving to next"2241 2242 end2243 end2244 #$log.info "END OF FOR Loop: To iterate through all #{serv_name} ott objects of a single episode"2245 log.info "END OF FOR Loop: To iterate through all #{serv_name} ott objects of a single episode"2246 else2247 #$log.info "Inside else, empty cloud response"2248 log.info "Inside else, empty cloud response"2249 #episodes_without_ott_links_cnt = episodes_without_ott_links_cnt + 12250 query_rovi_and_gn_dump_and_check_for_availability_of_episode_for_a_particular_service(client,ser_name,seas_no,episode_no,episode_title,ep_prog_id,serv_name,log)2251 #$arr_episode_prog_ids.push([ser_name,seas_no,episode_no,ep_prog_id,"No Video Links Available in Cloud"])2252 end2253 else2254 #$log.info "Exiting validation as #{netflix_no_of_seasons} is less than #{seas_no}"2255 log.info "Exiting validation as #{netflix_no_of_seasons} is less than #{seas_no}"2256 end2257 2258 end2259 #$log.info "END OF For loop which iterates across all episodes"2260 log.info "END OF For loop which iterates across all episodes"2261 if $episodes_without_ott_links_cnt > 02262 if $episodes_without_ott_links_cnt == $episodes_cnt2263 $arr_prog_ids.push([series_name,"SM",prog_id,"OTT Links not available on cloud for all episodes","Not available in Rovi Dump","Not available in GN dump","FAIL"])2264 #$log.info "#{$episodes_without_ott_links_cnt} episodes of Series #{ser_name} do not have #{serv_name} ott links at all."2265 log.info "#{$episodes_without_ott_links_cnt} episodes of Series #{ser_name} do not have #{serv_name} ott links at all."2266 else2267 $arr_prog_ids.push([series_name,"SM",prog_id,"OTT Links not available on cloud for some episodes","#{$episodes_with_ott_errors_cnt} out of #{$episodes_cnt} episodes have ott errors","FAIL"])2268 #$log.info "#{$episodes_without_ott_links_cnt} episodes of Series #{ser_name} do not have #{serv_name} ott links at all."2269 log.info "#{$episodes_without_ott_links_cnt} episodes of Series #{ser_name} do not have #{serv_name} ott links for some episodes."2270 end2271 else2272 if $rovi_ingest_failures_cnt == 0 and $gn_ingest_failures_cnt == 02273 if $rovi_ingest_success_cnt > 0 and $gn_ingest_success_cnt == 02274 $arr_prog_ids.push([series_name,"SM",prog_id,"OTT Links available on cloud for all episodes","Rovi Ingestion Status - PASS"])2275 #$log.info "#{$rovi_ingest_success_cnt} out of #{$episodes_cnt} have been ingested succesfully from rovi dump,hence ingestion -PASS"2276 log.info "#{$rovi_ingest_success_cnt} out of #{$episodes_cnt} have been ingested succesfully from rovi dump,hence Rovi Ingestion Status -PASS"2277 elsif $gn_ingest_success_cnt > 0 and $rovi_ingest_success_cnt == 02278 $arr_prog_ids.push([series_name,"SM",prog_id,"OTT Links available on cloud for all episodes","GN Ingestion Status - PASS"])2279 #$log.info "#{$gn_ingest_success_cnt} out of #{$episodes_cnt} have been ingested succesfully from gn dump,hence ingestion -PASS"2280 log.info "#{$gn_ingest_success_cnt} out of #{$episodes_cnt} have been ingested succesfully from gn dump,hence GN Ingestion Status -PASS"2281 else2282 $arr_prog_ids.push([series_name,"SM",prog_id,"OTT Links available on cloud for all episodes","Ingestion status from both Rovi & GN - PASS"])2283 #$log.info "#{$gn_ingest_success_cnt} out of #{$episodes_cnt} have been ingested succesfully from gn dump,hence ingestion -PASS"2284 log.info "#{$gn_ingest_success_cnt} out of #{$episodes_cnt} have been ingested succesfully from gn dump,hence GN Ingestion Status -PASS"2285 end2286 else2287 $arr_prog_ids.push([series_name,"SM",prog_id,"OTT Links available on cloud for all episodes,but there ingestion failures","#{$episodes_with_ott_errors_cnt} out of #{$episodes_cnt} episodes have ott errors","FAIL"])2288 #$log.info "#{$rovi_ingest_failures_cnt} out of #{$episodes_cnt} have ingestion failures,hence ingestion status -FAIL"2289 log.info "#{$rovi_ingest_failures_cnt} out of #{$episodes_cnt} have ingestion failures,hence ingestion status -FAIL"2290 #$log.info "#{$gn_ingest_failures_cnt} out of #{$episodes_cnt} have ingestion failures,hence ingestion status -FAIL"2291 log.info "#{$gn_ingest_failures_cnt} out of #{$episodes_cnt} have ingestion failures,hence ingestion status -FAIL"2292 end2293 end2294 end2295 def query_gn_dump_and_check_for_availability_of_series_for_a_particular_service(client,series_name,serv_name,netflix_year,netflix_no_of_seasons,log)2296 #$log.info "API Spec Functions::query_gn_dump_and_check_for_availability_of_series_for_a_particular_service"2297 log.info "API Spec Functions::query_gn_dump_and_check_for_availability_of_series_for_a_particular_service"2298 series_avail_on_gn_flag = false2299 dump_date = Date.today - 12300 gn_coll = client[:GN_ott_episodes_ott]2301 cnt = gn_coll.count({"title" => /#{series_name}/i,"show_type" => "SM","gn_dump_date" => dump_date})2302 if cnt == 02303 #$log.info "Can't find series: #{series_name} in GN dump"2304 log.info "Can't find series: #{series_name} in GN dump"2305 $arr_prog_ids.push([series_name,"SM",netflix_year,netflix_no_of_seasons,"Series not available on Rovi","Series not available on Gracenote","FAIL"])2306 $not_avail_on_rovi_and_gn_cnt = $not_avail_on_rovi_and_gn_cnt + 12307 #$log.info "not_avail_on_rovi_and_gn_cnt: #{$not_avail_on_rovi_and_gn_cnt}"2308 log.info "not_avail_on_rovi_and_gn_cnt: #{$not_avail_on_rovi_and_gn_cnt}"2309 else2310 #$log.info "There are #{cnt} docs returned by mongo db when querying #{series_name}, let's see more details"2311 log.info "There are #{cnt} docs returned by mongo db when querying #{series_name}, let's see more details"2312 gn_coll.find({"title" => /#{series_name}/i,"show_type" => "SM","gn_dump_date" => dump_date}).limit(1).each do |doc|2313 gn_mongo = nil2314 doc_json = doc.to_json2315 parsed_doc = JSON.parse(doc_json)2316 #$log.info parsed_doc2317 log.info "Resp from GN dump: #{parsed_doc}"2318 #array_elem.push(parsed_doc)2319 gn_links_from_mongo = parsed_doc["Videos"]2320 episode_title = parsed_doc["episode_title"]2321 season_number = parsed_doc["season_number"]2322 episode_number = parsed_doc["episode_number"]2323 if !gn_links_from_mongo.empty?2324 services_from_mongo = gn_links_from_mongo.keys2325 #$log.info "Filter out the GN Mongo response to contain only supported services"2326 log.info "Filter out the GN Mongo response to contain only supported services"2327 services_from_mongo.each do |key|2328 if key.downcase == serv_name or serv_name.include? key.downcase2329 next2330 else2331 gn_links_from_mongo.delete(key)2332 end2333 end2334 series_avail_on_gn_flag = true2335 #$log.info "gn_links_from_mongo for series-#{series_name}: #{gn_links_from_mongo}"2336 log.info "gn_links_from_mongo for series-#{series_name}: #{gn_links_from_mongo}"2337 gn_links_from_mongo_final = gn_links_from_mongo.values2338 gn_mongo = make_one_single_array(gn_links_from_mongo_final)2339 #$log.info "Main: gn mongo for movie-#{series_name}: #{gn_mongo}"2340 log.info "Main: gn mongo for series-#{series_name}: #{gn_mongo}"2341 $arr_episode_prog_ids.push([series_name,season_number,episode_number,episode_title,"Available on GN dump but not available in cloud","Links:#{gn_mongo}"])2342 2343 else2344 gn_mongo = []2345 #$log.info "Main: GN Metadata available, but no valid gn links for program in dump"2346 log.info "Main: GN Metadata available, but no valid gn links for program in dump"2347 $not_avail_on_rovi_and_gn_cnt = $not_avail_on_rovi_and_gn_cnt + 12348 end2349 end2350 if series_avail_on_gn_flag2351 $not_avail_on_rovi_but_avail_on_gn_cnt = $not_avail_on_rovi_but_avail_on_gn_cnt + 12352 #$log.info "not_avail_on_rovi_but_avail_on_gn_cnt: #{$not_avail_on_rovi_but_avail_on_gn_cnt}"2353 log.info "not_avail_on_rovi_but_avail_on_gn_cnt: #{$not_avail_on_rovi_but_avail_on_gn_cnt}"2354 $arr_prog_ids.push([series_name,"SM",netflix_year,netflix_no_of_seasons,"Series not available on Rovi","Series available on GN."])2355 end2356 end2357 2358 end2359 def query_rovi_and_gn_dump_and_check_for_availability_of_episode_for_a_particular_service(client,ser_name,seas_no,episode_no,episode_title,ep_prog_id,serv_name,log)2360 #$log.info "API spec: query_rovi_and_gn_dump_and_check_for_availability_of_episode_for_a_particular_service"2361 log.info "API spec: query_rovi_and_gn_dump_and_check_for_availability_of_episode_for_a_particular_service"2362 rovi_vids_mongo = get_rovi_ind_service_ott_links_from_mongo_db(client,ep_prog_id,serv_name,log)2363 if !rovi_vids_mongo.nil?2364 log.info "!rovi_vids_mongo.nil?"2365 if rovi_vids_mongo.empty?2366 log.info "rovi_vids_mongo.empty?"2367 rovi_vids_mongo = nil2368 end2369 end2370 gn_vids_mongo = query_gn_dump_for_availability_of_episode_and_return_links_if_any(client,ser_name,seas_no,episode_no,episode_title,serv_name,log)2371 if rovi_vids_mongo.nil? and gn_vids_mongo.nil?2372 log.info "rovi_vids_mongo.nil? and gn_vids_mongo.nil?"2373 rovi_vids_mongo = get_rovi_ind_service_ott_links_from_mongo_db(client,ep_prog_id,serv_name,log)2374 $episodes_without_ott_links_cnt = $episodes_without_ott_links_cnt + 12375 log.info "$episodes_without_ott_links_cnt up: #{$episodes_without_ott_links_cnt}"2376 $episodes_with_ott_errors_cnt = $episodes_with_ott_errors_cnt + 12377 log.info "$episodes_with_ott_errors_cnt up: #{$episodes_with_ott_errors_cnt}"2378 $arr_episode_prog_ids.push([ser_name,seas_no,episode_no,ep_prog_id,"No Video Links Available in Cloud,though metadata is available","No links available in Rovi Dump","No links available in GN Dump","FAIL"])2379 elsif !rovi_vids_mongo.nil? and !gn_vids_mongo.nil?2380 log.info "!rovi_vids_mongo.nil? and !gn_vids_mongo.nil?"2381 $episodes_with_ott_errors_cnt = $episodes_with_ott_errors_cnt + 12382 log.info "$episodes_with_ott_errors_cnt up: #{$episodes_with_ott_errors_cnt}"2383 $arr_episode_prog_ids.push([ser_name,seas_no,episode_no,ep_prog_id,"No Video Links Available in Cloud,though metadata is available","Links available in Rovi Dump","Links available in GN Dump","FAIL"])2384 elsif !rovi_vids_mongo.nil?2385 log.info "!rovi_vids_mongo.nil?"2386 $episodes_with_ott_errors_cnt = $episodes_with_ott_errors_cnt + 12387 log.info "$episodes_with_ott_errors_cnt up: #{$episodes_with_ott_errors_cnt}"2388 $rovi_ingest_failures_cnt = $rovi_ingest_failures_cnt + 12389 log.info "$rovi_ingest_failures_cnt up: #{$rovi_ingest_failures_cnt}"2390 $arr_episode_prog_ids.push([ser_name,seas_no,episode_no,ep_prog_id,"No Video Links Available in Cloud,though metadata is available","Links available in Rovi Dump","FAIL"])2391 elsif !gn_vids_mongo.nil?2392 log.info " !gn_vids_mongo.nil?"2393 $episodes_with_ott_errors_cnt = $episodes_with_ott_errors_cnt + 12394 log.info "$episodes_with_ott_errors_cnt up: #{$episodes_with_ott_errors_cnt}"2395 $gn_ingest_failures_cnt = $gn_ingest_failures_cnt + 12396 log.info "$gn_ingest_failures_cnt up: #{$gn_ingest_failures_cnt}"2397 $arr_episode_prog_ids.push([ser_name,seas_no,episode_no,ep_prog_id,"No Video Links Available in Cloud,though metadata is available","Links available in GN Dump","FAIL"])2398 end2399 2400 end2401 def query_gn_dump_for_availability_of_episode_and_return_links_if_any(client,series_name,season_no,episode_no,episode_title,serv_name,log)2402 gn_coll = client[:GN_ott_episodes_ott]2403 dump_date = Date.today - 12404 gn_vids_mongo = nil2405 cnt = gn_coll.count({"title" => /#{series_name}/i,"season_number" => "#{season_no}","episode_number" => "#{episode_no}","episode_title" => "#{episode_title}","gn_dump_date" => dump_date})2406 if cnt == 02407 #$log.info "Can't find #{series_name}, Se #{season_no}, Ep #{episode_no} in GN dump"2408 log.info "Can't find #{series_name}, Se #{season_no}, Ep #{episode_no}, #{episode_title} in GN dump"2409 else2410 gn_coll.find({"title" => /#{series_name}/i,"season_number" => "#{season_no}","episode_number" => "#{episode_no}","episode_title" => "#{episode_title}","gn_dump_date" => dump_date}).limit(1).each do |doc|2411 doc_json = doc.to_json2412 #log.info "Value from mongo: #{doc_json} before processing"2413 parsed_doc = JSON.parse(doc_json)2414 #$log.info parsed_doc2415 log.info "Resp from GN dump: #{parsed_doc}"2416 #array_elem.push(parsed_doc)2417 gn_links_from_mongo = parsed_doc["Videos"]2418 if !gn_links_from_mongo.empty?2419 services_from_mongo = gn_links_from_mongo.keys2420 #$log.info "Filter out the GN Mongo response to contain only #{serv_name} service"2421 log.info "Filter out the GN Mongo response to contain only #{serv_name} service"2422 services_from_mongo.each do |key|2423 if key.downcase == serv_name or serv_name.include? key.downcase2424 next2425 else2426 gn_links_from_mongo.delete(key)2427 end2428 end2429 #$log.info "gn_links_from_mongo for #{series_name}, Se #{season_no}, Ep #{episode_no}: #{gn_links_from_mongo}"2430 log.info "gn_links_from_mongo for #{series_name}, Se #{season_no}, Ep #{episode_no}: #{gn_links_from_mongo}"2431 gn_links_from_mongo_final = gn_links_from_mongo.values2432 gn_vids_mongo = make_one_single_array(gn_links_from_mongo_final)2433 #$log.info "Main: gn_vids_mongofor #{series_name}, Se #{season_no}, Ep #{episode_no}: #{gn_vids_mongo}"2434 log.info "Main: gn_vids_mongo for #{series_name}, Se #{season_no}, Ep #{episode_no}: #{gn_vids_mongo}"2435 else2436 gn_vids_mongo = []2437 #$log.info "Main: GN Metadata available, but no valid gn links for program in dump"2438 log.info "Main: GN Metadata available, but no valid gn links for program in dump"2439 end2440 end2441 end2442 if !gn_vids_mongo.nil?2443 if gn_vids_mongo.empty?2444 gn_vids_mongo = nil2445 end2446 end2447 gn_vids_mongo2448 end2449 def get_program_details(wl_obj)2450 prog_details = {}2451 prog_details["id"] = nil2452 prog_name = wl_obj[:long_title]2453 prog_details["name"] = prog_name2454 $log.info "prog_name: #{prog_name}"2455 show_type = wl_obj[:show_type]2456 prog_details["show_type"] = show_type2457 $log.info "show_type: #{show_type}"2458 case show_type2459 when "SE"2460 prog_id = wl_obj[:series_id]2461 prog_details["id"] = prog_id2462 $log.info "Series id: #{prog_id}"2463 # episode_title = wl_obj[:original_episode_title]2464 # prog_details["episode_title"] = episode_title2465 # $log.info "episode_title: #{episode_title}"2466 season_number = wl_obj[:episode_season_number]2467 prog_details["season_num"] = season_number2468 $log.info "season_number: #{season_number}"2469 episode_number = wl_obj[:episode_season_sequence]2470 prog_details["episode_num"] = episode_number2471 $log.info "episode_number: #{episode_number}"2472 when "SN"2473 prog_id = wl_obj[:series_id]2474 prog_details["id"] = prog_id2475 $log.info "Series id: #{prog_id}"2476 season_number = wl_obj[:season_number]2477 prog_details["season_num"] = season_number2478 $log.info "season_number: #{season_number}"2479 prog_details["episode_num"] = 12480 $log.info "Setting episode number to 1"2481 prog_details["show_type"] = "SE"2482 when "MO"2483 prog_id = wl_obj[:id]2484 prog_details["id"] = prog_id2485 $log.info "Movie id: #{prog_id}"2486 rel_year = wl_obj[:release_year]2487 prog_details["rel_year"] = rel_year2488 $log.info "rel_year: #{rel_year}"2489 end2490 $log.info "prog_details!!!: #{prog_details}"2491 prog_details2492 end2493 def watchlist_test(serv,serv_feed)2494 intent_arr = ["","play","watch","resume"]2495 for i in 0..22496 iteration = i+12497 $log.info "Iteration: #{iteration}, Service: #{serv}"2498 intent = intent_arr.sample2499 wl_obj = serv_feed.sample2500 prog_details = get_program_details(wl_obj)2501 prog_name = prog_details["name"]2502 api_part1 = "/voice_search?q="2503 api = api_part1 + intent + "%20" + prog_name2504 api_url = $base_url + api2505 $current_url = api_url2506 $log.info "The complete url to be tested is - #{api_url}<br>"2507 #Run the get api2508 get api2509 # 1.Response Code Validation2510 response_code_validation("get",api)2511 $log.info "Completed response code validation<br>"2512 $resp_code_validation_status = true2513 ott_search_index = get_index_of_ott_search_object(json_body)2514 $log.info "ott_search_index: #{ott_search_index}"2515 # 2.Schema Validation2516 program_search_schema_validation_new(api_url,json_body,ott_search_index)2517 $log.info "Completed schema validation, proceeding to complete response validation for mandatory fields<br>"2518 $schema_validation_status = true2519 # 3. JSON response validation2520 watchlist_search_response_validation(serv,prog_details,json_body,ott_search_index)2521 $log.info "Completed response validation"2522 $values_matching_validation_status = true2523 end2524 end2525 def post_device_details(type)2526 it 'posts device with details' do2527 $log.info "API Specs::post_device_details"2528 api = "/switches/devices"2529 devices = $conf["box_devices"]2530 devices_by_name = devices.keys2531 devices_by_id = devices.values2532 $log.info "Devices: #{devices}"2533 if type == "random"2534 $log.info "if :: random device to post"2535 rand_dev = devices_by_name.sample2536 rand_dev_id = devices[rand_dev]2537 rand_port = ports.sample2538 $random_device = {"port"=>rand_port, "device_id"=>rand_dev_id, "device_name"=>rand_dev}2539 $log.info "if :: random device-#{rand_dev}, id-#{rand_dev_id}"2540 req_body = { "port"=>rand_port, "device_id"=>rand_dev_id, "device_name"=>rand_dev, "scan_method"=>"" }2541 post api, req_body2542 response_code_validation("get")2543 elsif type == "all"2544 $log.info "elsif :: post all devices"2545 ports = [0,1,2,3,4,5,6,8]2546 i = 02547 devices_by_name.each do|dev|2548 dev_id = devices[dev]2549 port = ports[i]2550 req_body = { "port"=>port, "device_id"=>dev_id, "device_name"=>dev, "scan_method"=>"" }2551 $log.info "Req body to be posted is: #{req_body}"2552 retry_cnt = 02553 begin2554 post api, req_body2555 expect_status(200)2556 rescue Exception => exp_err2557 $log.info "Caught exception-'#{exp_err}' while trying to post data. Going to retry"2558 if retry_cnt < 32559 $log.info "Retry - #{retry_cnt}"2560 retry_cnt += 12561 retry2562 else2563 raise "Getting nil response for api:#{api} on 3 retry attempts"2564 end2565 end2566 i += 12567 sleep 0.52568 end2569 else2570 $log.info "else :: post specific device-#{type}"2571 if type == "Roku"2572 ports = [0,2,4,6]2573 port = ports.sample2574 $dev_port1 = port2575 else2576 ports = [1,3,5,7]2577 port = ports.sample2578 $dev_port2 = port2579 end2580 dev = type2581 dev_id = devices[dev]2582 $log.info "Port on which #{type} is posted: #{$dev_port}"2583 req_body = { "port"=>port, "device_id"=>dev_id, "device_name"=>dev, "scan_method"=>"" }2584 $log.info "Req body to be posted is: #{req_body}"2585 post api, req_body2586 retry_cnt = 02587 begin2588 post api, req_body2589 expect_status(200)2590 rescue Exception => exp_err2591 $log.info "Caught exception-'#{exp_err}' while trying to post data. Going to retry"2592 if retry_cnt < 32593 $log.info "Retry - #{retry_cnt}"2594 retry_cnt += 12595 retry2596 else2597 raise "Getting nil response for api:#{api} on 3 retry attempts"2598 end2599 end2600 end2601 end2602 end2603 def delete_all_devices_from_switch()2604 it 'deletes devices associated with switch' do2605 $log.info "API Specs::delete_all_devices_from_switch"2606 ports = [0,1,2,3,4,5,6,7,8]2607 api = "/switches/devices"2608 ports.each do |port|2609 $log.info "Deleting device at Port: #{port}"2610 req_body = { "port"=>port, "device_id"=>"not_conn", "device_name"=>"", "scan_method"=>"" }2611 retry_cnt = 02612 begin2613 post api, req_body2614 expect_status(200)2615 rescue Exception => exp_err2616 $log.info "Caught exception-'#{exp_err}' while trying to post data. Going to retry"2617 if retry_cnt < 32618 $log.info "Retry - #{retry_cnt}"2619 retry_cnt += 12620 retry2621 else2622 raise "Getting nil response for api:#{api} on 3 retry attempts"2623 end2624 end2625 end2626 end2627 end2628 def get_device_details(type,devs=nil)2629 it 'gets device details' do2630 $log.info "API Specs::get_device_details"2631 api = "/switches/devices"2632 devices = $conf["box_devices"]2633 devices_by_name = devices.keys2634 devices_by_id = devices.values2635 $log.info "Devices: #{devices}"2636 if type == "single"2637 $log.info "if :: seeing single device was added"2638 get api2639 response_code_validation("get",api)2640 $log.info "response - #{json_body}"2641 switches_device_schema_validation()2642 response_validation_switches_devices(type,devs)2643 elsif type == "many"2644 $log.info "elsif :: many cond - seeing the devices added"2645 get api2646 response_code_validation("get",api)2647 $log.info "response - #{json_body}"2648 switches_device_schema_validation()2649 response_validation_switches_devices(type,devs)2650 elsif type == "all"2651 $log.info "elsif :: see if all devices were posted succesfully"2652 get api2653 response_code_validation("get",api)2654 $log.info "response - #{json_body}"2655 switches_device_schema_validation(type)2656 response_validation_switches_devices(type,devs)2657 elsif type == "none"2658 $log.info "elsif :: see if no devices are available for box"2659 get api2660 response_code_validation("get",api)2661 $log.info "response - #{json_body}"2662 switches_device_schema_validation(type)2663 response_validation_switches_devices(type,devs)2664 else2665 $log.info "else::see if specific device-#{type} was posted"2666 get api2667 response_code_validation("get",api)2668 $log.info "response - #{json_body}"2669 switches_device_schema_validation()2670 response_validation_switches_devices(type)2671 end2672 end2673 end 2674 def get_app_details_for_devices(type,devs=nil)2675 it 'gets app details of a switch based on devices connected to it' do2676 $log.info "API Specs::get_app_details"2677 api = "/switches/apps"2678 devices = $conf["box_devices"]2679 devices_by_name = devices.keys2680 devices_by_id = devices.values2681 $log.info "Devices: #{devices}"2682 if type == "single"2683 $log.info "if :: single device case:"2684 dev_id = devices[devs]2685 get api2686 response_code_validation("get",api)2687 $log.info "response - #{json_body}"2688 switches_apps_schema_validation()2689 response_validation_switches_apps(type,devs)2690 elsif type == "many"2691 $log.info "if :: many devices case"2692 get api2693 response_code_validation("get",api)2694 $log.info "response - #{json_body}"2695 switches_apps_schema_validation()2696 response_validation_switches_apps(type,devs,json_body)2697 elsif type == "all"2698 $log.info "elsif :: see if all devices were posted succesfully"2699 get api2700 response_code_validation("get",api)2701 $log.info "response - #{json_body}"2702 switches_apps_schema_validation()2703 response_validation_switches_apps(type,devs,json_body)2704 else2705 $log.info "else::see if specific device-#{type} is available for apps in response"2706 dev = type2707 dev_id = devices[dev]2708 get api2709 response_code_validation("get",api)2710 $log.info "response - #{json_body}"2711 switches_apps_schema_validation()2712 response_validation_switches_apps(type)2713 end2714 end2715 end 2716 def select_apps_and_post()2717 it 'Select apps and post the ids to cloud - switches/profiles/apps' do2718 $log.info "API Specs :: select_apps_and_post"2719 api = "/switches/profiles/apps"2720 apps_selected = $conf["apps_selected_in_box"]2721 req_body = { "apps"=> apps_selected}2722 retry_cnt = 02723 begin2724 post api, req_body2725 expect_status(200)2726 rescue Exception => exp_err2727 $log.info "Caught exception-'#{exp_err}' while trying to post data. Going to retry"2728 if retry_cnt < 32729 $log.info "Retry - #{retry_cnt}"2730 retry_cnt += 12731 retry2732 else2733 raise "Getting nil response for api:#{api} on 3 retry attempts"2734 end2735 end2736 end2737 end2738 def post_corresponding_services_and_post()2739 it 'Post corresponding services to cloud - switches/profiles/profiles' do2740 $log.info "API Specs :: post_corresponding_services_and_post"2741 api = "/switches/profiles/services"2742 services_selected = $conf["services_selected_in_box"]2743 req_body = { "services" => services_selected }2744 retry_cnt = 02745 begin2746 post api, req_body2747 expect_status(200)2748 rescue Exception => exp_err2749 $log.info "Caught exception-'#{exp_err}' while trying to post data. Going to retry"2750 if retry_cnt < 32751 $log.info "Retry - #{retry_cnt}"2752 retry_cnt += 12753 retry2754 else2755 raise "Getting nil response for api:#{api} on 3 retry attempts"2756 end2757 end2758 end2759 end2760 def delete_switches_profiles_apps()2761 it "Deletes apps from switches/profiles" do2762 $log.info "API Specs :: delete_switches_profiles_apps"2763 api = "/switches/profiles/apps"2764 retry_cnt = 02765 begin2766 delete api2767 expect_status(200)2768 rescue Exception => exp_err2769 $log.info "Caught exception-'#{exp_err}' while trying to post data. Going to retry"2770 if retry_cnt < 32771 $log.info "Retry - #{retry_cnt}"2772 retry_cnt += 12773 retry2774 else2775 raise "Getting nil response for api:#{api} on 3 retry attempts"2776 end2777 end2778 end2779 end2780 def delete_switches_profiles_services()2781 it "Deletes services from switches/profiles" do2782 $log.info "API Specs :: delete_switches_profiles_services"2783 api = "/switches/profiles/services"2784 retry_cnt = 02785 begin2786 delete api2787 expect_status(200)2788 rescue Exception => exp_err2789 $log.info "Caught exception-'#{exp_err}' while trying to post data. Going to retry"2790 if retry_cnt < 32791 $log.info "Retry - #{retry_cnt}"2792 retry_cnt += 12793 retry2794 else2795 raise "Getting nil response for api:#{api} on 3 retry attempts"2796 end2797 end2798 end2799 end2800 def check_switches_profiles_updated_with_apps_and_services()2801 it "Checks switches/profiles is updated" do2802 $log.info "API Specs :: see_switches_profiles_updated_with_apps_and_services"2803 api = "/switches/profiles"2804 retry_cnt = 02805 apps_selected = $conf["apps_selected_in_box"]2806 services_selected = $conf["services_selected_in_box"]2807 get api2808 response_code_validation("get",api)2809 expect_json("apps",apps_selected)2810 expect_json("services",services_selected)2811 end2812 end2813 def arrange_ottlinks_from_cloud(json_body,log)2814 log.info "Ozone Api Spec Functions::arrange_ottlinks_from_cloud"2815 rovi_videos_list_got_from_cloud = Array.new2816 gracenote_videos_list_got_from_cloud = Array.new2817 hulu_videos_list_got_from_cloud = Array.new2818 vudu_videos_list_got_from_cloud = Array.new2819 crawler_videos_list_got_from_cloud = Array.new2820 all_videos_list_got_from_cloud = Array.new2821 videos_got_from_cloud = {"Rovi Videos"=> [],"Gracenote Videos"=> [],"Hulu Videos"=> [],"Vudu Videos"=> [],"Crawler Videos"=>[],"All Videos" => []}2822 2823 len = json_body.length2824 if len > 02825 #$log.info "Inside if len > O"2826 log.info "videos count from cloud for the episode: #{json_body.length}"2827 2828 for i in 0..len-12829 video_obj_from_cloud = json_body[i]2830 log.info "video_obj_from_cloud:: #{video_obj_from_cloud}"2831 video_obj_from_cloud.delete(:platform)2832 video_obj_from_cloud.delete(:last_refreshed_timestamp)2833 video_obj_from_cloud.delete(:content_expiry_timestamp)2834 video_obj_from_cloud.delete(:cache_expiry_timestamp)2835 video_obj_from_cloud.delete(:launch_id)2836 video_obj_from_cloud.delete(:created_at)2837 video_obj_from_cloud.delete(:updated_at)2838 video_obj_from_cloud.delete(:refreshed_at)2839 video_obj_from_cloud.delete(:with_subscription)2840 video_obj_from_cloud.delete(:subscription_type)2841 video_obj_from_cloud.delete(:audio_languages)2842 if video_obj_from_cloud[:run_time].nil?2843 video_obj_from_cloud.delete(:run_time)2844 else2845 video_obj_from_cloud[:content_runtime_s] = video_obj_from_cloud[:run_time]2846 video_obj_from_cloud.delete(:run_time)2847 end2848 if video_obj_from_cloud[:constraints].nil? or video_obj_from_cloud[:constraints].empty?2849 video_obj_from_cloud.delete(:constraints)2850 end2851 if video_obj_from_cloud[:quality].nil?2852 video_obj_from_cloud.delete(:quality)2853 end2854 if video_obj_from_cloud[:purchase_type] == ""2855 video_obj_from_cloud.delete(:purchase_type)2856 end2857 if video_obj_from_cloud[:source_id] == "hulu"2858 video_obj_from_cloud.delete(:source_program_id)2859 end2860 if video_obj_from_cloud[:fetched_from].nil?2861 rovi_videos_list_got_from_cloud.push(video_obj_from_cloud)2862 elsif video_obj_from_cloud[:fetched_from] == "gracenote"2863 # gn_url = video_obj_from_cloud[:link][:uri]2864 # gracenote_videos_list_got_from_cloud.push(gn_url)2865 gracenote_videos_list_got_from_cloud.push(video_obj_from_cloud)2866 elsif video_obj_from_cloud[:fetched_from] == "hulu"2867 hulu_videos_list_got_from_cloud.push(video_obj_from_cloud)2868 elsif video_obj_from_cloud[:fetched_from] == "vudu"2869 vudu_videos_list_got_from_cloud.push(video_obj_from_cloud)2870 elsif video_obj_from_cloud[:fetched_from] == "crawler"2871 crawler_videos_list_got_from_cloud.push(video_obj_from_cloud)2872 end2873 all_videos_list_got_from_cloud.push(video_obj_from_cloud)2874 end2875 else2876 #$log.info "Inside else, empty cloud response"2877 log.info "Inside else, empty cloud response"2878 end2879 videos_got_from_cloud = {"Rovi Videos"=> rovi_videos_list_got_from_cloud,"Gracenote Videos"=> gracenote_videos_list_got_from_cloud,"Hulu Videos"=> hulu_videos_list_got_from_cloud,"Vudu Videos"=> vudu_videos_list_got_from_cloud,"Crawler Videos"=>crawler_videos_list_got_from_cloud,"All Videos"=> all_videos_list_got_from_cloud}2880 log.info "Videos got from Rovi cloud: #{rovi_videos_list_got_from_cloud}"2881 log.info "Videos got from Gn cloud: #{gracenote_videos_list_got_from_cloud}"2882 #$log.info "Videos got from cloud: #{videos_got_from_cloud}"2883 log.info "Videos got from cloud: #{videos_got_from_cloud}"2884 videos_got_from_cloud2885 end2886 def get_all_ottlinks_from_cloud(prog_id,log)2887 log.info "Ozone Api Spec Functions::get_all_ottlinks_from_cloud"2888 rovi_videos_list_got_from_cloud = Array.new2889 gracenote_videos_list_got_from_cloud = Array.new2890 hulu_videos_list_got_from_cloud = Array.new2891 vudu_videos_list_got_from_cloud = Array.new2892 crawler_videos_list_got_from_cloud = Array.new2893 all_videos_list_got_from_cloud = Array.new2894 videos_got_from_cloud = {"Rovi Videos"=> [],"Gracenote Videos"=> [],"Hulu Videos"=> [],"Vudu Videos"=> [],"Crawler Videos"=>[],"All Videos" => []}2895 2896 get "/programs/#{prog_id}/videos"2897 expect_status('200')2898 #$log.info json_body2899 len = json_body.length2900 if len > 02901 #$log.info "Inside if len > O"2902 log.info "videos count from cloud for the episode: #{json_body.length}"2903 2904 for i in 0..len-12905 video_obj_from_cloud = json_body[i]2906 log.info "video_obj_from_cloud:: #{video_obj_from_cloud}"2907 video_obj_from_cloud.delete(:platform)2908 video_obj_from_cloud.delete(:last_refreshed_timestamp)2909 video_obj_from_cloud.delete(:content_expiry_timestamp)2910 video_obj_from_cloud.delete(:cache_expiry_timestamp)2911 video_obj_from_cloud.delete(:launch_id)2912 video_obj_from_cloud.delete(:created_at)2913 video_obj_from_cloud.delete(:updated_at)2914 video_obj_from_cloud.delete(:refreshed_at)2915 video_obj_from_cloud.delete(:with_subscription)2916 video_obj_from_cloud.delete(:subscription_type)2917 video_obj_from_cloud.delete(:audio_languages)2918 if video_obj_from_cloud[:run_time].nil?2919 video_obj_from_cloud.delete(:run_time)2920 else2921 video_obj_from_cloud[:content_runtime_s] = video_obj_from_cloud[:run_time]2922 video_obj_from_cloud.delete(:run_time)2923 end2924 if video_obj_from_cloud[:constraints].nil? or video_obj_from_cloud[:constraints].empty?2925 video_obj_from_cloud.delete(:constraints)2926 end2927 if video_obj_from_cloud[:quality].nil?2928 video_obj_from_cloud.delete(:quality)2929 end2930 if video_obj_from_cloud[:purchase_type] == ""2931 video_obj_from_cloud.delete(:purchase_type)2932 end2933 if video_obj_from_cloud[:source_id] == "hulu"2934 video_obj_from_cloud.delete(:source_program_id)2935 end2936 if video_obj_from_cloud[:fetched_from].nil?2937 rovi_videos_list_got_from_cloud.push(video_obj_from_cloud)2938 elsif video_obj_from_cloud[:fetched_from] == "gracenote"2939 # gn_url = video_obj_from_cloud[:link][:uri]2940 # gracenote_videos_list_got_from_cloud.push(gn_url)2941 gracenote_videos_list_got_from_cloud.push(video_obj_from_cloud)2942 elsif video_obj_from_cloud[:fetched_from] == "hulu"2943 hulu_videos_list_got_from_cloud.push(video_obj_from_cloud)2944 elsif video_obj_from_cloud[:fetched_from] == "vudu"2945 vudu_videos_list_got_from_cloud.push(video_obj_from_cloud)2946 elsif video_obj_from_cloud[:fetched_from] == "crawler"2947 crawler_videos_list_got_from_cloud.push(video_obj_from_cloud)2948 end...

Full Screen

Full Screen

debriefs_controller_test.rb

Source:debriefs_controller_test.rb Github

copy

Full Screen

...30 assert_redirected_to debrief_url(@debrief)31 end32 test "should destroy debrief" do33 assert_difference('Debrief.count', -1) do34 delete debrief_url(@debrief)35 end36 assert_redirected_to debriefs_url37 end38end...

Full Screen

Full Screen

base.rb

Source:base.rb Github

copy

Full Screen

...33 end34 def put(url, put_body = nil, headers = nil)35 @response = make_request(:put, url, body: put_body, headers: headers)36 end37 def delete(url, delete_body = nil, headers = nil)38 @response = make_request(:delete, url, body: delete_body, headers: headers)39 end40 def head(url, headers = nil)41 @response = make_request(:head, url, headers: headers)42 end43 def options(url, headers = nil)44 @response = make_request(:options, url, headers: headers)45 end46 def response47 @response48 end49 def headers50 HashWithIndifferentAccess.new(response.headers)51 end52 def body...

Full Screen

Full Screen

delete

Using AI Code Generation

copy

Full Screen

1 expect_status(204)2 expect_status(204)3 expect_status(204)4 expect_status(204)5 expect_status(204)6 expect_status(204)7 expect_status(204)

Full Screen

Full Screen

delete

Using AI Code Generation

copy

Full Screen

1 expet_sttu(204)2 expe2t_status(204)3/e expet_sttu(204)4exscribta'Dus(20'45 expet_sttu(204)6 expt_sttu(204)7 expect_status(204)8 expt_sttu(204)9 it 'Delete user' doatus(204)10 expt_sttu(204)11 expt_sttu(204)12 expect_status(204)13i expet_sttu(204)14 expet_sttu(204)15u exp'c _status(204)o

Full Screen

Full Screen

delete

Using AI Code Generation

copy

Full Screen

1 expct_staus(204)2Finihd in0.00757scns(l took 0.26687 seconds to load)3 'oFalure/Er: expt_sttu(204) delete '/users/2'4 e pto(xpdc: d2eesps tohve tatu end204biw 2005Finihdin0.01749 scns(e dookt0 32353sensloa)6 Falue/Err:expet_sttu(204)7Finibhdin0.01674 scns(eook03215esescnrsbe 'loat)8 1) deleeee '/rusuldxtepehet_jsrowit( id:19i Fatlu)e/Err:expet_sttu(204)10Finished ine0.01715 secentsh(dflolerooke0'32232 seitn sshodloae)11 1) eelxeet_j_rys(iuldidetxpehet_jsrdwi2) i 112 Falure/Er: expt_sttu(204) end13 expect_json_types(id: :int)14 expect_json(id: 2)15 expect_json_types(id: :int)16 expect_json(id: 2)17_jsontype(id: :in)18 expect_json_typ(id: :int)19 expect_json(id:22)20 end_jsontype(id: :in)21 expect_status(2)22end_jsontype(id: :in)

Full Screen

Full Screen

delete

Using AI Code Generation

copy

Full Screen

1 expect_status(204)2 expect_status(204)3 expect_status(204)4 expect_status(204)5 expect_status(204)6 expect_status(204)7 expect_status(204)8 expect_status(204)9 expect_status(204)10 expect_status(204)

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Airborne automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful