def main():

    test.log("Test Case Name: test_create_cancel_remove")

    data = testData.dataset("s_list_of_webservices.tsv")[0]

    create_delivery_data_success = {
        "serviceOriginName": "Dove UI",
        "callBackEndPoint": None,
        "callBackReferenceId": None,
        "requestTime": None,
        "sourceFile":
        'hub://hub-t1/mirriad/storage/QA/GBUV71000779_I_AM_ARROWS_Another Picture Of You_no_P_logo_v2.mov',
        "deliveryFile":
        'hub://hub-t1/mirriad/storage/QA/GBUV71000779_I_AM_ARROWS_Another Picture Of You_with_P_logo_v2.mov',
        "assetId": '12230',
        "campaignId": '27120900',
        "deliveryTargetService": 'VEVO',
        "revertOperation": False
    }

    create_delivery_url = testData.field(
        data, "create_save_delivery_using_post_url")
    get_delivery_status_url = testData.field(data, "get_delivery_status_url")
    cancel_delivery_url = testData.field(data,
                                         "cancel_delivery_using_post_url")
    remove_delivery_url = testData.field(data,
                                         "delete_delivery_using_delete_url")
    success = False
    '''t01 ftp connection login details'''
    ftp_vevo_host = "ftp.uk.mirriad.com"
    ftp_vevo_user = "******"
    ftp_vevo_password = "******"
    ftp_vevo_port = 21
    ftp_vevo_vevo_user = "******"

    source(findFile("scripts", "test_create_cancel_remove.py"))

    success = create_cancel_remove_delivery(
        create_delivery_url, create_delivery_data_success,
        get_delivery_status_url, cancel_delivery_url, remove_delivery_url,
        ftp_vevo_host, ftp_vevo_user, ftp_vevo_password, success)
    if (success):
        test.passes("test_create_cancel_remove passed")
    else:
        test.fail("test_create_cancel_remove failed")
        testdata = testData.create("shared", "status.failed")
        try:
            with open(testdata, "w+") as f:
                test.log("Failed so create a status file")
        except Exception as e:
            print e
            s = str(e)
            test.log(s)
def check_contents_in_ftp_server_and_download_manifest(ftp_delivery_path,
                                                       ftp_vevo_host,
                                                       ftp_vevo_user,
                                                       ftp_vevo_password):
    test.log("check_contents_in_ftp_server_and_download_manifest")
    test.log("ftp_delivery_path : " + ftp_delivery_path)
    squish.snooze(60)

    files = []
    absolute_path = None
    squish.snooze(60)

    try:
        session = ftplib.FTP(ftp_vevo_host, ftp_vevo_user, ftp_vevo_password)
        print session
        session.cwd(ftp_delivery_path)  # Change working directory
        files = session.nlst()
        print files
        for filename in files:
            print filename
            #getting delivery.complete.lock file as soon as file transfer has been done(look for that as well)
            if (len(files) == 3 and filename == "manifest.xml"):
                print filename

                testdata = testData.create("shared", filename)
                print testdata
                #dataFile = open(testdata, "w")
                #local_filename = os.path.join('download_manifest', filename)
                absolute_path = os.path.abspath(testdata)
                print absolute_path
                file = open(testdata, 'wb')
                session.retrbinary('RETR %s' % filename, file.write)
                file.close()
            elif (len(files) > 3):
                test.fail("no of files in the FTP server are more than 3")
                test.log(len(files))

            elif (len(files) < 3):
                test.fail("no of files in the FTP server are less than 3")
                test.log(len(files))

        session.quit()
        return absolute_path
    except Exception as e:
        test.fail("check_contents_in_ftp_server_and_download_manifest")
        print e
        s = str(e)
        print sys.exc_info()
        test.log(s)
