Esempio n. 1
0
	def testReturnsTiddlerElements(self):
		"""_get_tiddler_elements returns element nodes"""
		doc = _getTiddlyWiki("modern")
		nodes = main._get_tiddler_elements(doc)
		actual = nodes[0].name
		expected = "div"
		self.assertEqual(actual, expected)
Esempio n. 2
0
	def testSupportsLegacyStore(self):
		"""_get_text supports legacy (pre-v2.2) store format"""
		doc = _getTiddlyWiki("legacy")
		tiddlers = main._get_tiddler_elements(doc)
		actual = main._get_text(tiddlers[1])
		expected = u"consectetur adipisicing elit"
		self.assertEqual(expected, actual)
Esempio n. 3
0
	def testDecodesLegacyTiddlers(self):
		"""_get_text decodes legacy-store tiddlers' contents"""
		doc = _getTiddlyWiki("legacy")
		tiddlers = main._get_tiddler_elements(doc)
		actual = main._get_text(tiddlers[0])
		expected = u"l\xf6rem ips\xfcm\n\nd\xc5lor s\xe4t\n\xe6met"
		self.assertEqual(expected, actual)
Esempio n. 4
0
	def testSupportsModernStore(self):
		"""_get_title supports modern (v2.2+) store format"""
		doc = _getTiddlyWiki("modern")
		tiddlers = main._get_tiddler_elements(doc)
		actual = main._get_title(tiddlers[0])
		expected = "Foo"
		self.assertEqual(expected, actual)
Esempio n. 5
0
	def testSupportsModernStore(self):
		"""_get_text supports modern (v2.2+) store format"""
		doc = _getTiddlyWiki("modern")
		tiddlers = main._get_tiddler_elements(doc)
		actual = main._get_text(tiddlers[0])
		expected = u"l\xf6rem ips\xfcm\n\nd\xc5lor s\xe4t\n\xe6met"
		self.assertEqual(expected, actual)
Esempio n. 6
0
	def testSupportsLegacyStore(self):
		"""_get_title supports legacy (pre-v2.2) store format"""
		doc = _getTiddlyWiki("legacy")
		tiddlers = main._get_tiddler_elements(doc)
		actual = main._get_title(tiddlers[0])
		expected = "Foo"
		self.assertEqual(expected, actual)
Esempio n. 7
0
	def testReturnsTiddlerItems(self):
		"""_get_tiddler_elements returns one item per tiddler element"""
		doc = _getTiddlyWiki("modern")
		items = main._get_tiddler_elements(doc)
		actual = len(items)
		expected = 2
		self.assertEqual(actual, expected)
Esempio n. 8
0
	def testReturnsTiddlerContents(self):
		"""_get_title returns tiddler name"""
		doc = _getTiddlyWiki("modern")
		tiddlers = main._get_tiddler_elements(doc)
		actual = main._get_title(tiddlers[1])
		expected = "Bar"
		self.assertEqual(expected, actual)
Esempio n. 9
0
	def testReturnsTiddlerContents(self):
		"""_get_text returns tiddler elements' contents"""
		doc = _getTiddlyWiki("modern")
		tiddlers = main._get_tiddler_elements(doc)
		actual = main._get_text(tiddlers[1])
		expected = u"consectetur adipisicing elit"
		self.assertEqual(expected, actual)
Esempio n. 10
0
	def testProvidesTiddlerCreated(self):
		"""_generate_tiddler returns Tiddler's created attribute"""
		doc = _getTiddlyWiki("legacy")
		tiddlerElements = main._get_tiddler_elements(doc)
		tiddler = main._generate_tiddler(tiddlerElements[1])
		actual = tiddler.created
		expected = datetime(2009, 03, 26, 10, 42)
		self.assertEqual(actual, expected)
Esempio n. 11
0
	def testProvidesTiddlerFields(self):
		"""_generate_tiddler returns Tiddler's extended fields"""
		doc = _getTiddlyWiki("legacy")
		tiddlerElements = main._get_tiddler_elements(doc)
		tiddler = main._generate_tiddler(tiddlerElements[1])
		actual = tiddler.fields
		expected = { "changecount": "1" }
		self.assertEqual(actual, expected)
Esempio n. 12
0
	def testProvidesTiddlerTags(self):
		"""_generate_tiddler returns Tiddler's tags"""
		doc = _getTiddlyWiki("modern")
		tiddlerElements = main._get_tiddler_elements(doc)
		tiddler = main._generate_tiddler(tiddlerElements[0])
		actual = tiddler.tags
		expected = ["test", "tmp", u"x\xf6x"]
		self.assertEqual(actual, expected)
Esempio n. 13
0
	def testProvidesTiddlerModifier(self):
		"""_generate_tiddler returns Tiddler's modifier"""
		doc = _getTiddlyWiki("modern")
		tiddlerElements = main._get_tiddler_elements(doc)
		tiddler = main._generate_tiddler(tiddlerElements[1])
		actual = tiddler.modifier
		expected = "FND"
		self.assertEqual(actual, expected)
Esempio n. 14
0
	def testProvidesTiddlerModified(self):
		"""_generate_tiddler returns Tiddler's modified attribute"""
		doc = _getTiddlyWiki("modern")
		tiddlerElements = main._get_tiddler_elements(doc)
		tiddler = main._generate_tiddler(tiddlerElements[0])
		actual = tiddler.modified
		expected = datetime(2009, 03, 26, 10, 43)
		self.assertEqual(actual, expected)
Esempio n. 15
0
	def testProvidesTiddlerTitle(self):
		"""_generate_tiddler returns Tiddler's title"""
		doc = _getTiddlyWiki("modern")
		tiddlerElements = main._get_tiddler_elements(doc)
		tiddler = main._generate_tiddler(tiddlerElements[1])
		actual = tiddler.title
		expected = "Bar"
		self.assertEqual(actual, expected)
Esempio n. 16
0
	def testReturnsTiddler(self):
		"""_generate_tiddler returns Tiddler instance"""
		doc = _getTiddlyWiki("modern")
		tiddlerElements = main._get_tiddler_elements(doc)
		tiddler = main._generate_tiddler(tiddlerElements[0])
		actual = tiddler.title
		expected = "Foo"
		self.assertEqual(actual, expected)
Esempio n. 17
0
	def testProvidesTiddlerText(self):
		"""_generate_tiddler returns Tiddler's text"""
		doc = _getTiddlyWiki("legacy")
		tiddlerElements = main._get_tiddler_elements(doc)
		tiddler = main._generate_tiddler(tiddlerElements[0])
		actual = tiddler.text
		expected = u"l\xf6rem ips\xfcm\n\nd\xc5lor s\xe4t\n\xe6met"
		self.assertEqual(actual, expected)
Esempio n. 18
0
	def testReturnsList(self):
		"""_get_tiddler_elements returns empty list if no tiddlers in store"""
		doc = _getTiddlyWiki()
		actual = main._get_tiddler_elements(doc)
		expected = []
		self.assertEqual(actual, expected)