Ejemplo n.º 1
0
 def setUpClass(cls):
     user_service = ServiceFactory.get_user_service()
     user_service.add_user("bot_user1", "a", UserRights.ADMIN)
     user_service.add_user("bot_user2", "a")
     with log_in_user("bot_user1", "a"):
         game_service = ServiceFactory.get_game_service()
         game_service.add_game("game1", "source", "2")
Ejemplo n.º 2
0
 def setUpClass(cls):
     user_service = ServiceFactory.get_user_service()
     user_service.add_user("bot_user1", "a", UserRights.ADMIN)
     user_service.add_user("bot_user2", "a")
     with log_in_user("bot_user1", "a"):
         game_service = ServiceFactory.get_game_service()
         game_service.add_game("game1", "source", "2")
Ejemplo n.º 3
0
 def tearDownClass(cls):
     user_service = ServiceFactory.get_user_service()
     with log_in_user("bot_user1", "a"):
         game_service = ServiceFactory.get_game_service()
         game_service.remove_game("game1")
         user_service.remove_user("bot_user2")
         user_service.remove_user("bot_user1")
Ejemplo n.º 4
0
 def tearDownClass(cls):
     user_service = ServiceFactory.get_user_service()
     with log_in_user("bot_user1", "a"):
         game_service = ServiceFactory.get_game_service()
         game_service.remove_game("game1")
         user_service.remove_user("bot_user2")
         user_service.remove_user("bot_user1")
Ejemplo n.º 5
0
    def tearDownClass(cls):
        user_service = ServiceFactory.get_user_service()
        game_service = ServiceFactory.get_game_service()
        bot_service = ServiceFactory.get_bot_service()

        with log_in_user("battle_user2", "a"):
            bot_service.remove_bot("battle_bot")
            bot_service.remove_bot("battle_bot1")

        with log_in_user("battle_user1", "a"):
            bot_service.remove_bot("battle_bot")
            bot_service.remove_bot("battle_bot1")
            game_service.remove_game("battle_game")
            game_service.remove_game("error_game")
            user_service.remove_user("battle_user2")
            user_service.remove_user("battle_user1")
Ejemplo n.º 6
0
    def tearDownClass(cls):
        user_service = ServiceFactory.get_user_service()
        game_service = ServiceFactory.get_game_service()
        bot_service = ServiceFactory.get_bot_service()

        with log_in_user("battle_user2", "a"):
            bot_service.remove_bot("battle_bot")
            bot_service.remove_bot("battle_bot1")

        with log_in_user("battle_user1", "a"):
            bot_service.remove_bot("battle_bot")
            bot_service.remove_bot("battle_bot1")
            game_service.remove_game("battle_game")
            game_service.remove_game("error_game")
            user_service.remove_user("battle_user2")
            user_service.remove_user("battle_user1")
Ejemplo n.º 7
0
    def setUpClass(cls):
        user_service = ServiceFactory.get_user_service()
        game_service = ServiceFactory.get_game_service()
        bot_service = ServiceFactory.get_bot_service()

        user_service.add_user("battle_user1", "a", UserRights.ADMIN)
        user_service.add_user("battle_user2", "a")

        with log_in_user("battle_user1", "a"):
            game_service.add_game("error_game", "1/0", "2")
            game_service.add_game("battle_game", "final_order = [0, 1]", "2")
            bot_service.add_bot("battle_bot", "battle_game", "")
            bot_service.add_bot("battle_bot1", "error_game", "")

        with log_in_user("battle_user2", "a"):
            bot_service.add_bot("battle_bot", "battle_game", "")
            bot_service.add_bot("battle_bot1", "error_game", "")
Ejemplo n.º 8
0
    def setUpClass(cls):
        user_service = ServiceFactory.get_user_service()
        game_service = ServiceFactory.get_game_service()
        bot_service = ServiceFactory.get_bot_service()

        user_service.add_user("battle_user1", "a", UserRights.ADMIN)
        user_service.add_user("battle_user2", "a")

        with log_in_user("battle_user1", "a"):
            game_service.add_game("error_game", "1/0", "2")
            game_service.add_game("battle_game", "final_order = [0, 1]", "2")
            bot_service.add_bot("battle_bot", "battle_game", "")
            bot_service.add_bot("battle_bot1", "error_game", "")

        with log_in_user("battle_user2", "a"):
            bot_service.add_bot("battle_bot", "battle_game", "")
            bot_service.add_bot("battle_bot1", "error_game", "")
Ejemplo n.º 9
0
 def setUp(self):
     self.service = ServiceFactory.get_game_service()
     self.user_service = ServiceFactory.get_user_service()
Ejemplo n.º 10
0
 def setUpClass(cls):
     user_service = ServiceFactory.get_user_service()
     user_service.add_user("game_user1", "a", UserRights.ADMIN)
Ejemplo n.º 11
0
def log_in_user(user_name, password):
    ServiceFactory.get_user_service().log_in(user_name, password)
    yield
    ServiceFactory.get_user_service().log_out()
Ejemplo n.º 12
0
 def setUp(self):
     self.service = ServiceFactory.get_battle_service()
     self.user_service = ServiceFactory.get_user_service()
     self.bot_service = ServiceFactory.get_bot_service()
     self.game_service = ServiceFactory.get_game_service()
Ejemplo n.º 13
0
def reloaded_bots():
    bot_service = ServiceFactory.get_bot_service()
    bot1 = bot_service.get_bot_for_user("battle_user1", "battle_bot")
    bot2 = bot_service.get_bot_for_user("battle_user2", "battle_bot")
    yield [bot1, bot2]
Ejemplo n.º 14
0
 def setUp(self):
     self.service = ServiceFactory.get_game_service()
     self.user_service = ServiceFactory.get_user_service()
Ejemplo n.º 15
0
 def setUpClass(cls):
     user_service = ServiceFactory.get_user_service()
     user_service.add_user("game_user1", "a", UserRights.ADMIN)
Ejemplo n.º 16
0
def log_in_user(user_name, password):
    ServiceFactory.get_user_service().log_in(user_name, password)
    yield
    ServiceFactory.get_user_service().log_out()
Ejemplo n.º 17
0
 def setUp(self):
     self.service = ServiceFactory.get_battle_service()
     self.user_service = ServiceFactory.get_user_service()
     self.bot_service = ServiceFactory.get_bot_service()
     self.game_service = ServiceFactory.get_game_service()
Ejemplo n.º 18
0
def reloaded_bots():
    bot_service = ServiceFactory.get_bot_service()
    bot1 = bot_service.get_bot_for_user("battle_user1", "battle_bot")
    bot2 = bot_service.get_bot_for_user("battle_user2", "battle_bot")
    yield [bot1, bot2]