Beispiel #3
0
def main():
    test.log("Test Case Name: test_create_restart_remove")

    data = testData.dataset("s_list_of_webservices.tsv")[0]

    create_failed_delivery_data = {
        "serviceOriginName": "Dove UI",
        "callBackEndPoint": None,
        "callBackReferenceId": None,
        "requestTime": None,
        "sourceFile": 'hub://hub-t1/mirriad/storage/QA/MP4.mp4',
        "deliveryFile": 'hub://hub-t1/mirriad/storage/QA/MP41.mp4',
        "assetId": '10006',
        "campaignId": '10450402',
        "deliveryTargetService": 'VEVO',
        "revertOperation": False
    }

    create_delivery_url = testData.field(
        data, "create_save_delivery_using_post_url")
    get_delivery_status_url = testData.field(data, "get_delivery_status_url")
    restart_delivery_url = testData.field(data,
                                          "restart_delivery_using_put_url")
    remove_delivery_url = testData.field(data,
                                         "delete_delivery_using_delete_url")
    success = False

    source(findFile("scripts", "test_create_restart_remove.py"))

    success = create_restart_remove_delivery(create_delivery_url,
                                             create_failed_delivery_data,
                                             get_delivery_status_url,
                                             restart_delivery_url,
                                             remove_delivery_url, success)

    if (success):
        test.passes("test_create_restart_remove delivery passed")
    else:
        test.fail("test_create_restart_remove delivery failed")
        testdata = testData.create("shared", "status.failed")
        try:
            with open(testdata, "w+") as f:
                test.log("Failed so create a status file")
        except Exception as e:
            print e
            s = str(e)
            test.log(s)
def main():

    test.log("Test Case Name: test_create_cancel_remove")
    
    data = testData.dataset("s_list_of_webservices.tsv")[0]
    
    create_delivery_data_success = { 
    "serviceOriginName": "Dove UI",
    "callBackEndPoint": None,
    "callBackReferenceId": None,
    "requestTime": None,
    "sourceFile": 'hub://hub-t1/mirriad/storage/QA/GBUV71000779_I_AM_ARROWS_Another Picture Of You_no_P_logo_v2.mov',
    "deliveryFile": 'hub://hub-t1/mirriad/storage/QA/GBUV71000779_I_AM_ARROWS_Another Picture Of You_with_P_logo_v2.mov',
    "assetId": '12230',
    "campaignId": '27120900',
    "deliveryTargetService": 'VEVO',
    "revertOperation": False 
    }
    
    create_delivery_url = testData.field(data, "create_save_delivery_using_post_url")
    get_delivery_status_url = testData.field(data, "get_delivery_status_url")
    cancel_delivery_url = testData.field(data, "cancel_delivery_using_post_url")
    remove_delivery_url = testData.field(data, "delete_delivery_using_delete_url") 
    success = False
    '''t01 ftp connection login details'''
    ftp_vevo_host = "ftp.uk.mirriad.com"
    ftp_vevo_user = "******"
    ftp_vevo_password = "******"
    ftp_vevo_port = 21
    ftp_vevo_vevo_user = "******"
    
    source(findFile("scripts", "test_create_cancel_remove.py"))
    
    success  = create_cancel_remove_delivery(create_delivery_url, create_delivery_data_success, get_delivery_status_url, cancel_delivery_url, remove_delivery_url, ftp_vevo_host, ftp_vevo_user, ftp_vevo_password, success)
    if(success):
        test.passes("test_create_cancel_remove passed")
    else:
        test.fail("test_create_cancel_remove failed")
        testdata = testData.create("shared", "status.failed")
        try:
            with open(testdata, "w+") as f:
                test.log("Failed so create a status file")  
        except Exception as e:
            print e
            s = str(e)
            test.log(s)
def check_contents_in_ftp_server_and_download_manifest(ftp_delivery_path,ftp_vevo_host,ftp_vevo_user,ftp_vevo_password):
    test.log("check_contents_in_ftp_server_and_download_manifest")
    test.log("ftp_delivery_path : " + ftp_delivery_path)
    squish.snooze(60)

    files = []
    absolute_path = None
    squish.snooze(60)

    try:
        session = ftplib.FTP(ftp_vevo_host, ftp_vevo_user, ftp_vevo_password)
        print session
        session.cwd(ftp_delivery_path) # Change working directory 
        files = session.nlst()
        print files
        for filename in files:
            print filename
            #getting delivery.complete.lock file as soon as file transfer has been done(look for that as well)
            if(len(files) == 3 and filename == "manifest.xml"):
                print filename
                
                testdata = testData.create("shared", filename)
                print testdata
                #dataFile = open(testdata, "w")
                #local_filename = os.path.join('download_manifest', filename)
                absolute_path = os.path.abspath(testdata)
                print absolute_path
                file = open(testdata, 'wb')
                session.retrbinary('RETR %s' % filename, file.write)
                file.close()
            elif(len(files) > 3):
                test.fail("no of files in the FTP server are more than 3")
                test.log(len(files))

            elif(len(files) < 3):
                test.fail("no of files in the FTP server are less than 3")
                test.log(len(files))

        session.quit()
        return absolute_path 
    except Exception as e:
        test.fail("check_contents_in_ftp_server_and_download_manifest")
        print e
        s = str(e)
        print sys.exc_info()
        test.log(s)
