示例#1
0
def send_access_token_error():
    while not PyTistory._is_listening():
        time.sleep(0.1)

    resp = requests.get(
        'http://0.0.0.0:5000/callback#access_token=some-access-token&state=some-state')

    resp = requests.get(
        'http://0.0.0.0:5000/callback_modified?access_token=&state=some-state')

    return resp
示例#2
0
    def test_callback_server를_이용한_인증_에러(self):
        while PyTistory._is_listening():
            time.sleep(0.1)

        process = multiprocessing.Process(target=send_access_token_error)
        process.start()

        pytistory = PyTistory()
        pytistory.__TESTING__ = True
        self.assertRaises(TokenNotFoundError,
                          pytistory.configure, client_id='some-client-id')

        process.join()
示例#3
0
    def test_callback_server를_이용한_인증(self):
        while PyTistory._is_listening():
            time.sleep(0.1)

        process = multiprocessing.Process(target=send_access_token)
        process.start()

        pytistory = PyTistory()
        pytistory.__TESTING__ = True
        pytistory.configure(client_id='some-client-id')

        self.assertEqual(pytistory.access_token,
                         'some-access-token', 'Access Token 설정 실패')

        process.join()
示例#4
0
    def test_파일을_통한_인증_CLIENT_ID만(self, _1, _2):
        while PyTistory._is_listening():
            time.sleep(0.1)

        process = multiprocessing.Process(target=send_access_token)
        process.start()

        pytistory = PyTistory()
        pytistory.__TESTING__ = True
        pytistory.configure()

        self.assertEqual(pytistory.access_token,
                         'some-access-token', 'Access Token 설정 실패')

        process.join()