Merge pull request #275 from jonparrott/master
Adding travis and tox configuration to run the app engine tests
This commit is contained in:
@@ -11,6 +11,12 @@ env:
|
|||||||
- TOX_ENV=docs
|
- TOX_ENV=docs
|
||||||
- TOX_ENV=system-tests
|
- TOX_ENV=system-tests
|
||||||
- TOX_ENV=system-tests3
|
- TOX_ENV=system-tests3
|
||||||
|
- TOX_ENV=gae
|
||||||
|
global:
|
||||||
|
- GAE_PYTHONPATH=${HOME}/.cache/google_appengine
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- ${HOME}/.cache
|
||||||
install:
|
install:
|
||||||
- ./scripts/install.sh
|
- ./scripts/install.sh
|
||||||
script:
|
script:
|
||||||
|
|||||||
@@ -25,3 +25,7 @@ if [[ "${TOX_ENV}" == "pypy" ]]; then
|
|||||||
pyenv install pypy-2.6.0
|
pyenv install pypy-2.6.0
|
||||||
pyenv global pypy-2.6.0
|
pyenv global pypy-2.6.0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "${TOX_ENV}" == "gae" && ! -d ${GAE_PYTHONPATH} ]]; then
|
||||||
|
python scripts/fetch_gae_sdk.py `dirname ${GAE_PYTHONPATH}`
|
||||||
|
fi
|
||||||
|
|||||||
10
tests/data/app.yaml
Normal file
10
tests/data/app.yaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Dummy app.yaml to placate nosegae.
|
||||||
|
application: oauth2client
|
||||||
|
version: 1
|
||||||
|
runtime: python27
|
||||||
|
api_version: 1
|
||||||
|
threadsafe: yes
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- url: /.*
|
||||||
|
script: null.app
|
||||||
@@ -26,6 +26,7 @@ import datetime
|
|||||||
import httplib2
|
import httplib2
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
import urllib
|
import urllib
|
||||||
@@ -58,6 +59,7 @@ from oauth2client.appengine import FlowProperty
|
|||||||
from oauth2client.appengine import OAuth2Decorator
|
from oauth2client.appengine import OAuth2Decorator
|
||||||
from oauth2client.appengine import OAuth2DecoratorFromClientSecrets
|
from oauth2client.appengine import OAuth2DecoratorFromClientSecrets
|
||||||
from oauth2client.appengine import StorageByKeyName
|
from oauth2client.appengine import StorageByKeyName
|
||||||
|
from oauth2client.client import _CLOUDSDK_CONFIG_ENV_VAR
|
||||||
from oauth2client.client import AccessTokenRefreshError
|
from oauth2client.client import AccessTokenRefreshError
|
||||||
from oauth2client.client import Credentials
|
from oauth2client.client import Credentials
|
||||||
from oauth2client.client import FlowExchangeError
|
from oauth2client.client import FlowExchangeError
|
||||||
@@ -240,8 +242,10 @@ class TestAppAssertionCredentials(unittest.TestCase):
|
|||||||
self.assertEqual(None, token.expires_in)
|
self.assertEqual(None, token.expires_in)
|
||||||
|
|
||||||
def test_save_to_well_known_file(self):
|
def test_save_to_well_known_file(self):
|
||||||
|
os.environ[_CLOUDSDK_CONFIG_ENV_VAR] = tempfile.mkdtemp()
|
||||||
credentials = AppAssertionCredentials([])
|
credentials = AppAssertionCredentials([])
|
||||||
self.assertRaises(NotImplementedError, save_to_well_known_file, credentials)
|
self.assertRaises(NotImplementedError, save_to_well_known_file, credentials)
|
||||||
|
del os.environ[_CLOUDSDK_CONFIG_ENV_VAR]
|
||||||
|
|
||||||
|
|
||||||
class TestFlowModel(db.Model):
|
class TestFlowModel(db.Model):
|
||||||
|
|||||||
11
tox.ini
11
tox.ini
@@ -1,5 +1,5 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = py26,py27,py33,py34,pypy,cover
|
envlist = py26,py27,py33,py34,pypy,gae,cover
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
basedeps = keyring
|
basedeps = keyring
|
||||||
@@ -51,6 +51,15 @@ basepython = python2.6
|
|||||||
deps = {[testenv]basedeps}
|
deps = {[testenv]basedeps}
|
||||||
django>=1.5,<1.6
|
django>=1.5,<1.6
|
||||||
|
|
||||||
|
[testenv:gae]
|
||||||
|
basepython = python2.7
|
||||||
|
deps = {[testenv]basedeps}
|
||||||
|
nosegae
|
||||||
|
commands =
|
||||||
|
nosetests --with-gae --gae-application=tests/data --logging-level=INFO {posargs} tests/test_appengine.py
|
||||||
|
setenv:
|
||||||
|
PYTHONPATH={env:GAE_PYTHONPATH:}
|
||||||
|
|
||||||
[testenv:system-tests]
|
[testenv:system-tests]
|
||||||
basepython =
|
basepython =
|
||||||
python2.7
|
python2.7
|
||||||
|
|||||||
Reference in New Issue
Block a user