def create_delivery_and_save_delivery_id_to_tsv(create_delivery_url, create_delivery_data,videoISRC):   
    
    source(findFile("scripts", "deliverywebservices.py"))

    '''create the delivery'''
    delivery_id = create_save_delivery_using_post_url(create_delivery_url, create_delivery_data)
    squish.snooze(40)
         
    if(delivery_id and delivery_id != None):
            
        test.log("delivery successfully created", delivery_id)
        testdata = testData.create("shared", "delivery_ids_for_bulk_reverting.tsv")
        dataFile = open(testdata, "w")
        dataFile.write("delivery_id\tvideoISRC\n")
        dataFile.write(delivery_id + "\t" + videoISRC)
        dataFile.close()
        test.log("tsv created")
        return delivery_id
    else:
        test.fail("delivery id is none")
def main():
    test.log("Test Case Name: test_create_restart_remove")
    
    data = testData.dataset("s_list_of_webservices.tsv")[0]
    
    create_failed_delivery_data = { 
    "serviceOriginName": "Dove UI",
    "callBackEndPoint": None,
    "callBackReferenceId": None,
    "requestTime": None,
    "sourceFile": 'hub://hub-t1/mirriad/storage/QA/MP4.mp4',
    "deliveryFile": 'hub://hub-t1/mirriad/storage/QA/MP41.mp4',
    "assetId": '10006',
    "campaignId": '10450402',
    "deliveryTargetService": 'VEVO',
    "revertOperation": False 
    }
    
    create_delivery_url = testData.field(data, "create_save_delivery_using_post_url")
    get_delivery_status_url = testData.field(data, "get_delivery_status_url")
    restart_delivery_url = testData.field(data, "restart_delivery_using_put_url")
    remove_delivery_url = testData.field(data, "delete_delivery_using_delete_url") 
    success = False
    
    source(findFile("scripts", "test_create_restart_remove.py"))

    success = create_restart_remove_delivery(create_delivery_url, create_failed_delivery_data, get_delivery_status_url, restart_delivery_url, remove_delivery_url, success)
    
    if(success):
        test.passes("test_create_restart_remove delivery passed")
    else:
        test.fail("test_create_restart_remove delivery failed")
        testdata = testData.create("shared", "status.failed")
        try:
            with open(testdata, "w+") as f:
                test.log("Failed so create a status file")  
        except Exception as e:
            print e
            s = str(e)
            test.log(s)      
Beispiel #8
0
def create_delivery_and_save_delivery_id_to_tsv(create_delivery_url,
                                                create_delivery_data,
                                                videoISRC):

    source(findFile("scripts", "deliverywebservices.py"))
    '''create the delivery'''
    delivery_id = create_save_delivery_using_post_url(create_delivery_url,
                                                      create_delivery_data)
    squish.snooze(40)

    if (delivery_id and delivery_id != None):

        test.log("delivery successfully created", delivery_id)
        testdata = testData.create("shared",
                                   "delivery_ids_for_bulk_reverting.tsv")
        dataFile = open(testdata, "w")
        dataFile.write("delivery_id\tvideoISRC\n")
        dataFile.write(delivery_id + "\t" + videoISRC)
        dataFile.close()
        test.log("tsv created")
        return delivery_id
    else:
        test.fail("delivery id is none")
