molotov_scenarios.py [14:110]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@scenario(weight=2)
async def scenario_root(session):
    async with session.get(SERVER_URL) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_stats(session):
    async with session.get(join(SERVER_URL, 'api', 'stats')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=7)
async def scenario_products(session):
    async with session.get(join(SERVER_URL, 'api', 'products')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_products_top(session):
    async with session.get(join(SERVER_URL, 'api', 'products', 'top')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=6)
async def scenario_products_id(session):
    async with session.get(join(SERVER_URL, 'api', 'products', str(random.randint(1, 6)))) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=6)
async def scenario_products_id_customers(session):
    async with session.get(join(SERVER_URL, 'api', 'products', str(random.randint(1, 6)), 'customers')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=6)
async def scenario_products_id_customers_limit(session):
    async with session.get(join(SERVER_URL, 'api', 'products', str(random.randint(1, 6)), 'customers?limit=%d' % (random.randint(5, 11) * 10))) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_types(session):
    async with session.get(join(SERVER_URL, 'api', 'types')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_types_id(session):
    async with session.get(join(SERVER_URL, 'api', 'types', str(random.randint(1, 3)))) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_customers(session):
    async with session.get(join(SERVER_URL, 'api', 'customers')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_customers_id(session):
    async with session.get(join(SERVER_URL, 'api', 'customers', str(random.randint(1, 1000)))) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=2)
async def scenario_wrong_customers_id(session):
    async with session.get(join(SERVER_URL, 'api', 'customers', str(random.randint(5000, 10000)))) as resp:
        assert resp.status == 404, resp.status


@scenario(weight=8)
async def scenario_orders(session):
    async with session.get(join(SERVER_URL, 'api', 'orders')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_orders_id(session):
    async with session.get(join(SERVER_URL, 'api', 'orders', str(random.randint(1, 1000)))) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=1)
async def scenario_orders_post(session):
    data = {
        'customer_id': random.randint(1, 1000),
        'lines': [],
    }
    for i in range(0, random.randint(1, 5)):
        data['lines'].append({
            'id': random.randint(1, 6),
            'amount': random.randint(1, 4)
        })
    async with session.post(join(SERVER_URL, 'api', 'orders'), data=json.dumps(data)) as resp:
        assert resp.status == 200, resp.status
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



scenarios/molotov_scenarios.py [17:113]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@scenario(weight=2)
async def scenario_root(session):
    async with session.get(SERVER_URL) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_stats(session):
    async with session.get(join(SERVER_URL, 'api', 'stats')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=7)
async def scenario_products(session):
    async with session.get(join(SERVER_URL, 'api', 'products')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_products_top(session):
    async with session.get(join(SERVER_URL, 'api', 'products', 'top')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=6)
async def scenario_products_id(session):
    async with session.get(join(SERVER_URL, 'api', 'products', str(random.randint(1, 6)))) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=6)
async def scenario_products_id_customers(session):
    async with session.get(join(SERVER_URL, 'api', 'products', str(random.randint(1, 6)), 'customers')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=6)
async def scenario_products_id_customers_limit(session):
    async with session.get(join(SERVER_URL, 'api', 'products', str(random.randint(1, 6)), 'customers?limit=%d' % (random.randint(5, 11) * 10))) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_types(session):
    async with session.get(join(SERVER_URL, 'api', 'types')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_types_id(session):
    async with session.get(join(SERVER_URL, 'api', 'types', str(random.randint(1, 3)))) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_customers(session):
    async with session.get(join(SERVER_URL, 'api', 'customers')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_customers_id(session):
    async with session.get(join(SERVER_URL, 'api', 'customers', str(random.randint(1, 1000)))) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=2)
async def scenario_wrong_customers_id(session):
    async with session.get(join(SERVER_URL, 'api', 'customers', str(random.randint(5000, 10000)))) as resp:
        assert resp.status == 404, resp.status


@scenario(weight=8)
async def scenario_orders(session):
    async with session.get(join(SERVER_URL, 'api', 'orders')) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=8)
async def scenario_orders_id(session):
    async with session.get(join(SERVER_URL, 'api', 'orders', str(random.randint(1, 1000)))) as resp:
        assert resp.status == 200, resp.status


@scenario(weight=1)
async def scenario_orders_post(session):
    data = {
        'customer_id': random.randint(1, 1000),
        'lines': [],
    }
    for i in range(0, random.randint(1, 5)):
        data['lines'].append({
            'id': random.randint(1, 6),
            'amount': random.randint(1, 4)
        })
    async with session.post(join(SERVER_URL, 'api', 'orders'), data=json.dumps(data)) as resp:
        assert resp.status == 200, resp.status
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



