mirror of
https://github.com/lepture/captcha.git
synced 2026-03-13 09:43:22 +08:00
20 lines
416 B
Python
20 lines
416 B
Python
# coding: utf-8
|
|
|
|
import os
|
|
from captcha.image import ImageCaptcha
|
|
|
|
ROOT = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
|
def test_image_generate():
|
|
captcha = ImageCaptcha()
|
|
data = captcha.generate('1234')
|
|
assert hasattr(data, 'read')
|
|
|
|
|
|
def test_save_image():
|
|
captcha = ImageCaptcha()
|
|
filepath = os.path.join(ROOT, 'demo.png')
|
|
captcha.write('1234', filepath)
|
|
assert os.path.isfile(filepath)
|