Beispiel #9
0
def get_list_of_assets(url, media_family_id):
    test.log("get_list_of_assets")
    test.log("url : " + url)
    test.log("media_family_id " + media_family_id)
    complete_url = url + media_family_id
    print complete_url
    open = urllib2.urlopen(complete_url)
    dict = json.load(open)
    squish.snooze(10)
    test.log("get_list_of_assets" + complete_url)

    number_of_results = dict['numberOfResults']
    print number_of_results
    if (number_of_results > 0):
        count = 0
        print number_of_results
        test.log("successfully retrieved list of assets :")
        for i in range(number_of_results):
            count = count + 1
            assets_list = dict['results'][i]
            asset_id = assets_list['id']
            print asset_id
        if (number_of_results != count):
            test.fail("assets doesn't match the number of results retrieved")
        else:
            test.passes("asset ids exist")
    else:
        test.fail(
            "No results exist for media family to get the list of assets")
        testdata = testData.create("shared", "status.failed")
        try:
            with open(testdata, "w+") as f:
                test.log("Failed so create a status file")
        except Exception as e:
            print e
            s = str(e)
            test.log(s)
def get_delivery_status_list_post(url, get_deliveries_data):
    
    test.log("get_delivery_status_list_post_url : " + url)
    req = urllib2.Request(url)
    req.add_header('Content-Type', 'application/json')
    response = urllib2.urlopen(req, json.dumps(get_deliveries_data))
    dict = json.load(response)
    #pprint(dict)
    
    number_of_results = dict['numberOfResults'] 

    if(number_of_results > 0):
        print number_of_results
        test.log("successfully retrieved the no of deliveries :")
    else:
        test.fail("No delivery results exist")
        testdata = testData.create("shared", "status.failed")
        try:
            with open(testdata, "w+") as f:
                test.log("Failed so create a status file")  
        except Exception as e:
            print e
            s = str(e)
            test.log(s)  
def get_list_of_assets(url, media_family_id):
    test.log("get_list_of_assets")
    test.log("url : " + url)
    test.log("media_family_id " + media_family_id)
    complete_url = url + media_family_id
    print complete_url 
    open = urllib2.urlopen(complete_url)
    dict = json.load(open)
    squish.snooze(10)
    test.log("get_list_of_assets" + complete_url)
    
    number_of_results = dict['numberOfResults']
    print number_of_results
    if(number_of_results > 0):
        count = 0
        print number_of_results
        test.log("successfully retrieved list of assets :")
        for i in range(number_of_results):
            count = count + 1
            assets_list = dict['results'][i]
            asset_id = assets_list['id']
            print asset_id
        if(number_of_results != count):
            test.fail("assets doesn't match the number of results retrieved")
        else:
            test.passes("asset ids exist")
    else:
        test.fail("No results exist for media family to get the list of assets")
        testdata = testData.create("shared", "status.failed")
        try:
            with open(testdata, "w+") as f:
                test.log("Failed so create a status file")  
        except Exception as e:
            print e
            s = str(e)
            test.log(s)
