Beispiel #1
0
def mk_cli_user(fixture_session: tuple) -> Misskey:
    return Misskey(TEST_HOST, i=fixture_session[1])
Beispiel #2
0
def mk_cli_anon() -> Misskey:
    return Misskey(TEST_HOST)
Beispiel #3
0
def mk_cli_admin(fixture_session: tuple) -> Misskey:
    return Misskey(TEST_HOST, i=fixture_session[0])
Beispiel #4
0
import threading
import json
from misskey import Misskey
from copy import deepcopy
from time import sleep
import os
client = Misskey(os.environ["ACCESS_TOKEN"])

myUserId = client.rest("i").json()["id"]

myGames = client.rest("othello/games", {"my": True}).json()

rival = {"b": "w", "w": "b"}  # 相手の石


def turn(board: list, pos: int, my: str = "b"):
    """実際に置いてひっくりかえした結果を返す"""
    boardWidth = len(board[0])
    boardHeight = len(board)
    if board[pos // boardWidth][pos % boardWidth] != "-":
        return board  # そこには置けない
    board = deepcopy(board)

    other = rival[my]  # 自分じゃないほう
    px = pos % boardWidth
    py = int(pos / boardWidth)
    for hx in range(3):
        hx -= 1
        for hy in range(3):
            hy -= 1
            if hy == 0 and hx == 0:
Beispiel #5
0
def test_token_should_be_settable_and_deletable(mk_user_token: str):
    mk = Misskey(TEST_HOST)
    mk.token = mk_user_token
    assert type(mk.token) == str
    del mk.token
    assert mk.token is None
Beispiel #6
0
def test_should_token_error_in_setter(host: str, token: str):
    with pytest.raises(MisskeyAuthorizeFailedException):
        mk = Misskey(host)
        mk.token = token
Beispiel #7
0
def test_should_token_error_in_init(host: str, token: str):
    with pytest.raises(MisskeyAuthorizeFailedException):
        Misskey(host, i=TEST_HOST)
Beispiel #8
0
def test_should_connect_error_in_init(host: str):
    with pytest.raises(requests.exceptions.ConnectionError):
        Misskey(host)