示例#1
0
def update_experiment_by_experiment_id_test():
    update_param = {
        "experiment_content": "This is for update tesing"
    }

    experiment = ExperimentModel(settings.DB_CONFIGURE, settings.DB_CONN_RETRY)
    print "\n>>>>>>>>> The result of the function update_experiment_by_id() return : %s " % experiment.update_experiment_by_experiment_id(3, update_param)
def update_experiment_publish_by_publish_id_test():
    book_id_to_update = 3
    update_param = {"experiment_place": "This is for update tesing"}

    experiment = ExperimentModel(settings.DB_CONFIGURE, settings.DB_CONN_RETRY)
    print "\n>>>>>>>>> The result of the function update_experiment_publish_by_publish_id() return : %s " % experiment.update_experiment_publish_by_publish_id(
        book_id_to_update, update_param)
def get_experiment_publish_by_experiment_id_test():
    experiment_id_to_get = 73

    experiment = ExperimentModel(settings.DB_CONFIGURE, settings.DB_CONN_RETRY)
    print "\n>>>>>>>>> The result of the function get_experiment_publish_by_experiment_id() return : %s " % json.dumps(
        experiment.get_experiment_publish_by_experiment_id(
            experiment_id_to_get),
        indent=4)
示例#4
0
def add_experiment_test():
    insert_param = {
        "experiment_name": ''.join(random.sample(string.ascii_letters + string.digits, 8)),
        "experiment_content": ''.join(random.sample(string.ascii_letters + string.digits, 8)),
        "experiment_media": ''.join(random.sample(string.ascii_letters + string.digits, 8))
    }

    experiment = ExperimentModel(settings.DB_CONFIGURE, settings.DB_CONN_RETRY)

    print "\n>>>>>>>>> The result of the function add_experiment() return : %s " % experiment.add_experiment(insert_param)
def add_experiment_publish_test():
    insert_param = {
        "experiment_id":
        random.randint(0, 99),
        "publish_belong":
        random.randint(0, 99),
        "experiment_place":
        ''.join(random.sample(string.ascii_letters + string.digits, 8)),
        "experiment_time":
        int(time.time())
    }

    experiment = ExperimentModel(settings.DB_CONFIGURE, settings.DB_CONN_RETRY)

    print "\n>>>>>>>>> The result of the function add_experiment_publish() return : %s " % experiment.add_experiment_publish(
        insert_param)
def delete_experiment_publish_by_publish_id_test():
    experiment_id_to_delete = 5

    experiment = ExperimentModel(settings.DB_CONFIGURE, settings.DB_CONN_RETRY)
    print "\n>>>>>>>>> The result of the function delete_experiment_publish_by_publish_id() return : %s " % experiment.delete_experiment_publish_by_publish_id(
        experiment_id_to_delete)
示例#7
0
def get_experiments_by_name_test():
    experiment = ExperimentModel(settings.DB_CONFIGURE, settings.DB_CONN_RETRY)

    print "\n>>>>>>>>> The result of the function get_experiments_by_name() return : %s " % json.dumps(experiment.get_experiments_by_name('select_by_name_test'), indent=4)    
def get_experiment_book_by_user_id_test():
    user_id_to_get = 2

    experiment = ExperimentModel(settings.DB_CONFIGURE, settings.DB_CONN_RETRY)
    print "\n>>>>>>>>> The result of the function get_experiment_book_by_user_id() return : %s " % json.dumps(
        experiment.get_experiment_book_by_user_id(user_id_to_get), indent=4)