def startUpCache(url=EnvironCommon.VUE_SERVICE_URL, catalogId=CatalogEnum.HOME.value): response = urllib.request.urlopen(url) assert response.status == 200 json_str = response.read().decode('utf-8') vue = HomeTab() url, jsonObj = vue.getJsonFromVueUrlPost(url=url, catalogId=catalogId) return json_str, jsonObj
def common_iids(the_row_index=0, iid=1300, the_vid=92): #ToDo catalogId cat = Catalog() status, url, catJsonObj = cat.getCatalogJsonObjFromUrl( url=CATALOG_URL, catalogId=CATALOG_ID) #ToDo catalogId homeObj = HomeTab() vue_url, vueJsonObj = homeObj.getJsonFromHomeUrl(url=VUE_SERVICE_URL) catalog_row_title, catalog_row_iids, vue_item_title, vue_iid_list = CatalogCommon.home_row_iids( catalogId=CATALOG_ID, the_row_index=0, iid=1300, the_vid=92) the_common_iids = (set(catalog_row_iids) & set(vue_iid_list)) return catJsonObj, vueJsonObj, the_common_iids
def test_home_tab(self): homeObj = HomeTab( 'http', 'api-stage.vizio.com', 'api/1.0.1.0/vibes/getdata.aspx', 'contextToken=-901682349:629546385057943552:508:5234744:5067736:2029148903&handles=[{"Vibe":{"Sid":3020009,"Iid":1,"_tid":18},"Vid":2000002,"Expand":2,"_tid":14}]&access_key=D/0FFxEJr5gXiH4qpf0k48V9Agw=&access_sig=COr+y/+4I9W64iYci+uJt9QCouE=' ) dict1 = homeObj.runVueServiceRowTitles( catalogId=CatalogEnum.HOME.value, item_pos=0, item_id=1300) home_rows_count = len(dict1) self.assertTrue(home_rows_count == 6)
def home_row_iids(cat_url=CATALOG_URL, vue_url=VUE_SERVICE_URL, catalogId=CatalogEnum.HOME.value, the_row_index=0, iid=1300, the_vid=92): catalog_id, catalog_row_title, catalog_row_iids = None,None,None cat = Catalog() status, url, jsonobj = cat.getCatalogJsonObjFromUrl(url=cat_url,catalogId=catalogId) catalog_id, catalog_row_title, catalog_row_iids = cat.getRowDetailsByIndex( jsonobj, row_index=the_row_index) # access Vue service homeObj = HomeTab() vue_url, vueJsonObj = homeObj.getJsonFromHomeUrl(url=vue_url, catalogId=catalogId) vue_title, vue_item_title, vue_iid_list = homeObj.getFirstRowFromVueService( vueJsonObj, items_pos=the_row_index, item_id=iid, the_vid=the_vid) return catalog_row_title, catalog_row_iids, vue_item_title, vue_iid_list
def row_iid_title(cat_url=CATALOG_URL, vue_url=VUE_SERVICE_URL, catalogId=CatalogEnum.HOME.value, iid=1300): cat = Catalog() status, url, jsonobj = cat.getCatalogJsonObjFromUrl(url=cat_url,catalogId=catalogId) catalog_id, catalog_row_title = cat.getRowItemDetailsByIid( catJsonObj=jsonobj, iid=iid) iid_title_dict, cat_row_count = cat.getCatalogRowsCount(catJsonObj=jsonobj, catalogId=catalogId) # access Vue service homeObj = HomeTab() vue_url, vueJsonObj = homeObj.getJsonFromHomeUrl(url=vue_url, catalogId=catalogId) catalog_name, vue_row_title, iid, sid, vue_row_count = homeObj.runVueServiceRowTitleByIid( catalogId=catalogId, iid=iid) return catalog_row_title, vue_row_title, iid, cat_row_count, vue_row_count
def catalog_rows(host=VUE_HOST,catalogId=CatalogEnum.HOME.value): ''' 1) http POST request to CatalogService: http://catalog-dev.smartcasttv.com/catalogs?rowsToExpand=3 headersdict = { 'Content-Type': 'application/json', 'LanguageIso2Code': 'EN', 'CountryIso2Code': 'US', 'ClientDateTimeSeconds': '1588700639', 'SctvVersion': '5.0.0.0', 'ModelName': 'E50-F2' } { "Catalogs":[{ "Id" : <catalogId> }]} # catalogId is passed in. eg. 1 2) http GET request to VueService: url = 'http://api-stage.vizio.com/api/1.0.1.0/vibes/getdata.aspx? contextToken=-901682349:629546385057943552:508:5234744:5067736:2029148903& handles=[{"Vibe":{"Sid":3020009,"Iid":1,"_tid":18},"Vid":2000002,"Expand":2,"_tid":14}]& access_key=D/0FFxEJr5gXiH4qpf0k48V9Agw=&access_sig=COr+y/+4I9W64iYci+uJt9QCouE=' 3) get catalog_title, catalog_rows step 1; get vue_item_title, vue_iid_list. call assertEqual to compare the catalog_title and vue_item_title. example: 'New Hero - 2019' vs 'New Hero - 2019' call assertEqual to compare the catalog_rows and vue_iid_list. example: [1300, 1301, 9, 1537] vs [1300, 1301, 9, 1537, 1517] ''' catalog_id, catalog_title, catalog_rows = None, None, None vue_title, vue_rows = None, None catalog_id, catalog_title, catalog_rows = Catalog().run_cat_rows(catalogId=catalogId) vue_title, vue_rows = HomeTab().runVueServiceRowsIid(host=host,catalogId=catalogId) print('catalog_id=%s, catalog_title=%s, catalog_rows=%s' % (catalog_id, catalog_title, catalog_rows)) print('vue_title=%s, vue_rows=%s' % (vue_title, vue_rows)) return catalog_title, catalog_rows, vue_title, vue_rows