def main():
    try:
        
        test.log("Test Case Name: tst_create_parse_success_delivery")
        test.log("create parse success delivery")
    
        create_delivery_data_success = { 
        "serviceOriginName": "Dove UI",
        "callBackEndPoint": None,
        "callBackReferenceId": None,
        "requestTime": None,
        "sourceFile": 'hub://hub-t1/mirriad/storage/QA/GBUV71000779_I_AM_ARROWS_Another Picture Of You_no_P_logo_v2.mov',
        "deliveryFile": 'hub://hub-t1/mirriad/storage/QA/GBUV71000779_I_AM_ARROWS_Another Picture Of You_with_P_logo_v2.mov',
        "assetId": '12230',
        "campaignId": '27120900',
        "deliveryTargetService": 'VEVO',
        "revertOperation": False 
        }
        
        videoISRC = "GBUV71000779" # I am Arrows
        
        data = testData.dataset("s_list_of_webservices.tsv")[0]
            
        hub_status_config_url = testData.field(data, "get_delivery_config_get_url")
        create_delivery_url = testData.field(data, "create_save_delivery_using_post_url")
        get_delivery_status_url = testData.field(data, "get_delivery_status_url")
        manifest_parse_success_replace_success = "vevo_status\\parse_success_replace_success\\status-manifest.xml"
        manifest_parse_success = "vevo_status\\parse_success\\status-manifest.xml"
        #manifest_parse_success_replace_success = findFile("testdata", "vevo_status\\parse_success_replace_success\\status-manifest.xml")
        #manifest_parse_success = findFile("testdata", "vevo_status\\parse_success\\status-manifest.xml")
        delivery_ftp_path = None
        '''t01 ftp connection login details'''
        ftp_vevo_host = "ftp.uk.mirriad.com"
        ftp_vevo_user = "******"
        ftp_vevo_password = "******"
        ftp_vevo_port = 21
        ftp_vevo_vevo_user = "******"
        
        test.log("manifest_parse_success : " + manifest_parse_success)
        test.log("manifest_parse_success_replace_success : " + manifest_parse_success_replace_success)
        
        x = None
        count = 4 # using count for FTP transfer as a trigger
        delivery_id = None
        delivery_stage = None
        source(findFile("scripts", "create_delivery.py"))
        
        delivery_id = create_delivery_first_step(create_delivery_data_success, videoISRC, hub_status_config_url, create_delivery_url, get_delivery_status_url, manifest_parse_success, manifest_parse_success_replace_success, count, ftp_vevo_host, ftp_vevo_user, ftp_vevo_password)
        squish.snooze(60)

        if(delivery_id or delivery_id != None):
            source(findFile("scripts", "deliverywebservices.py"))
            squish.snooze(60)
            delivery_stage = check_delivery_status(get_delivery_status_url, delivery_id)
            delivery_ftp_path = get_delivery_ftp_path(get_delivery_status_url, delivery_id, count)

        '''remove the delivery as it is on waiting on confirmation, you cannot use the same delivery again
        transfer the file and change the status to completed'''
  
        if(delivery_stage == "WAITING_ON_CONFIRMATION"):
            test.passes("parse_success is successful")
            source(findFile("scripts", "connect_to_ftpserver.py"))
            manifest_parse_success_replace_success = findFile("testdata", manifest_parse_success_replace_success)
            squish.snooze(60)
            copy_to_ftp_server(manifest_parse_success_replace_success, delivery_ftp_path, ftp_vevo_host, ftp_vevo_user, ftp_vevo_password)
            source(findFile("scripts", "deliverywebservices.py"))
            squish.snooze(60)
            delivery_stage = check_delivery_status(get_delivery_status_url, delivery_id)
            if(delivery_stage == "COMPLETE"):
                test.passes("parse_success is successful and parse_success_replace_success is also successful")
            else:
                test.fail("parse_success_replace_success in parse success delivery has failed, deliveryStage : " + delivery_stage)
        elif(delivery_stage == "FAILED"):
            test.fail("Delivery stage is failed after copying parse success file so need not copy parse success replace success file")
        else:
            test.fail("parse_success delivery has failed")
    except Exception as e:
        print e
        s = str(e)
        print sys.exc_info()
        test.log(s)
        test.fail("parse_success has failed due to : " + s)
        testdata = testData.create("shared", "status.failed")
        try:
            with open(testdata, "w+") as f:
                test.log("Failed so create a status file")  
        except Exception as e:
            print e
            s = str(e)
            test.log(s)
def main():
    
    test.log("Test Case Name: tst_create_queued_delivery")
 
    '''run the script to set the queued delivery'''
    
    # arguments to pass: 1 create a campaign with start date in the past and end date in future and any campaign Id: 84062112
    # arguments to pass: 2 QUEUED -create a campaign with start date in the future and end date in future and any campaign Id: 84062112
    # arguments to pass: 3 create a campaign with start date in the past and end date in past and any campaign Id: 84062112
    test.log("update adbroker database for campaign start and end dates")
    os.system("C:\\utils\\run_update_campaign_dates.bat 2 84062112")
    
    try:
        test.log("create successful delivery")
        delivery_id = None
        delivery_stage = None
        create_delivery_data = { 
        "serviceOriginName": "Dove UI",
        "callBackEndPoint": None,
        "callBackReferenceId": None,
        "requestTime": None,
        "sourceFile": 'hub://hub-t1/mirriad/storage/QA/GBUV71000779_I_AM_ARROWS_Another Picture Of You_no_P_logo_v2.mov',
        "deliveryFile": 'hub://hub-t1/mirriad/storage/QA/GBUV71000779_I_AM_ARROWS_Another Picture Of You_with_P_logo_v2.mov',
        "assetId": '4134',
        "campaignId": '84062112',
        "deliveryTargetService": 'VEVO',
        "revertOperation": False 
        }
        
        videoISRC = "USUV71201410" 
        
        data = testData.dataset("s_list_of_webservices.tsv")[0]
            
        create_delivery_url = testData.field(data, "create_save_delivery_using_post_url")
        get_delivery_status_url = testData.field(data, "get_delivery_status_url")
        
        source(findFile("scripts", "deliverywebservices.py"))

        '''create the delivery'''
        delivery_id = create_save_delivery_using_post_url(create_delivery_url, create_delivery_data)
        squish.snooze(40)
        
        delivery_stage = check_delivery_status(get_delivery_status_url, delivery_id)
        
        if(delivery_id and delivery_id != None and delivery_stage == "QUEUED"):
            
            test.log("delivery successfully created", delivery_id)
            testdata = testData.create("shared", "delivery_ids_for_reverting.tsv")
            dataFile = open(testdata, "w")
            dataFile.write("delivery_id\tvideoISRC\n")
            dataFile.write(delivery_id + "\t" + videoISRC)
            dataFile.close()
            test.log("tsv created")
        else:
            test.fail("delivery id is none or delivery stage is not queued")
    
    except Exception as e:
        print e
        s = str(e)
        print sys.exc_info()
        test.fail("create queued delivery has failed")
        if(s and s!=None):
            test.log(s)
            test.fail("create queued delivery has failed due to :" + s)
