Exemplo n.º 1
0
 def test_to_dict(self):
     """
     Check dict method.
     """
     new_state = State()
     new_state.first_name = "no"
     new_state.last_name = "thats confidential"
     new_state.save()
     new_state_json = new_state.to_dict()
     self.assertIsInstance(new_state_json, dict)
Exemplo n.º 2
0
 def test_to_dic(self):
     '''Test the correct output of the 'to_dic' method'''
     test3 = State()
     dic = test3.to_dict()
     self.assertEqual(len(dic), 4)
     test3.name = 'Alexander'
     dic = test3.to_dict()
     self.assertEqual(len(dic), 5)
     test3.last_name = 'Milne'
     dic = test3.to_dict()
     self.assertEqual(len(dic), 6)
     for i in dic.values():
         self.assertEqual(type(i), str)
Exemplo n.º 3
0
    def test_state_save(self):
        """test_state_save test

        Test save method
        """
        my_state = State()
        my_state.first_name = "Jerry"
        my_state.last_name = "Mouse"
        my_state.email = "*****@*****.**"
        my_state.password = "******"
        my_state.save()
        self.assertTrue(path.exists("file.json"))
        os.remove("file.json")
Exemplo n.º 4
0
    def test_state_instance(self):
        """test_State_instance test

        Test instance class
        """
        my_state = State()
        my_state.first_name = "Jerry"
        my_state.last_name = "Mouse"
        my_state.email = "*****@*****.**"
        my_state.password = "******"
        self.assertEqual(my_state.first_name, "Jerry")
        self.assertEqual(my_state.last_name, "Mouse")
        self.assertEqual(my_state.email, "*****@*****.**")
        self.assertEqual(my_state.password, "root")