def main():
  appconfigs = tools.getconfigs(
      os.path.join(
        os.path.split(
          os.path.split(os.path.abspath(__file__))[0])[0],
        'google-app-engine'))

  localhost = 'localhost:8080'
  remote_host = (str(appconfigs.get('version')) +'.latest.'+
                 appconfigs.get('application') +'.appspot.com')

  tests.set_LOCALHOST(localhost)
  tests.set_USERNAME('test_user1')
  tests.set_PASSKEY('test$key')

  if tools.checkhost(localhost):
    tests.set_HOST(localhost) 
  elif tools.checkhost(remote_host):
    tests.set_HOST(remote_host) 
  else:
    raise Exception('no connection to %s or %s'% (localhost, remote_host))

  print ''
  print 'running tests on %s' % tests.HOST
  print ''
  
  tests.setupLocalContent()

  suites.run_suites(['full'])
Пример #2
0
def main():
    # The the path to the app.yaml file and parse it.
    appconfigs = getconfigs(
        os.path.join(os.path.split(os.path.split(os.path.abspath(__file__))[0])[0], "google-app-engine")
    )

    # Set the host names.
    localhost = "localhost:8080"
    remote_host = str(appconfigs.get("version")) + ".latest." + appconfigs.get("application") + ".appspot.com"

    if checkhost(localhost):
        host = localhost
    elif checkhost(remote_host):
        host = remote_host
    else:
        raise Exception("no connection to %s or %s" % (localhost, remote_host))

    # Inform the test suites of the host discovery.
    test_utils.setup(host, (host is localhost))

    # Get the command line arguments.
    suites_ = sys.argv[1:]
    if len(suites_) is 0:
        suites_ = ["full"]

    # Tell the user we're running.
    print ""
    print "Running tests on: %s" % host
    print "Running suites: %s" % suites_
    print ""

    # Run the tests.
    suites.run_suites(suites_)
Пример #3
0
def main():
  localhost = 'localhost:8080'
  passkey = 'secret$key'

  appconfigs = getconfigs(
      os.path.join(
        os.path.split(
          os.path.split(os.path.abspath(__file__))[0])[0],
        'gae_py'))

  remote_host = (str(appconfigs.get('version')) +'.latest.'+
                 appconfigs.get('application') +'.appspot.com')

  if checkhost(localhost):
    host = localhost
    cxn = httplib.HTTPConnection(localhost)
    cxn.request('PUT', '/testsetup', None, {'Content-Length':0})
    response = cxn.getresponse()
    assert response.status == 200, \
        'Test user was not setup (status: %d)'% response.status
    temp_test_admin = response.read().rstrip()
    assert isinstance(temp_test_admin, basestring), \
        'Temp username is not a string ().'% temp_test_admin

  elif checkhost(remote_host):
    host = remote_host
    temp_test_admin, passkey = authenticate(host)
    if temp_test_admin is None:
      print 'User does not exist.'
      exit()
    if passkey is None:
      print 'Invalid passkey... exit()'
      exit()

  else:
    raise Exception('no connection to %s or %s'% (localhost, remote_host))

  test_utils.setup(host, (host is localhost), temp_test_admin, passkey)

  suites_ = sys.argv[1:]
  if len(suites_) is 0:
    suites_ = ['full']

  print ''
  print 'Running tests on: %s' % host 
  print 'Running suites: %s' % suites_
  print 'Using admin account for: %s'% temp_test_admin
  print ''

  suites.run_suites(suites_)

  # Teardown insecure user created for testing.
  try:
    teardown.teardown()
  except Exception, e:
    print ''
    print '!Error in teardown: %r'% e
    print ''
def main():
    host = session.host()
    if host is False:
        localhost = session.localhost
        remote_host = session.remote_host()
        raise Exception('no connection to %s or %s'% (localhost, remote_host))

    # Get the command line arguments.
    cl_suites = sys.argv[1:]
    if len(cl_suites) is 0:
        cl_suites = ['full']

    # Tell the user we're running.
    print ''
    print 'Running tests on: %s' % host 
    print 'Running suites: %s' % cl_suites
    print ''

    # Run the tests.
    suites.run_suites(cl_suites)