def checkWishPrice(cid, store, wishPrice): item = psn.getItemForCid(cid, store) normalPrice = psn.getPrice(item) name = psn.getName(item) if (normalPrice > wishPrice): utils.print_enc(("Wish price {0:.2f} for '"+name+"' does not yet match {1:.2f}, exiting").format(wishPrice, normalPrice)) return False else: utils.print_enc(("Wish price {0:.2f} for '"+name+"' matched. Is now: {1:.2f}").format(wishPrice, normalPrice)) return True
def checkAlertsAndGenerateMailBody(alerts): bodyElements = [] unmatchedAlerts = list(alerts) for alert in alerts: cid = alert['cid'] store = alert['store'] item = psn.getItemForCid(cid,store) if (item == None): utils.print_enc("No item found for cid '"+cid+"' in store "+store) else: if (alertIsMatched(alert, item)): bodyElements.append(generateBodyElement(alert, item)) unmatchedAlerts.remove(alert) body = "\n".join(bodyElements) return unmatchedAlerts, body
def test_getPlaystationPlusPrice(): store = "DE/de" item = psn.getItemForCid(freeForPlusCid, store) print( "Using '" + item["name"] + "' (" + freeForPlusCid + ") from " + store + " for comparison. Item must be free for Plus members in order to pass the unit test. This might fail due to price changes" ) assert item is not None normalPrice = psn.getPrice(item) plusPrice = psn.getPlaystationPlusPrice(item) print("Normal Price: ", "%.2f" % normalPrice, "Plus Price: ", "%.2f" % plusPrice) assert type(normalPrice) is float assert type(plusPrice) is float assert plusPrice == 0
def test_getItemForCid2(): store = "DE/de" cids = psn.getCidForName("Child of Light", store) item = psn.getItemForCid(cids[0], store) assert item["name"] is not None
def test_getItemForCid(): store = "DE/de" cids = psn.getCidForName("Tearaway", store) item = psn.getItemForCid(cids[0], store) assert item["name"] is not None