Пример #1
0
 def test_create(self):
     '''
         Test that create works
     '''
     console = self.create()
     console.onecmd("create User")
     self.assertTrue(isinstance(self.capt_out.getvalue(), str))
Пример #2
0
 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)
Пример #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)
Пример #4
0
 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)
Пример #5
0
 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))
Пример #6
0
 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)
Пример #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)
Пример #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)
Пример #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))
Пример #10
0
 def test_all(self):
     ''' Test all exists'''
     console = self.create()
     console.onecmd("all")
     self.assertTrue(isinstance(self.capt_out.getvalue(), str))
Пример #11
0
 def test_EOF(self):
     ''' Test EOF exists'''
     console = self.create()
     self.assertTrue(console.onecmd("EOF"))
Пример #12
0
 def test_quit(self):
     ''' Test quit exists'''
     console = self.create()
     self.assertTrue(console.onecmd("quit"))