def main():
    try:
        test.log("Test Case Name: tst_create_parse_success_replace_failure")

        test.log("create parse success replace failure delivery")
    
        create_delivery_data_success = { 
        "serviceOriginName": "Dove UI",
        "callBackEndPoint": None,
        "callBackReferenceId": None,
        "requestTime": None,
        "sourceFile": 'hub://hub-t1/mirriad/storage/QA/GBUV71000779_I_AM_ARROWS_Another Picture Of You_no_P_logo_v2.mov',
        "deliveryFile": 'hub://hub-t1/mirriad/storage/QA/GBUV71000779_I_AM_ARROWS_Another Picture Of You_with_P_logo_v2.mov',
        "assetId": '12230',
        "campaignId": '27120900',
        "deliveryTargetService": 'VEVO',
        "revertOperation": False 
        }
    
        videoISRC = "GBUV71000779" # I am Arrows
        
        data = testData.dataset("s_list_of_webservices.tsv")[0]
            
        hub_status_config_url = testData.field(data, "get_delivery_config_get_url")
        create_delivery_url = testData.field(data, "create_save_delivery_using_post_url")
        get_delivery_status_url = testData.field(data, "get_delivery_status_url")
        manifest_parse_success_replace_failure = "vevo_status\\parse_success_replace_failure\\status-manifest.xml"
        manifest_parse_success = "vevo_status\\parse_success\\status-manifest.xml"
        #manifest_parse_failure = findFile("testdata", "vevo_status\\parse_failure\\status-manifest.xml")
        #manifest_parse_success_replace_failure = findFile("testdata", "vevo_status\\parse_success_replace_failure\\status-manifest.xml")
        
        test.log("manifest_parse_success : " + manifest_parse_success)
        test.log("manifest_parse_success_replace_failure : " + manifest_parse_success_replace_failure)
        '''t01 ftp connection login details'''
        ftp_vevo_host = "ftp.uk.mirriad.com"
        ftp_vevo_user = "******"
        ftp_vevo_password = "******"
        ftp_vevo_port = 21
        ftp_vevo_vevo_user = "******"
        
        x = None
        count = 2 # using count for FTP to transfer the status-manifest file as a trigger
        delivery_id = None
        initial_failure = False
        delivery_stage = None
        source(findFile("scripts", "create_delivery.py"))
        
        delivery_id = create_delivery_first_step(create_delivery_data_success, videoISRC, hub_status_config_url, create_delivery_url, get_delivery_status_url, manifest_parse_success, manifest_parse_success_replace_failure, count, ftp_vevo_host, ftp_vevo_user, ftp_vevo_password)
        squish.snooze(60)
        if(delivery_id or delivery_id != None):
            source(findFile("scripts", "deliverywebservices.py"))
            #wait for 30 seconds here because delivery stage = waiting on confirmation
            squish.snooze(60)
            delivery_stage = check_delivery_status(get_delivery_status_url, delivery_id)
        else:
            test.log("Initial Delivery Failed")
            initial_failure = True
        
        if(delivery_stage == "FAILED" and initial_failure == False):
            test.passes("parse_success_replace_failure is successful")
        else:
            test.fail("parse_success_replace_failure delivery has failed, deliveryStage : ")
    except Exception as e:
        print e
        s = str(e)
        print sys.exc_info()
        test.log(s)
        test.fail("parse_success_replace_failure has failed due to :" + s)
        testdata = testData.create("shared", "status.failed")
        try:
            with open(testdata, "w+") as f:
                test.log("Failed so create a status file")  
        except Exception as e:
            print e
            s = str(e)
            test.log(s)
