示例#1
0
 def test_login(self):
     middleware = []
     sendr = Sendr(app.wsgifunc(*middleware))
     r = sendr.get('/login')
     self.assertTrue(r.status == 200, "Expected 200 Response, " \
                         "instead got: %s" % r.status)
     r.mustcontain('Welcome!')
示例#2
0
 def setUp(self):
     middleware = []
     self.app = TestApp(app.wsgifunc(*middleware))
     if os.path.isfile(SESSIONS_DB):
         os.remove(SESSIONS_DB)
     create_session_database()
     self.logout()
示例#3
0
 def test_logout(self):
     middleware = []
     sendr = Sendr(app.wsgifunc(*middleware))
     r = sendr.get('/logout')
     self.assertTrue(r.status == 303, "Expected 303 Response, " \
                         "(redir from /logout to /) " \
                         "instead got: %s" % r.status)
     self.assertTrue(r.normal_body == "", "No content expected at /, " \
                         "instead got: %s" % r.normal_body)
示例#4
0
    def setUp(self):
        middleware = []
        self.app = TestApp(app.wsgifunc(*middleware))

        envoy.run(
            'mongo test_qbank_lite_assessment --eval "db.dropDatabase()"')
        envoy.run(
            'mongo test_qbank_lite_assessment_authoring --eval "db.dropDatabase()"'
        )
        envoy.run('mongo test_qbank_lite_hierarchy --eval "db.dropDatabase()"')
        envoy.run(
            'mongo test_qbank_lite_authorization --eval "db.dropDatabase()"')
        envoy.run('mongo test_qbank_lite_id --eval "db.dropDatabase()"')
        envoy.run('mongo test_qbank_lite_logging --eval "db.dropDatabase()"')
        envoy.run(
            'mongo test_qbank_lite_relationship --eval "db.dropDatabase()"')
        envoy.run(
            'mongo test_qbank_lite_repository --eval "db.dropDatabase()"')

        envoy.run(
            'mongorestore --db test_qbank_lite_authorization --drop tests/fixtures/test_qbank_lite_authorization'
        )
        envoy.run(
            'mongorestore --db test_qbank_lite_repository --drop tests/fixtures/test_qbank_lite_repository'
        )
        if os.path.isdir(TEST_DATA_STORE_PATH):
            shutil.rmtree(TEST_DATA_STORE_PATH)

        if not os.path.isdir(TEST_DATA_STORE_PATH):
            os.makedirs(TEST_DATA_STORE_PATH)

        # copy over the test fixture data from tests/fixtures
        shutil.copytree('{0}/authorization'.format(TEST_FIXTURES_PATH),
                        '{0}/authorization'.format(TEST_DATA_STORE_PATH))
        # shutil.copytree('{0}/assessment'.format(TEST_FIXTURES_PATH),
        #                 '{0}/assessment'.format(TEST_DATA_STORE_PATH))
        shutil.copytree('{0}/repository'.format(TEST_FIXTURES_PATH),
                        '{0}/repository'.format(TEST_DATA_STORE_PATH))
        shutil.copytree('{0}/cataloging'.format(TEST_FIXTURES_PATH),
                        '{0}/cataloging'.format(TEST_DATA_STORE_PATH))

        self._bank = get_fixture_bank()
示例#5
0
 def test_index(self):
     middleware = []
     testApp = TestApp(app.wsgifunc(*middleware))
     r = testApp.get('/')
     assert_equal(r.status, 200)
     r.mustcontain('Universal Access to All Knowledge')
示例#6
0
 def test_index(self):
     middleware = []
     sendr = Sendr(app.wsgifunc(*middleware))
     r = sendr.get('/')
     self.assertTrue(r.status == 303, "Expected 303 Response, " \
                         "(redir to /login) instead got: %s" % r.status)
示例#7
0
 def test_index(self):
     middleware = []
     testApp = TestApp(app.wsgifunc(*middleware))
     r = testApp.get('/')
     assert_equal(r.status, 200)
     r.mustcontain('openjournal')
示例#8
0
 def test_index(self):
     middleware = []
     testApp = TestApp(app.wsgifunc(*middleware))
     r = testApp.get('/')
     assert_equal(r.status, 200)
     r.mustcontain('openjournal')
示例#9
0
文件: wsgi.py 项目: ftao/fun
import web
from main import app

web.config.debug = False
application = app.wsgifunc()
示例#10
0
文件: test.py 项目: EHER/rest-cron
 def setUp(self):
     middleware = []
     self.testApp = TestApp(app.wsgifunc(*middleware))
示例#11
0
from main import app
application = app.wsgifunc()