def test_NotesApplication_search(self):
     """Tests if the search method returns a 'Not found' string."""
     search = NotesApplication('John')
     search.create("Nigeria")
     search.create("Andela")
     self.assertEqual(False, search.search("lists"),
                      msg="Wrong entry! Type a word or text!")
		def test_notes_create_4(self):
			notes = NotesApplication('Author', 'Test Content1')
			notes.create("Test Content2")
			notes.create("Test Content3")
			notes.create("Test Content4")
			length = len(notes.notes)
			self.assertEqual(length, 4, msg='A new note was not created')
		def test_notes_create_5(self):
			notes = NotesApplication('Author', ['Test Content1', 'Test Content2', 'Test Content3'])
			notes.create("Test Content4")
			notes.create("Test Content5")
			notes.create("Test Content6")
			length = len(notes.notes)
			self.assertEqual(length, 6, msg='A new note was not created')
 def test_NotesApplication_delete2(self):
     """Tests if the delete method \
     returns False \
     when the ID selected is out of range.
     """
     delete2 = NotesApplication('John')
     delete2.create("Nigeria")
     self.assertEqual(False, delete2.delete(7), msg="Index out of range")
 def test_NotesApplication_edit(self):
     """Tests if the edit method \
     returns True \
     when a note is successfully edited.\
     """
     edit = NotesApplication('John')
     edit.create("Nigeria")
     self.assertEqual(
         "Noted edited successfully!", edit.edit(0, "Wonderful!"))
 def test_NotesApplication_delete(self):
     """Tests if the delete method \
     returns a True \
     when a note is successfully deleted\
     """
     delete = NotesApplication('John')
     delete.create("Nigeria")
     delete.create("Andela")
     self.assertEqual("Note successfully deleted!", delete.delete(0))
 def test_NotesApplication_get(self):
     """Tests if the get method \
     returns False \
     when the ID selected is out of range.
     """
     get1 = NotesApplication('John')
     get1.create("Nigeria")
     get1.create("Andela")
     self.assertEqual(False, get1.get(7),
                      msg="Wrong entry! Type a word or text!")
 def test_NotesApplication_list2(self):
     """Tests if the lists method \
     returns the number of elements \
     contained in the list.
     """
     list2 = NotesApplication('John')
     list2.create("Nigeria")
     list2.create("Andela")
     counter = list2.lists()
     self.assertEqual(counter, 2, msg="Successful!")
 def test_NotesApplication_list3(self):
     """Tests if the lists method \
     returns the number of elements \
     contained in the list.
     """
     list3 = NotesApplication('John')
     list3.create("Nigeria")
     list3.create("Andela")
     list3.create("Lagos")
     counter = list3.lists()
     self.assertEqual(counter, 3)
		def test_notes_create_3(self):
			notes = NotesApplication('Author')
			notes.create("Test Content")
			length = len(notes.notes)
			self.assertEqual(length, 1, msg='A new note was not created')
		def test_create_with_empty_string(self):
			notes = NotesApplication('Author')
			notes.create('')
			length = len(notes.notes)
			self.assertEqual(length, 0, msg='No String was passed in, A note is not to be created')
Esempio n. 12
0
	def test_single_note(self):
		"""Test that a single note is stored properly"""
		test_notesApp = NotesApplication('',[])
		test_notesApp.create('Four')
		self.assertIn('Four',test_notesApp.notes_list)
	def test_result_get_note_using_note_id_is_of_type_string(self):
		obj = NotesApplication('Lolo')
		obj.create('This is Andela')
		note = obj.get_note(0)

		self.assertEqual(True, type(note) is str)
 def test_NotesApplication_create2(self):
     """Tests users inputs correct entry or empty string"""
     create2 = NotesApplication('John')
     self.assertEqual(False,
                      create2.create(""),
                      msg="Wrong entry! Type a word or text!")
    def test_NotesApplication_create(self):
        """Tests if the create method creates a note."""

        create = NotesApplication('John')
        self.assertEqual(
            "Note created successfully!", create.create(" Nigeria"))
		def test_retrieve_notes_valid_index(self):
			notes = NotesApplication('Author')
			notes.create("Test Content")
			note = notes.get(0)
			self.assertEqual(note, "Test Content", msg='Retrieving a note with a valid index should return the correct note')
Esempio n. 17
0
from notesapplication import NotesApplication

name = raw_input("Please input Author's Name: ")

notes = NotesApplication(name)
inp = ""
while inp!= "q":
	print("\n\n\t\t\t\t\t\t\t\tMain Menu\t\t\t\t\t\t\t\t\t\t\t\t\t\t")
	print("\n------------------------------------------------------------------------------------------------------------------------------------")
	response = raw_input("Enter c to create a new Note or q to quit or n to go to next menu ")
	if response=="c":
		notes_content = raw_input("\n\nPlease Enter your note: ")
		notes.create(notes_content)

		print("\n\nNotes have been saved successfully")
		print("\n\n\t\t\t\t\t\t\t\tMenu\t\t\t\t\t\t\t\t\t\t\t\t\t\t")
		print("\n------------------------------------------------------------------------------------------------------------------------------------")
		print("\n\nPress m to return to menu")
		print("\nPress s to search for a specific string")
		print("\nPress r to retrieve a specific note")
		print("\nPress d to delete a specific note")
		print("\nPress e to edit a specific note")
		print("\nPress l to retrieve all notes: ")

		res = raw_input("\nEnter Choice: ")

		if(res=="l"):
			notes.list()
		elif res=="m":
			continue
		elif res=="s":