def testcase_twt():
    #without twt crudential
    assert twt_api.getUserTwAPI("@AnimalPlanet",
                                "kkk") == "The account or keys is invalid!!"
    assert twt_api.getUserTwAPI("@AnimalPlanet",
                                "123") == "The account or keys is invalid!!"
    assert twt_api.getUserTwAPI(
        "AnimalPlanet", "5567fdgdfgg") == "The account or keys is invalid!!"

    #worng tweeter account name
    assert twt_api.getUserTwAPI("333333",
                                "kkk") == "The account or keys is invalid!!"
    assert twt_api.getUserTwAPI("zcdfgvhv",
                                "kkk") == "The account or keys is invalid!!"
    assert twt_api.getUserTwAPI("886fssfAnimet",
                                "kkk") == "The account or keys is invalid!!"

    config = configparser.ConfigParser()
    config.read('./keys')
    #check if keys is empty
    if len(config.get('auth', 'consumer_key')) == 0:
        #empty crudential
        assert twt_api.getUserTwAPI("@AnimalPlanet", "keys") == ""
        assert twt_api.getUserTwAPI("@cnnbrk", "keys") == ""
    else:
        assert twt_api.getUserTwAPI("@AnimalPlanet", "keys") == "success"
        assert twt_api.getUserTwAPI("@cnnbrk", "keys") == "success"
Exemple #2
0
def call_twt_api(username):
    str1 = "Fail!!!"
    if username != "" and username[0] == "@":
        status = twitter_api.getUserTwAPI(username, "keys")
        str1 =status+username+" Twitter Fetch Success!!"
        if status == "success!":
            video_api.process_img(username)
            video_api.toVideo(username)
            str1 = str1 +"\n Generate Video Finished!!!"
    return str1
Exemple #3
0
def run_thread(q):
    while (True):
        name = q.get()
        if name is None:
            break
        status = twitter_api.getUserTwAPI(name, "keys")
        if status == "success!":
            video_api.process_img(name)
            video_api.toVideo(name)
        print("Thread Finished!!!")
        q.task_done()