Skip to content

Commit

Permalink
Add a test for GitHubOrganization.authorize()
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Apr 25, 2014
1 parent 21b70cf commit ce574c5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -5,7 +5,7 @@ python:
# https://github.com/travis-ci/travis-ci/issues/1989
#- 3.4
env:
- secure: "iVXzQqVi5GNRRC8FO7m1pH8np0Wq2/Vf6OSL/4mLbTyiPQ1UGg0hijR4jm5QK7V3rIwpmeE7hsdpjNDpxiCUYefqTJJ258q2AfBIHQzhczM0RttFtmjn8UCOL6Vx7M2nKtzb1BBmv1Rl7Yk0NwzbzUCF8tvr4xM0dGahS1ZH6f0="
- secure: "PwuMRTltLgHTUKkLLGOepfAUvsTnn5/KuoPREok4DHIxImN/6MjvtwRucewS55CRkfMMlJ/L0yXeYvIYqW0iIlig6xSYpLV43JelIQHo3NC5CuKVPacFk7od8IHNGE4VRYdnYYTkYh8iGkye0YAOE5627chqYyl6nErrXG/ZzWc="
services:
- redis-server
install:
Expand Down
2 changes: 1 addition & 1 deletion runtests.sh
Expand Up @@ -19,5 +19,5 @@ if [[ ! $(which pip | grep $VIRTUAL_ENV) ]]; then
popd
fi
pip install -f https://github.com/spoqa/sftpserver/releases -e .[tests] flake8
py.test --cov geofront
py.test --cov geofront tests
flake8
16 changes: 16 additions & 0 deletions tests/backends/github_test.py
Expand Up @@ -20,6 +20,17 @@ def fx_github_access_token(request):
return token


@fixture
def fx_github_org_login(request):
try:
org_login = request.config.getoption('--github-org-login')
except ValueError:
org_login = None
if not org_login:
skip('--github-org-login is not provided; skipped')
return org_login


_fx_github_identity_cache = None


Expand Down Expand Up @@ -54,6 +65,11 @@ def test_request(fx_github_access_token, fx_github_identity):
assert result == result2


def test_authorize(fx_github_identity, fx_github_org_login):
org = GitHubOrganization('', '', fx_github_org_login)
assert org.authorize(fx_github_identity)


def cleanup_ssh_keys(identity):
keys = request(identity, GitHubKeyStore.LIST_URL, 'GET')
for key in keys:
Expand Down
4 changes: 4 additions & 0 deletions tests/conftest.py
Expand Up @@ -55,6 +55,10 @@ def pytest_addoption(parser):
help='github access token for key store test (caution: '
'it will remove all ssh keys of the account)',
**env_default('GITHUB_ACCESS_TOKEN'))
parser.addoption('--github-org-login',
metavar='LOGIN',
help='github org login for team test',
**env_default('GITHUB_ORG_LOGIN'))


used_port = 0
Expand Down

0 comments on commit ce574c5

Please sign in to comment.