def readarticle_validarticle_returnsvalidchildren(self): f = TestingFileManager() a = model.ArticleReader(f) article = a.read_article('Source01') assert(len(article.children) == 2) assert(article.children[0] == "Children01") assert(article.children[1] == "Children02")
def add_article(self, session, article): assoc = model.ArticleReader() assoc.reader_id = self.id assoc.article_id = article.id session.add(assoc) session.commit()
def updateparent_childrenwithnoparent_updateschildrenwithoneparent(self): f = TestingFileManagerForLinks() f.articles.append(model.Article("Parent01", [], ["Children01"], "")) f.articles.append(model.Article("Children01", [], [], "")) reader = model.ArticleReader(f) linker = model.FileLinker(f, reader) linker.update_parents() assert("Parent01" in f.source['Children01'])
def createnewfiles_childwithinexistingparent_createsnewparent(self): f = TestingFileManagerForLinks() f.articles.append(model.Article("Children01", ["Parent01"], [], "")) reader = model.ArticleReader(f) linker = model.FileLinker(f, reader) linker.open_editor_on_create = False linker.create_new_files() assert(len(f.source) == 1) assert(f.source['Parent01'] != "")
def savearticle_savescorrectlyformattedarticle(self): f = TestingFileManager() a = model.ArticleReader(f) article = model.Article("TestArticle", ["Parent01"], ["Children01", "Children02"], "This is the article content.") a.save_article(article) assert(f.source == '{\n"Title": "TestArticle",\n"Abstract": "", \n"Parents": ["Parent01"], \n"Children": ["Children01","Children02"] \n}\nThis is the article content.')
def readarticle_validarticle_returnsvalidcontent(self): f = TestingFileManager() a = model.ArticleReader(f) article = a.read_article('Source01') assert(article.content == " Content")
def readarticle_validarticle_returnsvalidparents(self): f = TestingFileManager() a = model.ArticleReader(f) article = a.read_article('Source01') assert(len(article.parents) == 1) assert(article.parents[0] == "Parent01")
def readarticle_validarticle_returnsvalidtitle(self): f = TestingFileManager() a = model.ArticleReader(f) article = a.read_article('Source01') assert(article.title == "Test")
def get_source_content(self, name): article = self.get_article_internal(name) a = model.ArticleReader(self) content = a.get_frontmatter_json(article) + "\n" + article.content return content