Ejemplo n.º 1
0
def handleSubmit():
    print("FORM DATA:", dict(request.form))
    submission = dict(request.form)
    row = [submission['email'], submission['link']]
    initSheet()
    addNewRow(row)
    return redirect("/")
Ejemplo n.º 2
0
def test_addNewRow():
    email = "*****@*****.**"
    product_url = "https://www.amazon.com/Nintendo-Switch-Neon-Blue-Joy%E2%80%91/dp/B07VGRJDFY/ref=sr_1_3?crid=IY3K5B823UOZ&dchild=1&keywords=nintendo+switch&qid=1588716182&sprefix=nintend%2Caps%2C159&sr=8-3"
    test_row = [email, product_url]

    #should return the new row that was just added by grabbing the 2nd row
    assert addNewRow(test_row) == test_row

    sheet = initSheet()
    sheet.delete_rows(2)
Ejemplo n.º 3
0
def test_initSheet():
    sheet = initSheet()
    result = ["email", "url"]

    #if the sheet was initiatized correctly, the first row will be email, url
    assert sheet.row_values(1) == result


#----Works on command line, but will throw travis error
#def test_isInStock():
#    url = "https://www.amazon.com/AUKEY-Ethernet-Delivery-Charging-MacBook/dp/B07Z7H3GJK/ref=sr_1_3?crid=2V4KZOBILXKOV&dchild=1&keywords=aukey+usb+c+hub&qid=1588742003&s=electronics&sprefix=aukey+usb+c%2Celectronics%2C1091&sr=1-3"
#    #if the function can determine if it is in stock correctly, this test will pass
#    assert isInStock(url) == True
Ejemplo n.º 4
0
def test_initSheet():
    sheet = initSheet()
    result = ["email", "url"]

    #if the sheet was initiatized correctly, the first row will be email, url
    assert sheet.row_values(1) == result