コード例 #1
0
 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'])
コード例 #2
0
 def test_update_character(self):
     print("\nupdate exists character")
     commands = APICommands()
     character_dict = APICommands.generate_character(
         commands, character_name="Vasya0")
     result, status_code = commands.update_character(
         "Vasya0", character_dict)
     # status_code == 500 at 2:20 o'clock 15.05.2019. (system not available or bug ?)
     assert str(status_code) == "200"
     commands.check_character(result['result'])
コード例 #3
0
 def test_update_nonexistent_character(self):
     # Does this command create character if not exist? i think so
     print("\nupdate nonexistent character")
     commands = APICommands()
     character_dict = APICommands.generate_character(
         commands, character_name="nonexis")
     result, status_code = commands.update_character(
         "nonexis", character_dict)
     assert str(status_code) == "200"
     commands.check_character(result['result'])
コード例 #4
0
 def test_get_all_characters(self):
     print("\nget all characters. Actions:")
     print("\n1. add 3 character")
     print("\n2. get all characters, but check 3(exist)")
     print("\n3. del 3 character")
     commands = APICommands()
     all_characters, status_code = commands.get_all_characters()
     assert str(status_code) == "200"
     # todo удалить базу и проверить, что все верные возвращаются
     # сделана проверка хотя бы 3 штуки
     all_characters = all_characters['result']
     i = 0
     for cur_character in all_characters:
         if "Vasya" in cur_character["name"]:
             commands.check_character(cur_character)
             i += 1
     assert i == 3
コード例 #5
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])