def main():
    
    test.log("Test Case Name: tst_write_urls_to_tsv")

    test.log("removing the waiting on confirmation deliveries")
    os.startfile("C:\\utils\\run_remove_awaiting_deliveries.bat")
           
    test.log("writing the web service urls to TSV file")
    
    server_name = "t01"

    get_delivery_config_get_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/config"
    create_save_delivery_using_post_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/deliver"
    get_delivery_status_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/delivery/"

    
    get_delivery_status_list_post_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/query"
    
    restart_delivery_using_put_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/restart/"
    delete_delivery_using_delete_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/remove/"
    cancel_delivery_using_post_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/cancel/"
 
    campaign_service_call_url = "https://" + server_name + "-adbroker.mirriad.com/catalogue/services/api/campaign/list/open"
    
    
    asset_service_to_get_list_of_mediafamilies_url = "https://" + server_name + "-adbroker.mirriad.com/catalogue/services/api/mediafamily/equal/campaign/"
    asset_service_to_get_list_of_assets_url = "https://" + server_name + "-adbroker.mirriad.com/catalogue/services/api/media/equal/mediafamily/"
    
    get_all_files_folders_from_hub_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/files/list/"
    get_all_files_folders_of_parent_in_hub_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/files/list/"
    
    start_queued_deliveries_get_call = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/bulk/start/"
    
    revert_delivery_with_id_put_call = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/revert/"
    
    revert_all_deliveries_get_call = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/bulk/revert/"
    
    campaign_id = "27120900"
    '''asset_id = "12914"'''

  
    testdata = testData.create("shared", "s_list_of_webservices.tsv")
    dataFile = open(testdata, "w")
    dataFile.write("get_delivery_config_get_url\tget_delivery_status_list_post_url\tcreate_save_delivery_using_post_url\trestart_delivery_using_put_url\tdelete_delivery_using_delete_url\tcancel_delivery_using_post_url\tcampaign_service_call_url\tget_delivery_status_url\tcampaign_id\tasset_service_to_get_list_of_mediafamilies_url\tasset_service_to_get_list_of_assets_url\tget_all_files_folders_from_hub_url\tget_all_files_folders_of_parent_in_hub_url\tstart_queued_deliveries_get_call\trevert_delivery_with_id_put_call\trevert_all_deliveries_get_call\n")
    dataFile.write(get_delivery_config_get_url + "\t" + get_delivery_status_list_post_url + "\t" 
                   + create_save_delivery_using_post_url + "\t" + restart_delivery_using_put_url + "\t" + 
                   delete_delivery_using_delete_url + "\t" + cancel_delivery_using_post_url + "\t" + campaign_service_call_url + "\t" + 
                   get_delivery_status_url + "\t" + campaign_id + "\t" + asset_service_to_get_list_of_mediafamilies_url + "\t" + 
                   asset_service_to_get_list_of_assets_url + "\t" + get_all_files_folders_from_hub_url + "\t" + get_all_files_folders_of_parent_in_hub_url + "\t"
                   + start_queued_deliveries_get_call + "\t" + revert_delivery_with_id_put_call + "\t" + revert_all_deliveries_get_call)
    dataFile.close()
    test.log("Finished writing the urls to TSV file")
    
    test.log("writing the ftp_login_details to TSV file")

    '''t01 ftp connection login details'''
    ftp_vevo_host = "ftp.uk.mirriad.com"
    ftp_vevo_user = "******"
    ftp_vevo_password = "******"
    ftp_vevo_port = 21
    ftp_vevo_vevo_user = "******"
    
    testdata = testData.create("shared", "ftp_login_details.tsv")
    dataFile = open(testdata, "w")
    dataFile.write("ftp_vevo_host\tftp_vevo_user\tftp_vevo_password\tftp_vevo_vevo_user\n")
    dataFile.write(ftp_vevo_host + "\t" + ftp_vevo_user + "\t" 
                   + ftp_vevo_password + "\t" + 
                   ftp_vevo_vevo_user)
    dataFile.close()
    test.log("Finished writing the ftp_login_details to TSV file")
