示例#1
0
文件: steps.py 项目: Bunch/lettuce
import json

from django.core.management import call_command

from leaves.models import *

from lettuce import after, step
from lettuce.django.steps.models import *

from nose.tools import assert_equals

after.each_scenario(clean_db)

max_rego = 0

@creates_models(Harvester)
def create_with_rego(step):
    data = hashes_data(step)
    for hash_ in data:
        hash_['rego'] = hash_['make'][:3].upper() + "001"
    create_models(Harvester, data)

@checks_existence(Harvester)
def check_with_rego(step):
    data = hashes_data(step)
    for hash_ in data:
        try:
            hash_['rego'] = hash_['rego'].upper()
        except KeyError:
            pass
    models_exist(Harvester, data)
示例#2
0
文件: steps.py 项目: afrank/scalr
def stop_vpc_router(step):
    lib.world.vpc_router.stop()


@step(u"White Rabbit checks server with server_id '(.*)' was updated$")
def check_update1(step, server_id):
    assert server_id in lib.update_ok
    assert lib.update_ok[server_id]


@step(u"White Rabbit checks server with server_id '(.*)' was updated (\d+) times$")
def check_update2(step, server_id, count):
    if int(count):
        assert server_id in lib.update_count
        assert lib.update_count[server_id] == int(count)


def before_scenario(scenario):
    lib.update_ok = {}
    lib.update_count = {}


def after_scenario(scenario):
    if hasattr(lib.world, 'szr_upd_client'):
        for szr_upd_client in lib.world.szr_upd_client.values():
            szr_upd_client.stop()


before.each_scenario(before_scenario)
after.each_scenario(after_scenario)