示例#1
0
async def test__hero_nick_is_correct(data, hero_nick):
    dt = {"hero_nick": hero_nick}
    dt.update(data)
    train = Train(dt)
    train.states["user"] = USER
    status = await IsCorrectHeroNickSt.traveled(train)
    assert status == Code.IS_OK
示例#2
0
def train():
    train = Train(
        unique_id=UNIQUE_ID,
        chat_id=CHAT_ID,
        destination='test',
        storage={'FOO': 'foo'}
    )
    return train
示例#3
0
 def test__make_train(self):
     train = Train(
         unique_id=UNIQUE_ID,
         chat_id=CHAT_ID,
         destination=DESTINATION,
         storage={}
     )
     assert isinstance(train.answers, list)
     assert len(train.answers) == 0
     assert isinstance(train.visited, list)
     assert len(train.visited) == 0
     assert isinstance(train.has_fail, bool)
     assert train.has_fail is False
示例#4
0
    def _prepare_train(cls, user_info: TDict) -> TTrain:
        """
        Создание контейнера для данных.

        Устанавливаем `locale` - пользователя или
        по умолчанию в системе.

        :param user_info: dict
        :return: app.core.train
        """
        user_info.setdefault('locale', cls._default_locale)

        train = Train(unique_id=user_info['unique_id'],
                      chat_id=user_info['chat_id'],
                      destination=str(cls),
                      storage={'user_info': user_info})

        logger.debug(f'train: {train}')
        return train
示例#5
0
def train(data):
    return Train(data)
示例#6
0
def train():
    train = Train(DATA)
    return train
示例#7
0
def train():
    return Train(unique_id='123456789-0',
                 chat_id=123456789,
                 destination='test',
                 storage={'FOO': 'foo'})