Beispiel #16
0
def main():

    test.log("Test Case Name: tst_write_urls_to_tsv")

    test.log("removing the waiting on confirmation deliveries")
    os.startfile("C:\\utils\\run_remove_awaiting_deliveries.bat")

    test.log("writing the web service urls to TSV file")

    server_name = "t01"

    get_delivery_config_get_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/config"
    create_save_delivery_using_post_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/deliver"
    get_delivery_status_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/delivery/"

    get_delivery_status_list_post_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/query"

    restart_delivery_using_put_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/restart/"
    delete_delivery_using_delete_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/remove/"
    cancel_delivery_using_post_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/cancel/"

    campaign_service_call_url = "https://" + server_name + "-adbroker.mirriad.com/catalogue/services/api/campaign/list/open"

    asset_service_to_get_list_of_mediafamilies_url = "https://" + server_name + "-adbroker.mirriad.com/catalogue/services/api/mediafamily/equal/campaign/"
    asset_service_to_get_list_of_assets_url = "https://" + server_name + "-adbroker.mirriad.com/catalogue/services/api/media/equal/mediafamily/"

    get_all_files_folders_from_hub_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/files/list/"
    get_all_files_folders_of_parent_in_hub_url = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/files/list/"

    start_queued_deliveries_get_call = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/bulk/start/"

    revert_delivery_with_id_put_call = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/revert/"

    revert_all_deliveries_get_call = "https://" + server_name + "-services.mirriad.com/delivery-web-service/api/bulk/revert/"

    campaign_id = "27120900"
    '''asset_id = "12914"'''

    testdata = testData.create("shared", "s_list_of_webservices.tsv")
    dataFile = open(testdata, "w")
    dataFile.write(
        "get_delivery_config_get_url\tget_delivery_status_list_post_url\tcreate_save_delivery_using_post_url\trestart_delivery_using_put_url\tdelete_delivery_using_delete_url\tcancel_delivery_using_post_url\tcampaign_service_call_url\tget_delivery_status_url\tcampaign_id\tasset_service_to_get_list_of_mediafamilies_url\tasset_service_to_get_list_of_assets_url\tget_all_files_folders_from_hub_url\tget_all_files_folders_of_parent_in_hub_url\tstart_queued_deliveries_get_call\trevert_delivery_with_id_put_call\trevert_all_deliveries_get_call\n"
    )
    dataFile.write(get_delivery_config_get_url + "\t" +
                   get_delivery_status_list_post_url + "\t" +
                   create_save_delivery_using_post_url + "\t" +
                   restart_delivery_using_put_url + "\t" +
                   delete_delivery_using_delete_url + "\t" +
                   cancel_delivery_using_post_url + "\t" +
                   campaign_service_call_url + "\t" + get_delivery_status_url +
                   "\t" + campaign_id + "\t" +
                   asset_service_to_get_list_of_mediafamilies_url + "\t" +
                   asset_service_to_get_list_of_assets_url + "\t" +
                   get_all_files_folders_from_hub_url + "\t" +
                   get_all_files_folders_of_parent_in_hub_url + "\t" +
                   start_queued_deliveries_get_call + "\t" +
                   revert_delivery_with_id_put_call + "\t" +
                   revert_all_deliveries_get_call)
    dataFile.close()
    test.log("Finished writing the urls to TSV file")

    test.log("writing the ftp_login_details to TSV file")
    '''t01 ftp connection login details'''
    ftp_vevo_host = "ftp.uk.mirriad.com"
    ftp_vevo_user = "******"
    ftp_vevo_password = "******"
    ftp_vevo_port = 21
    ftp_vevo_vevo_user = "******"

    testdata = testData.create("shared", "ftp_login_details.tsv")
    dataFile = open(testdata, "w")
    dataFile.write(
        "ftp_vevo_host\tftp_vevo_user\tftp_vevo_password\tftp_vevo_vevo_user\n"
    )
    dataFile.write(ftp_vevo_host + "\t" + ftp_vevo_user + "\t" +
                   ftp_vevo_password + "\t" + ftp_vevo_vevo_user)
    dataFile.close()
    test.log("Finished writing the ftp_login_details to TSV file")