Пример #1
0
 def setUp(self):        # noqa
     # load a suitable database schema
     metadata = lti.load_metadata()
     self.container = metadata.root.DataServices.defaultContainer
     self.data_source = sql.SQLiteEntityContainer(
         file_path=':memory:', container=self.container)
     self.data_source.create_all_tables()
     self.cipher = wsgi.AppCipher(0, 'secret', self.container['AppKeys'])
     with self.container['Silos'].open() as collection:
         self.silo = collection.new_entity()
         self.silo['ID'].set_from_value(wsgi.key60(b'testing'))
         self.silo['Slug'].set_from_value('testing')
         collection.insert_entity(self.silo)
Пример #2
0
 def setUp(self):  # noqa
     # load a suitable database schema
     metadata = lti.load_metadata()
     self.container = metadata.root.DataServices.defaultContainer
     self.data_source = sql.SQLiteEntityContainer(file_path=':memory:',
                                                  container=self.container)
     self.data_source.create_all_tables()
     self.cipher = wsgi.AppCipher(0, 'secret', self.container['AppKeys'])
     with self.container['Silos'].OpenCollection() as collection:
         self.silo = collection.new_entity()
         self.silo['ID'].set_from_value(wsgi.key60('testing'))
         self.silo['Slug'].set_from_value('testing')
         collection.insert_entity(self.silo)
     self.save_time = time.time
     self.mock_time = MockTime(1420370306 + MockTime.oauth_origin)
     # patch the time module to mock it
     time.time = self.mock_time.time
Пример #3
0
 def setUp(self):        # noqa
     metadata = lti.load_metadata()
     self.container = metadata.root.DataServices.defaultContainer
     self.data_source = sql.SQLiteEntityContainer(
         file_path=':memory:', container=self.container)
     self.data_source.create_all_tables()
     self.cipher = wsgi.AppCipher(0, 'secret', self.container['AppKeys'])
     with self.container['Silos'].open() as collection:
         self.silo = collection.new_entity()
         self.silo['ID'].set_from_value(wsgi.key60(b'ToolProviderSession'))
         self.silo['Slug'].set_from_value('ToolProviderSession')
         collection.insert_entity(self.silo)
     # create a consumer
     with self.silo['Consumers'].open() as collection:
         self.consumer = lti.ToolConsumer.new_from_values(
             collection.new_entity(), self.cipher, 'test', '12345',
             'secret')
         collection.insert_entity(self.consumer.entity)