Esempio n. 1
0
def complete_test_without_ext_sys(ext_system_id):
    print("Config: ", get_url_start())
    game["extSystemId"] = ext_system_id
    game_id = create_game(game)
    if game_id is None:
        print("error while game creation")

    update_game(game_id)
    prepare_game(game_id)

    run_high_load(ext_system_id, game_id)
Esempio n. 2
0
def complete_test():
    print("Config: ", get_url_start())
    ext_system_id = create_ext_system(ext_system)
    if ext_system_id is None:
        ext_system_id = ext_system["extSystemId"]

    game["extSystemId"] = ext_system_id
    game_id = create_game(game)
    if game_id is None:
        print("error while game creation")
    update_game(game_id)
    prepare_game(game_id)

    # print("game_id: ", game_id)
    # print("ext_system_id: ", ext_system_id)

    run_high_load(ext_system_id, game_id)
Esempio n. 3
0
def get_games(ext_system_id):
    url = get_url_start() + "/api/v1/game" + "?extSystemId=" + ext_system_id
    resp = requests.get(url)
    resp_body = json.loads(resp.text)
    print("GET games")
    print(resp_body)
Esempio n. 4
0
import requests
import json
from datetime import timedelta, datetime

import sys
sys.path.append('../..')
from tests.config import get_url_start
from tests.utils import get_timestamp

url = get_url_start() + "/api/v1/game"

json_data = {
    "ext_system_id": "custom-ext_system-id",
    "name": "new game",
    "answer_type": 2,
    "start_date":   str(get_timestamp(timedelta(days=1))),
    "end_date":     str(get_timestamp(timedelta(days=3))),
    "question": "Choose answer",
    "options": "yep, nope"
}

json_data2 = {
    "ext_system_id": "custom-ext_system-id",
    "name": "new game",
    "answer_type": 2,
    "start_date":   str(get_timestamp(timedelta(days=1))),
    "end_date":     str(get_timestamp(timedelta(days=2))),
    "question": "Choose answer",
    "options": "yep, nope"
}
Esempio n. 5
0
import requests
import json

import sys

sys.path.append('../..')
from tests.config import get_url_start

url = get_url_start() + "/api/v1/ext_system"

data_without_id = {
    "description": "Активный гражданин",
    "postResultsUrl": "https://abc/lol.php"
}

data = {
    "extSystemId": "ext-id-1",
    "description": "some description",
    "postResultsUrl": "https://abc/lol.php"
}


def make_req(json_data):
    resp = requests.post(url=url, json=json_data)
    print(url, " | ", end="")
    resp_body = json.loads(resp.text)
    print(resp_body)
    return resp_body


def create_ext_system(ext_system):
Esempio n. 6
0
def get_screenshot_results(game_id, screenshot_id):
    url = get_url_start() + "/api/v1/game/" + game_id + "/screenshot/" + screenshot_id + "/result"
    resp = requests.get(url)
    return json.loads(resp.text)
Esempio n. 7
0
import asyncio
from random import random
import aiohttp
from aiohttp import ClientSession, ClientConnectorError, BasicAuth
import json
import time

import sys
sys.path.append('../..')
from tests.config import get_url_start

# TODO: from config
# host_and_port = "http://localhost:8080/"
host_and_port = get_url_start() + '/'

# game_id = "52d9cfed-1d03-46f5-9921-fca5cb9c116e"
# ext_system_id = 'custom-ext_system-id'


def rand_answer():
    r = random()
    return '0' if r > 0.59 else '1'


def get_users():
    count = 100000
    if len(sys.argv) > 1:
        count = int(sys.argv[1])

    users = []
    for i in range(1, count + 1):
Esempio n. 8
0
def get_statistics_user(user_id, params):
    url = get_url_start() + "/api/v1/statistics/user/" + user_id
    resp = requests.get(url, params=params)
    resp_body = json.loads(resp.text)
    return resp_body