コード例 #1
0
ファイル: test_story.py プロジェクト: ChrisPenner/scavenger
 def setUp(self):
     self.testbed = testbed.Testbed()
     self.testbed.activate()
     self.testbed.init_datastore_v3_stub()
     self.testbed.init_memcache_stub()
     ndb.get_context().set_cache_policy(False)
     self.story_uid = 'STORY'
     self.clue_uid = Clue.build_uid(self.story_uid, 'START')
     self.answer_uid = Answer.build_uid(self.story_uid, 'START', 'TRANSITION')
     Story.from_uid(self.story_uid, default_hint='default hint').put()
     Clue.from_uid(self.clue_uid, text='Start the story', hint='clue hint').put()
     Answer.from_uid(
         self.answer_uid,
         pattern=r'my answer is (?P<user_answer>\w+)',
         next_clue=self.clue_uid,
         ).put()
コード例 #2
0
 def setUp(self):
     self.testbed = testbed.Testbed()
     self.testbed.activate()
     self.testbed.init_datastore_v3_stub()
     self.testbed.init_memcache_stub()
     ndb.get_context().set_cache_policy(False)
     self.story_uid = 'STORY'
     self.clue_uid = Clue.build_uid(self.story_uid, 'START')
     self.answer_uid = Answer.build_uid(self.story_uid, 'START', 'TRANSITION')
     Story.from_uid(self.story_uid, default_hint='default hint').put()
     Clue.from_uid(self.clue_uid, text='Start the story', hint='clue hint').put()
     Answer.from_uid(
         self.answer_uid,
         pattern=r'my answer is (?P<user_answer>\w+)',
         next_clue=self.clue_uid,
         ).put()
コード例 #3
0
 def setUp(self):
     super(TestScavenger, self).setUp()
     self.story = Story.from_uid('STORY', default_hint='default hint')
     self.story.put()
     self.story_code = StoryCode.from_words('salsa tacos', story_uid=self.story.uid)
     self.story_code.put()
     self.start_clue = Clue.from_uid(Clue.build_uid(self.story.uid, 'START'), text='Start the story', hint='clue hint')
     self.start_clue.put()
     self.next_clue = Clue.from_uid(Clue.build_uid(self.story.uid, 'NEXT'), text='You made it!', sender="+555")
     self.next_clue.put()
     self.answer = Answer.from_uid(
         Answer.build_uid('STORY', 'START', 'TRANSITION'),
         pattern=r'my answer is (?P<user_answer>\w+)',
         next_clue=self.next_clue.uid,
         )
     self.answer.put()