Update text() test to use dummy printer.

This commit is contained in:
Michael Elsdörfer 2016-08-30 13:08:23 +02:00
parent ea7769f8b2
commit 3d8626d17e
2 changed files with 2 additions and 27 deletions

View File

@ -1 +0,0 @@
Dies ist ein Test.

View File

@ -12,38 +12,14 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from nose.tools import with_setup
import escpos.printer as printer
from escpos.printer import Dummy
import os
import filecmp
devfile = 'testfile'
def setup_testfile():
"""create a testfile as devfile"""
fhandle = open(devfile, 'a')
try:
os.utime(devfile, None)
finally:
fhandle.close()
def teardown_testfile():
"""destroy testfile again"""
os.remove(devfile)
@with_setup(setup_testfile, teardown_testfile)
def test_function_text_dies_ist_ein_test_lf():
"""test the text printing function with simple string and compare output"""
instance = printer.File(devfile=devfile)
instance = Dummy()
instance.text('Dies ist ein Test.\n')
instance.flush()
assert(filecmp.cmp('test/Dies ist ein Test.LF.txt', devfile))
assert instance.output == 'Dies ist ein Test.\n'
def test_block_text():