Exemple #1
0
	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")
Exemple #2
0
    def add_article(self, session, article):
        assoc = model.ArticleReader()
        assoc.reader_id = self.id
        assoc.article_id = article.id

        session.add(assoc)
        session.commit()
Exemple #3
0
	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'])
Exemple #4
0
	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'] != "")
Exemple #5
0
	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.')
Exemple #6
0
	def readarticle_validarticle_returnsvalidcontent(self):
		f = TestingFileManager()
		a = model.ArticleReader(f)
		article = a.read_article('Source01')
		assert(article.content == " Content")
Exemple #7
0
	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")
Exemple #8
0
	def readarticle_validarticle_returnsvalidtitle(self):
		f = TestingFileManager()
		a = model.ArticleReader(f)
		article = a.read_article('Source01')
		assert(article.title == "Test")
Exemple #9
0
	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