示例#1
0
文件: test_misc.py 项目: UPCnet/max
 def test_raw_response_parsing(self):
     MaxAvatarsTestBase.setUp(self)
     from max.exceptions.scavenger import format_raw_response
     res = self.testapp.get('/people/test_manager/avatar')
     parsed = format_raw_response(res)
     self.assertIn('<Image data 3909 bytes>', parsed)
     MaxAvatarsTestBase.tearDown(self)
示例#2
0
 def tearDown(self):
     """
         Deletes test avatar folder with all test images
     """
     self.patched_post.stop()
     self.patched_get.stop()
     MaxAvatarsTestBase.tearDown(self)
示例#3
0
    def setUp(self):
        self.conf_dir = os.path.dirname(__file__)
        self.app = loadapp('config:tests.ini', relative_to=self.conf_dir)
        self.reset_database(self.app)
        self.app.registry.max_store.security.insert(test_default_security)
        self.app.registry.max_store.cloudapis.insert(test_cloudapis)
        self.patched_post = patch('requests.post', new=partial(mock_post, self))
        self.patched_post.start()
        self.patched_get = patch('requests.get', new=partial(mock_get, self))
        self.patched_get.start()

        self.testapp = MaxTestApp(self)
        self.create_user(test_manager)

        MaxAvatarsTestBase.setUp(self)
示例#4
0
    def setUp(self):
        self.conf_dir = os.path.dirname(os.path.dirname(__file__))

        self.app = loadapp('config:tests.ini', relative_to=self.conf_dir)
        self.app.registry.max_store.drop_collection('users')
        self.app.registry.max_store.drop_collection('activity')
        self.app.registry.max_store.drop_collection('contexts')
        self.app.registry.max_store.drop_collection('security')
        self.app.registry.max_store.drop_collection('conversations')
        self.app.registry.max_store.drop_collection('messages')
        self.app.registry.max_store.security.insert(test_default_security)
        self.patched_post = patch('requests.post', new=partial(mock_post, self))
        self.patched_post.start()
        self.testapp = MaxTestApp(self)

        self.create_user(test_manager)

        MaxAvatarsTestBase.setUp(self)