コード例 #1
0
 def _create_player(self, player_index, options):
     player = Players()
     nickname_unique_part = str(player_index) + str(datetime.now())
     nickname_unique_hash = hashlib.sha1(nickname_unique_part).hexdigest()[:10]
     player.nickname = "test_{}".format(nickname_unique_hash)
     player.email = "{}@tut.by".format(player.nickname)
     player.password_hash = "{}{}".format(player.nickname, player.email)
     player.created = datetime.now()
     player.updated = datetime.now()
     player.xp = 0
     player.save()
     for session_index in xrange(options["session_count_per_user"]):
         self._create_session(player, session_index)
     for stat_index in xrange(1):
         self._create_stat(player, stat_index)
コード例 #2
0
 def _create_player(self, player_index, options):
     player = Players()
     nickname_unique_part = str(player_index) + str(datetime.datetime.now())
     nickname_unique_hash = hashlib.sha1(nickname_unique_part).hexdigest()[:10]
     player.nickname = "test_{}".format(nickname_unique_hash)
     player.email = "{}@tut.by".format(player.nickname)
     player.xp = random.randint(0, 10000)
     player_ttl = random.randint(10, 7200)
     player.created = datetime.datetime.now()
     player.updated = datetime.datetime.now() + datetime.timedelta(seconds=player_ttl)
     player.save()
     for session_index in xrange(options["session_count_per_user"]):
         self._create_session(player, session_index)
コード例 #3
0
 def _create_player(self, player_index, options):
     player = Players()
     nickname_unique_part = str(player_index) + str(datetime.datetime.now())
     nickname_unique_hash = hashlib.sha1(nickname_unique_part).hexdigest()[:10]
     player.nickname = "test_{}".format(nickname_unique_hash)
     player.email = "{}@tut.by".format(player.nickname)
     player.xp = 0
     player.save()
     for session_index in xrange(options["session_count_per_user"]):
         self._create_session(player, session_index)