コード例 #1
0
def game_token_without_id():
    return GameToken(
        **{
            "game_token_name": "this is a new token.",
            "game_token_key": "this is a new token key.",
            "allowed_domains": ["bits-and-bobs.com"]
        })
async def create_game_token(game_token: GameToken) -> GameToken:
    return GameToken(
        **{
            "game_token_id": "the id for this token.",
            "game_token_name": "this is a new token.",
            "game_token_key": "this is a new token key.",
            "allowed_domains": ["bits-and-bobs.com"]
        })
コード例 #3
0
def testing_data_context():
    entity_1 = GameToken(
        **{
            "game_token_id": "key_1",
            "game_token_name": "this is a new token.",
            "game_token_key": "this is a new token key.",
            "allowed_domains": ["bits-and-bobs.com"]
        })

    entity_dict = dict([("game_tokens", [entity_1])])

    return DictionaryDataContext(entity_dict)
def test_update_game_token(game_token_without_id: GameToken,
                           game_token_with_id: GameToken):
    response = client.put(f"/game-tokens/{game_token_with_id.game_token_id}",
                          game_token_without_id.json())
    assert response.json() == game_token_with_id
def test_create_game_token(game_token_without_id: GameToken,
                           game_token_with_id: GameToken):
    response = client.post("/game-tokens/", game_token_without_id.json())
    assert response.json() == game_token_with_id
コード例 #6
0
 def create(self, kind: str, entity: GameToken) -> GameToken:
     entity.game_token_id = str(uuid.uuid4())
     entities = self._db_client[kind]
     entities.append(entity)
     return entity