updated with functional changes, testing
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
from epubmaker.models import Name, Series, Image, Section, Book, BuildContext
|
||||
|
||||
|
||||
def test_name_defaults():
|
||||
n = Name()
|
||||
assert n.first == ""
|
||||
assert n.last == ""
|
||||
|
||||
|
||||
def test_series_defaults():
|
||||
s = Series()
|
||||
assert s.number == ""
|
||||
assert s.name == ""
|
||||
|
||||
|
||||
def test_image_defaults():
|
||||
img = Image()
|
||||
assert img.name == ""
|
||||
assert img.type == ""
|
||||
assert img.alt == ""
|
||||
assert img.caption == ""
|
||||
|
||||
|
||||
def test_section_defaults():
|
||||
s = Section()
|
||||
assert s.type == ""
|
||||
assert s.name == ""
|
||||
assert s.title == ""
|
||||
assert s.body == ""
|
||||
|
||||
|
||||
def test_book_defaults():
|
||||
b = Book()
|
||||
assert b.filename == ""
|
||||
assert b.title == ""
|
||||
assert b.titlesort == ""
|
||||
assert b.publisher == ""
|
||||
assert b.isbn == ""
|
||||
assert b.uuid == ""
|
||||
assert b.author == []
|
||||
assert b.images == []
|
||||
assert b.sections == []
|
||||
|
||||
|
||||
def test_book_nested_objects():
|
||||
b = Book()
|
||||
assert isinstance(b.series, Series)
|
||||
assert isinstance(b.artist, Name)
|
||||
assert isinstance(b.editor, Name)
|
||||
assert isinstance(b.cover, Image)
|
||||
|
||||
|
||||
def test_book_author_lists_are_independent():
|
||||
b1 = Book()
|
||||
b2 = Book()
|
||||
b1.author.append(Name(first="Jane", last="Doe"))
|
||||
assert len(b2.author) == 0
|
||||
|
||||
|
||||
def test_build_context_defaults():
|
||||
ctx = BuildContext()
|
||||
assert isinstance(ctx.book, Book)
|
||||
assert ctx.verbose is False
|
||||
assert ctx.in_section is False
|
||||
|
||||
|
||||
def test_build_context_books_are_independent():
|
||||
ctx1 = BuildContext()
|
||||
ctx2 = BuildContext()
|
||||
ctx1.book.title = "Book One"
|
||||
assert ctx2.book.title == ""
|
||||
Reference in New Issue
Block a user