def test_create(self):
     '''
         Test that create works
     '''
     console = self.create()
     console.onecmd("create User")
     self.assertTrue(isinstance(self.capt_out.getvalue(), str))
 def test_class_name_doest_exist(self):
     '''
         Testing the error messages for class name missing.
     '''
     console = self.create()
     console.onecmd("create Binita")
     x = (self.capt_out.getvalue())
     self.assertEqual("** class doesn't exist **\n", x)
Esempio n. 3
0
 def test_show_id_missing(self):
     '''test error message'''
     console = self.create()
     console.onecmd("create User")
     user_id = self.capt_out.getvalue()
     sys.stdout = self.backup
     self.capt_out.close()
     self.capt_out = StringIO()
     sys.stdout = self.capt_out
     console.onecmd("show User")
     x = (self.capt_out.getvalue())
     sys.stdout = self.backup
     self.assertEqual("** instance id missing **\n", x)
 def test_show_class_name(self):
     '''
         Testing the error messages for class name missing.
     '''
     console = self.create()
     console.onecmd("create User")
     user_id = self.capt_out.getvalue()
     sys.stdout = self.backup
     self.capt_out.close()
     self.capt_out = StringIO()
     sys.stdout = self.capt_out
     console.onecmd("show")
     x = (self.capt_out.getvalue())
     sys.stdout = self.backup
     self.assertEqual("** class name missing **\n", x)
 def test_show(self):
     '''
         Testing that show exists
     '''
     console = self.create()
     console.onecmd("create User")
     user_id = self.capt_out.getvalue()
     sys.stdout = self.backup
     self.capt_out.close()
     self.capt_out = StringIO()
     sys.stdout = self.capt_out
     console.onecmd("show User " + user_id)
     x = (self.capt_out.getvalue())
     sys.stdout = self.backup
     self.assertTrue(str is type(x))
 def test_show_no_instance_found(self):
     '''
         Test show message error for id missing
     '''
     console = self.create()
     console.onecmd("create User")
     user_id = self.capt_out.getvalue()
     sys.stdout = self.backup
     self.capt_out.close()
     self.capt_out = StringIO()
     sys.stdout = self.capt_out
     console.onecmd("show User " + "124356876")
     x = (self.capt_out.getvalue())
     sys.stdout = self.backup
     self.assertEqual("** no instance found **\n", x)
Esempio n. 7
0
 def test_errorMessage_className_missing(self):
     '''test error message'''
     console = self.create()
     console.onecmd("create Binita")
     x = (self.capt_out.getvalue())
     self.assertEqual("** class doesn't exist **\n", x)
Esempio n. 8
0
 def test_class_name(self):
     '''test class name missing'''
     console = self.create()
     console.onecmd("create")
     x = (self.capt_out.getvalue())
     self.assertEqual("** class name missing **\n", x)
Esempio n. 9
0
 def test_create_of_fileStorage(self):
     '''test create'''
     console = self.create()
     console.onecmd("create User")
     self.assertTrue(isinstance(self.capt_out.getvalue(), str))
Esempio n. 10
0
 def test_all(self):
     ''' Test all exists'''
     console = self.create()
     console.onecmd("all")
     self.assertTrue(isinstance(self.capt_out.getvalue(), str))
Esempio n. 11
0
 def test_EOF(self):
     ''' Test EOF exists'''
     console = self.create()
     self.assertTrue(console.onecmd("EOF"))
Esempio n. 12
0
 def test_quit(self):
     ''' Test quit exists'''
     console = self.create()
     self.assertTrue(console.onecmd("quit"))