Ejemplo n.º 1
0
 def test_get_nonexistent_character(self):
     print("\nget character that doesn't exist by valid user")
     commands = APICommands()
     result, status_code = commands.get_certain_character(
         "nonexistent_user")
     assert str(status_code) == "200" and str(
         result['result']) == "No such name"
Ejemplo n.º 2
0
 def test_get_character_by_invalid_user(self):
     print("\nget character that exists by INVALID user and password")
     commands = APICommands()
     error, status_code = commands.get_certain_character(
         "Vasya", "some_login", "some_password")
     assert str(status_code) == "401" and str(
         error['error']) == "You have to login with proper credentials"
Ejemplo n.º 3
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)
Ejemplo n.º 4
0
 def test_get_certain_character(self):
     print("\nget character that exists by valid user")
     commands = APICommands()
     result, status_code = commands.get_certain_character("Vasya")
     assert str(status_code) == "200"
     commands.check_character(result['result'][0])
Ejemplo n.º 5
0
 def teardown_class(self):
     print("\ntest suite teardown")
     commands = APICommands()
     result, status_code = commands.get_certain_character("Vasya")
     if str(result['result']) != "No such name":
         commands.delete_character("Vasya")