Пример #1
0
    def test_reset(self):
        task = ResetHeroAbilitiesTask(self.hero.id)

        self.assertEqual(
            task.process(FakePostpondTaskPrototype(), self.storage),
            POSTPONED_TASK_LOGIC_RESULT.SUCCESS)

        self.assertEqual(len(self.hero.abilities.all), 2)
        self.assertTrue(task.state.is_PROCESSED)
Пример #2
0
    def test_reset__timeout(self):
        task = ResetHeroAbilitiesTask(self.hero.id)

        self.hero.abilities.set_reseted_at(datetime.datetime.now())

        self.assertEqual(
            task.process(FakePostpondTaskPrototype(), self.storage),
            POSTPONED_TASK_LOGIC_RESULT.ERROR)

        self.assertTrue(len(self.hero.abilities.all) > 1)
        self.assertTrue(task.state.is_RESET_TIMEOUT)
Пример #3
0
 def test_serialization(self):
     task = ResetHeroAbilitiesTask(self.hero.id)
     self.assertEqual(
         task.serialize(),
         ResetHeroAbilitiesTask.deserialize(task.serialize()).serialize())
Пример #4
0
 def test_create(self):
     task = ResetHeroAbilitiesTask(self.hero.id)
     self.assertTrue(task.state.is_UNPROCESSED)