コード例 #1
0
ファイル: test_cow.py プロジェクト: gettis/monitoring_app
 def test_publish_fails_for_invalid_auth(self):
     sess = Session(client=app.test_client())
     sess.register('testuser', 'testpassword')
     sess.use_doc('test_cow')
     sess2 = Session(client=app.test_client())
     sess2.register('testuser2', 'testpassword')
     sess2.docid = sess.docid
     self.assertRaises(Exception, sess2.publish)
コード例 #2
0
ファイル: cow_tests.py プロジェクト: ericdill/bokeh
 def test_publish_fails_for_invalid_auth(self):
     sess = TestSession(client=app.test_client())
     sess.register('testuser', 'testpassword')
     sess.use_doc('test_cow')
     sess2 = TestSession(client=app.test_client())
     sess2.register('testuser2', 'testpassword')
     sess2.docid = sess.docid
     self.assertRaises(Exception, sess2.publish)
コード例 #3
0
ファイル: test_cow.py プロジェクト: gettis/monitoring_app
 def test_publish(self):
     sess = Session(client=app.test_client())
     sess.register('testuser', 'testpassword')
     sess.use_doc('test_cow')
     sess.publish()
     doc = Doc.load(bokeh_app.servermodel_storage, sess.docid)
     assert doc.title == 'test_cow'
     assert doc.published == True
コード例 #4
0
ファイル: cow_tests.py プロジェクト: ericdill/bokeh
 def test_publish(self):
     sess = TestSession(client=app.test_client())
     sess.register('testuser', 'testpassword')
     sess.use_doc('test_cow')
     sess.publish()
     doc = Doc.load(bokeh_app.servermodel_storage, sess.docid)
     assert doc.title == 'test_cow'
     assert doc.published == True
コード例 #5
0
 def test_register_configuration(self):
     #create a dummy config file
     config = tempfile.mkdtemp()
     #create server
     server = Session(name="foo",
                      client=app.test_client(),
                      configdir=config,
                      load_from_config=True)
     assert server.userapikey == "nokey"
     #register a user
     server.register("testuser", "fluffy")
     assert server.userapikey and server.userapikey != "nokey"
     server2 = Session(name="foo",
                       client=app.test_client(),
                       configdir=config,
                       load_from_config=True)
     assert server2.userapikey == server.userapikey
     assert server2.root_url == server.root_url
コード例 #6
0
 def test_register_configuration(self):
     #create a dummy config file
     config = tempfile.mkdtemp()
     #create server
     server = Session(name="foo",
                      client=app.test_client(),
                      configdir=config,
                      load_from_config=True)
     assert server.userapikey == "nokey"
     #register a user
     server.register("testuser", "fluffy")
     assert server.userapikey and server.userapikey != "nokey"
     server2 = Session(name="foo",
                       client=app.test_client(),
                       configdir=config,
                       load_from_config=True)
     assert server2.userapikey == server.userapikey
     assert server2.root_url == server.root_url
コード例 #7
0
    def test_login2(self):
        #create a server config, register a user
        config1 = tempfile.mkdtemp()
        server = Session(name="foo",
                         client=app.test_client(),
                         configdir=config1,
                         load_from_config=True)
        assert server.userapikey == "nokey"
        server.register("testuser", "fluffy")
        assert server.userapikey and server.userapikey != "nokey"

        config2 = tempfile.mkdtemp()
        server2 = Session(name="foo",
                          client=app.test_client(),
                          configdir=config2,
                          load_from_config=True)
        assert server2.userapikey == "nokey"
        server2.login("testuser", "fluffy")
        #make sure the userapikeys match
        assert server2.userapikey == server.userapikey
コード例 #8
0
    def test_login2(self):
        #create a server config, register a user
        config1 = tempfile.mkdtemp()
        server = Session(name="foo",
                         client=app.test_client(),
                         configdir=config1,
                         load_from_config=True)
        assert server.userapikey == "nokey"
        server.register("testuser", "fluffy")
        assert server.userapikey and server.userapikey != "nokey"

        config2 = tempfile.mkdtemp()
        server2 = Session(name="foo",
                          client=app.test_client(),
                          configdir=config2,
                          load_from_config=True)
        assert server2.userapikey == "nokey"
        server2.login("testuser", "fluffy")
        #make sure the userapikeys match
        assert server2.userapikey == server.userapikey
コード例 #9
0
 def test_register_twice_should_fail(self):
     sess = Session(client=app.test_client())
     sess.register('testuser1', 'testpassword1')
     self.assertRaises(RuntimeError, sess.register, 'testuser1',
                       'testpassword1')
コード例 #10
0
 def test_register(self):
     sess = Session(client=app.test_client())
     sess.register('testuser1', 'testpassword1')
     sess.userinfo['username'] == 'testuser1'
コード例 #11
0
ファイル: multiuser_auth_test.py プロジェクト: ericdill/bokeh
 def test_register_twice_should_fail(self):
     sess = TestSession(client=app.test_client())
     sess.register('testuser1', 'testpassword1')
     self.assertRaises(RuntimeError, sess.register, 'testuser1', 'testpassword1')
コード例 #12
0
ファイル: multiuser_auth_test.py プロジェクト: ericdill/bokeh
 def test_register(self):
     sess = TestSession(client=app.test_client())
     sess.register('testuser1', 'testpassword1')
     sess.userinfo['username'] == 'testuser1'