Example #1
0
	def test_deleting(self):
		storage = RecipeStorage(TEST_DIRECTORY)
		recipe = Recipe('A.md', MARKDOWN)
		storage.save(recipe)
		recipe = Recipe('B.md', MARKDOWN)
		storage.save(recipe)
		storage.delete('A.md')
		recipes = storage.list()
		self.assertNotIn('A.md',recipes)
Example #2
0
	def test_listing(self):
		storage = RecipeStorage(TEST_DIRECTORY);

		storage.save(Recipe('MustikkaPiirakka.md', ''))
		storage.save(Recipe('Tortilla.md', ''))
		storage.save(Recipe('BologneseKastike.md', ''))
		storage.save(Recipe('Pannukakku.md', ''))

		recipe_names = storage.list()

		self.assertEqual(len(recipe_names), 4, 'There sould be four recipes stored to directory')

		#In alphabetically sorted order
		self.assertEqual(recipe_names[0], 'BologneseKastike.md')
		self.assertEqual(recipe_names[1], 'MustikkaPiirakka.md')
		self.assertEqual(recipe_names[2], 'Pannukakku.md')
		self.assertEqual(recipe_names[3], 'Tortilla.md')
Example #3
0
	def test_filtering(self):
		storage = RecipeStorage(TEST_DIRECTORY)
		recipe = Recipe('A.md', MARKDOWN)
		storage.save(recipe)
		recipe = Recipe('B.md', MARKDOWN)
		recipe = Recipe('B.MD', MARKDOWN)
		storage.save(recipe)
		recipe = Recipe('C.md', MARKDOWN)
		recipe = Recipe('C.txt', MARKDOWN)
		storage.save(recipe)
		recipe = Recipe('.gitignore', MARKDOWN)
		storage.save(recipe)
		recipes = storage.list()
		self.assertNotIn('.gitignore',recipes)
		self.assertNotIn('C.txt',recipes)
		self.assertIn('B.MD',recipes)
		self.assertIn('A.md',recipes)