def test_add_already_exist_character(self):
     print("\nadd character that already exists")
     commands = APICommands()
     character_dict = APICommands.generate_character(commands, character_name="Vasya0")
     commands.add_character(character_dict)
     result, status_code = commands.add_character(character_dict)
     assert str(status_code) == "200" and str((result['result'])) == "Vasya0 is already exists"
Example #2
0
 def setup_class(self):
     print("\ntest suite setup ")
     commands = APICommands()
     character_dict = APICommands.generate_character(commands,
                                                     character_name="Vasya")
     result, status_code = commands.get_certain_character("Vasya")
     if str(result['result']) == "No such name":
         commands.add_character(character_dict)
     else:
         commands.delete_character("Vasya")
         commands.add_character(character_dict)
 def test_add_character(self):
     print("\nadd valid character")
     commands = APICommands()
     character_dict = APICommands.generate_character(commands, character_name="Vasya0")
     result, status_code = commands.add_character(character_dict)
     assert str(status_code) == "200"
     commands.check_character(result['result'])
 def test_add_character_by_invalid_user(self):
     print("\nadd valid character by INVALID user and password")
     commands = APICommands()
     character_dict = APICommands.generate_character(commands, character_name="Vasya0")
     error, status_code = commands.add_character(character_dict, "some_login", "some_password")
     assert str(status_code) == "401" and str(error['error']) == "You have to login with proper credentials"