Ejemplo n.º 1
0
def test(app, args):
    app.check()

    # If framework-id is not a valid test-id, force it to 'test'
    if not isTestFrameworkId(app.play_env["id"]):
        app.play_env["id"] = 'test'

    print "~ Running tests with webtest"
    print "~ Ctrl+C to stop"
    print "~ "

    print "~ Deleting %s" % os.path.normpath(os.path.join(app.path, 'tmp'))
    if os.path.exists(os.path.join(app.path, 'tmp')):
        shutil.rmtree(os.path.join(app.path, 'tmp'))
    print "~"

    # overwrite app with a new one, setting id to test
    from play.application import PlayApplication
    app = PlayApplication(app.path, app.play_env, app.ignoreMissingModules)

    # Kill if exists
    http_port = 9000
    protocol = 'http'
    if app.readConf('http.port'):
        http_port = app.readConf('http.port')
    try:
        proxy_handler = urllib2.ProxyHandler({})
        opener = urllib2.build_opener(proxy_handler)
        opener.open('http://*****:*****@kill' % http_port)
    except Exception, e:
        pass
Ejemplo n.º 2
0
    def testWithoutFlag(self, mock):
        play_env = self.common.copy()

        play_app = PlayApplication('fake', play_env, True)
        play_app.java_cmd([])

        step('Assert getJavaVersion was called once')
        self.assert_(mock.called)
Ejemplo n.º 3
0
    def testWithoutFlag(self, mock):
        play_env = self.common.copy()

        play_app = PlayApplication('fake', play_env, True)
        play_app.java_cmd([])

        step('Assert getJavaVersion was called once')
        self.assert_(mock.called)
Ejemplo n.º 4
0
    def testWithFlag(self, mock):
        play_env = self.common.copy()
        # pass the jvm_version flag in
        play_env.update({'jvm_version': '42'})

        play_app = PlayApplication('fake', play_env, True)
        play_app.java_cmd([])

        step('Assert getJavaVersion was not called')
        self.assert_(not mock.called)
Ejemplo n.º 5
0
    def testWithFlag(self, mock):
        play_env = self.common.copy()
        # pass the jvm_version flag in
        play_env.update({'jvm_version': '42'})

        play_app = PlayApplication('fake', play_env, True)
        play_app.java_cmd([])

        step('Assert getJavaVersion was not called')
        self.assert_(not mock.called)