Repository: drdoctr/doctr

Issue:
Issues with travis-ci.com
There are some issues with travis-ci.com that weren't fixed at https://github.com/drdoctr/doctr/pull/310

It looks like repos that aren't activated on either lead to a KeyError.

Also, apparently the travis-ci.com API has a key to indicate if a repo is also on .org, but it is currently broken. See https://travis-ci.community/t/active-on-org-from-api-v3-is-wrong/1199.

Discussion:

Patch:
diff --git a/doctr/__main__.py b/doctr/__main__.py
index 810a4f80..87b7782a 100644
--- a/doctr/__main__.py
+++ b/doctr/__main__.py
@@ -36,15 +36,18 @@ from textwrap import dedent
 
 from .local import (generate_GitHub_token, encrypt_variable, encrypt_to_file,
     upload_GitHub_deploy_key, generate_ssh_key, check_repo_exists,
-    GitHub_login, guess_github_repo, AuthenticationFailed, GitHubError)
+GitHub_login, guess_github_repo, AuthenticationFailed, GitHubError,
+    get_travis_token)
 from .travis import (setup_GitHub_push, commit_docs, push_docs,
     get_current_repo, sync_from_log, find_sphinx_build_dir, run,
     get_travis_branch, copy_to_tmp, checkout_deploy_branch)
 
-from .common import red, green, blue, bold_black, BOLD_BLACK, BOLD_MAGENTA, RESET
+from .common import (red, green, blue, bold_black, BOLD_BLACK, BOLD_MAGENTA,
+                     RESET, input)
 
 from . import __version__
 
+
 def make_parser_with_config_adder(parser, config):
     """factory function for a smarter parser:
 
@@ -200,13 +203,16 @@ options available.
         configure from asking for your GitHub credentials, use
         --no-authenticate.""")
     configure_parser.add_argument("--no-authenticate", action="store_false",
-        default=True, dest="authenticate", help="""Don't authenticate with GitHub. This option implies --no-upload-key. Note:
-        it is not possible to configure travis-ci.com with this option, only
-        .org (see https://github.com/travis-ci/travis-ci/issues/9954). This
+        default=True, dest="authenticate", help="""Don't authenticate with GitHub. This option implies --no-upload-key. This
         option is also not compatible with private repositories.""")
     configure_parser.add_argument('--key-path', default=None,
         help="""Path to save the encrypted GitHub deploy key. The default is github_deploy_key_+
         deploy respository name. The .enc extension is added to the file automatically.""")
+    configure_parser.add_argument('--travis-tld', default=None,
+        help="""Travis tld to use. Should be either '.com' or '.org'. The default is to
+        check which the repo is activated on and ask if it is activated on
+        both.""", choices=['c', 'com', '.com', 'travis-ci.com', 'o', 'org', '.org',
+                           'travis-ci.org'])
 
     return parser
 
@@ -380,6 +386,12 @@ def configure(args, parser):
     if not args.authenticate:
         args.upload_key = False
 
+    if args.travis_tld:
+        if args.travis_tld in ['c', 'com', '.com', 'travis-ci.com']:
+            args.travis_tld = 'travis-ci.com'
+        else:
+            args.travis_tld = 'travis-ci.org'
+
     print(green(dedent("""\
     Welcome to Doctr.
 
@@ -398,6 +410,7 @@ def configure(args, parser):
     else:
         login_kwargs = {'auth': None, 'headers': None}
 
+    GitHub_token = None
     get_build_repo = False
     default_repo = guess_github_repo()
     while not get_build_repo:
@@ -408,14 +421,27 @@ def configure(args, parser):
                     build_repo = default_repo
             else:
                 build_repo = input("What repo do you want to build the docs for (org/reponame, like 'drdoctr/doctr')? ")
+
             is_private = check_repo_exists(build_repo, service='github',
-    **login_kwargs)
+                                               **login_kwargs)['private']
             if is_private and not args.authenticate:
                 sys.exit(red("--no-authenticate is not supported for private repositories."))
 
-            is_private = check_repo_exists(build_repo, service='travis', ask=True) or is_private
+            headers = {}
+            travis_token = None
+            if is_private:
+                if args.token:
+                    GitHub_token = generate_GitHub_token(note="Doctr token for pushing to gh-pages from Travis (for {build_repo}).".format(build_repo=build_repo),
+                                                         scopes=["read:org", "user:email", "repo"], **login_kwargs)['token']
+                travis_token = get_travis_token(GitHub_token=GitHub_token, **login_kwargs)
+                headers['Authorization'] = "token {}".format(travis_token)
+
+            service = args.travis_tld if args.travis_tld else 'travis'
+            c = check_repo_exists(build_repo, service=service, ask=True, headers=headers)
+            tld = c['service'][-4:]
+            is_private = c['private'] or is_private
             if is_private and not args.authenticate:
-                sys.exit(red("--no-authenticate is not supported for travis-ci.com. See https://github.com/travis-ci/travis-ci/issues/9954."))
+                sys.exit(red("--no-authenticate is not supported for private repos."))
 
             get_build_repo = True
         except GitHubError:
@@ -444,9 +470,10 @@ def configure(args, parser):
     header = green("\n================== You should now do the following ==================\n")
 
     if args.token:
-        token = generate_GitHub_token(**login_kwargs)['token']
-        encrypted_variable = encrypt_variable("GH_TOKEN={token}".format(token=token).encode('utf-8'),
-            build_repo=build_repo, is_private=is_private, **login_kwargs)
+        if not GitHub_token:
+            GitHub_token = generate_GitHub_token(**login_kwargs)['token']
+        encrypted_variable = encrypt_variable("GH_TOKEN={GitHub_token}".format(GitHub_token=GitHub_token).encode('utf-8'),
+                                              build_repo=build_repo, tld=tld, travis_token=travis_token, **login_kwargs)
         print(dedent("""
         A personal access token for doctr has been created.
 
@@ -461,7 +488,7 @@ def configure(args, parser):
         del private_ssh_key # Prevent accidental use below
         public_ssh_key = public_ssh_key.decode('ASCII')
         encrypted_variable = encrypt_variable(env_name.encode('utf-8') + b"=" + key,
-            build_repo=build_repo, is_private=is_private, **login_kwargs)
+                                              build_repo=build_repo, tld=tld, travis_token=travis_token, **login_kwargs)
 
         deploy_keys_url = 'https://github.com/{deploy_repo}/settings/keys'.format(deploy_repo=deploy_key_repo)
 
@@ -484,7 +511,7 @@ def configure(args, parser):
                 {ssh_key}
                {BOLD_MAGENTA}Be sure to allow write access for the key.{RESET}
             """.format(ssh_key=public_ssh_key, deploy_keys_url=deploy_keys_url, N=N,
-                BOLD_MAGENTA=BOLD_MAGENTA, RESET=RESET)))
+                       BOLD_MAGENTA=BOLD_MAGENTA, RESET=RESET)))
 
 
         print(dedent("""\
@@ -499,12 +526,17 @@ def configure(args, parser):
     if deploy_repo != build_repo:
         options += ' --deploy-repo {deploy_repo}'.format(deploy_repo=deploy_repo)
 
+    key_type = "deploy key"
+    if args.token:
+        options += ' --token'
+        key_type = "personal access token"
+
     print(dedent("""\
     {N}. {BOLD_MAGENTA}Add these lines to your `.travis.yml` file:{RESET}
 
         env:
           global:
-            # Doctr deploy key for {deploy_repo}
+            # Doctr {key_type} for {deploy_repo}
             - secure: "{encrypted_variable}"
 
         script:
@@ -512,7 +544,7 @@ def configure(args, parser):
           - {BOLD_BLACK}<Command to build your docs>{RESET}
           - pip install doctr
           - doctr deploy {options} {BOLD_BLACK}<target-directory>{RESET}
-    """.format(options=options, N=N,
+    """.format(options=options, N=N, key_type=key_type,
         encrypted_variable=encrypted_variable.decode('utf-8'),
         deploy_repo=deploy_repo, BOLD_MAGENTA=BOLD_MAGENTA,
         BOLD_BLACK=BOLD_BLACK, RESET=RESET)))
diff --git a/doctr/common.py b/doctr/common.py
index 6babfc82..1e2d2104 100644
--- a/doctr/common.py
+++ b/doctr/common.py
@@ -31,3 +31,9 @@ def bold_magenta(text):
 BOLD_BLACK = "\033[1;30m"
 BOLD_MAGENTA = "\033[1;35m"
 RESET = "\033[0m"
+
+# Remove whitespace on inputs
+_input = input
+def input(prompt=None):
+    res = _input(prompt)
+    return res.strip()
diff --git a/doctr/local.py b/doctr/local.py
index a5b68bc9..2dcee2e7 100644
--- a/doctr/local.py
+++ b/doctr/local.py
@@ -20,10 +20,13 @@ from cryptography.hazmat.primitives.asymmetric import padding, rsa
 from cryptography.hazmat.backends import default_backend
 from cryptography.hazmat.primitives import serialization
 
+from .common import red, blue, green, input
 
-from .common import red, blue, green
+Travis_APIv2 = {'Accept': 'application/vnd.travis-ci.2.1+json'}
+Travis_APIv3 = {"Travis-API-Version": "3"}
 
-def encrypt_variable(variable, build_repo, *, public_key=None, is_private=False, **login_kwargs):
+def encrypt_variable(variable, build_repo, *, tld='.org', public_key=None,
+    travis_token=None, **login_kwargs):
     """
     Encrypt an environment variable for ``build_repo`` for Travis
 
@@ -32,13 +35,16 @@ def encrypt_variable(variable, build_repo, *, public_key=None, is_private=False,
     ``build_repo`` is the repo that ``doctr deploy`` will be run from. It
     should be like 'drdoctr/doctr'.
 
+    ``tld`` should be ``'.org'`` for travis-ci.org and ``'.com'`` for
+    travis-ci.com.
+
     ``public_key`` should be a pem format public key, obtained from Travis if
     not provided.
 
-    ``dotcom`` should be True if the service is travis-ci.com and False if it
-    is travis-ci.org. Not that travis-ci.com requires creating a temporary
-    authentication on GitHub, which is deleted automatically (regardless of
-    whether or not the repo is private).
+    If the repo is private, travis_token should be as returned by
+    ``get_temporary_token(**login_kwargs)``. A token being present
+    automatically implies ``tld='.com'``.
+
     """
     if not isinstance(variable, bytes):
         raise TypeError("variable should be bytes")
@@ -46,48 +52,30 @@ def encrypt_variable(variable, build_repo, *, public_key=None, is_private=False,
     if not b"=" in variable:
         raise ValueError("variable should be of the form 'VARIABLE=value'")
 
-    APIv2 = {'Accept': 'application/vnd.travis-ci.2+json'}
-    APIv3 = {"Travis-API-Version": "3"}
     if not public_key:
         _headers = {
             'Content-Type': 'application/json',
             'User-Agent': 'MyClient/1.0.0',
         }
-        headersv2 = {**_headers, **APIv2}
-        headersv3 = {**_headers, **APIv3}
-        token_id = None
-        try:
-            if is_private:
-                print(green("I need to generate a temporary token with GitHub to authenticate with Travis. You may get a warning email from GitHub about this."))
-                print(green("It will be deleted immediately. If you still see it after this at https://github.com/settings/tokens after please delete it manually."))
-                # /auth/github doesn't seem to exist in the Travis API v3.
-                tok_dict = generate_GitHub_token(scopes=["read:org", "user:email", "repo"],
-                                                 note="temporary token for doctr to auth against travis (delete me)",
-                                                 **login_kwargs)
-                data = {'github_token': tok_dict['token']}
-                token_id = tok_dict['id']
-                res = requests.post('https://api.travis-ci.com/auth/github', data=json.dumps(data), headers=headersv2)
-                res.raise_for_status()
-                headersv3['Authorization'] = 'token {}'.format(res.json()['access_token'])
-                res = requests.get('https://api.travis-ci.com/repo/{build_repo}/key_pair/generated'.format(build_repo=urllib.parse.quote(build_repo,
-                    safe='')), headers=headersv3)
-                if res.json().get('file') == 'not found':
-                    print(headersv3)
-                    raise RuntimeError("Could not find the Travis public key for %s" % build_repo)
-                public_key = res.json()['public_key']
-            else:
-                res = requests.get('https://api.travis-ci.org/repos/{build_repo}/key'.format(build_repo=build_repo), headers=headersv2)
-                public_key = res.json()['key']
+        headersv2 = {**_headers, **Travis_APIv2}
+        headersv3 = {**_headers, **Travis_APIv3}
+        if travis_token:
+            headersv3['Authorization'] = 'token {}'.format(travis_token)
+            res = requests.get('https://api.travis-ci.com/repo/{build_repo}/key_pair/generated'.format(build_repo=urllib.parse.quote(build_repo,
+                safe='')), headers=headersv3)
+            if res.json().get('file') == 'not found':
+                raise RuntimeError("Could not find the Travis public key for %s" % build_repo)
+            public_key = res.json()['public_key']
+        else:
+            res = requests.get('https://api.travis-ci{tld}/repos/{build_repo}/key'.format(build_repo=build_repo,
+                                                                                          tld=tld),
+                               headers=headersv2)
+            public_key = res.json()['key']
 
-            if res.status_code == requests.codes.not_found:
-                raise RuntimeError('Could not find requested repo on Travis.  Is Travis enabled?')
+        if res.status_code == requests.codes.not_found:
+            raise RuntimeError('Could not find requested repo on Travis.  Is Travis enabled?')
             res.raise_for_status()
 
-        finally:
-            # Remove temporary GH token
-            if is_private and token_id:
-                delete_GitHub_token(token_id, **login_kwargs)
-
     public_key = public_key.replace("RSA PUBLIC KEY", "PUBLIC KEY").encode('utf-8')
     key = serialization.load_pem_public_key(public_key, backend=default_backend())
 
@@ -236,6 +224,46 @@ def GitHub_post(data, url, *, auth, headers):
     return r.json()
 
 
+def get_travis_token(*, GitHub_token=None, **login_kwargs):
+    """
+    Generate a temporary token for authenticating with Travis
+
+    The GitHub token can be passed in to the ``GitHub_token`` keyword
+    argument. If no token is passed in, a GitHub token is generated
+    temporarily, and then immediately deleted.
+
+    This is needed to activate a private repo
+
+    Returns the secret token. It should be added to the headers like
+
+        headers['Authorization'] = "token {}".format(token)
+
+    """
+    _headers = {
+        'Content-Type': 'application/json',
+        'User-Agent': 'MyClient/1.0.0',
+    }
+    headersv2 = {**_headers, **Travis_APIv2}
+    token_id = None
+    try:
+        if not GitHub_token:
+            print(green("I need to generate a temporary token with GitHub to authenticate with Travis. You may get a warning email from GitHub about this."))
+            print(green("It will be deleted immediately. If you still see it after this at https://github.com/settings/tokens after please delete it manually."))
+            # /auth/github doesn't seem to exist in the Travis API v3.
+            tok_dict = generate_GitHub_token(scopes=["read:org", "user:email", "repo"],
+                                             note="temporary token for doctr to auth against travis (delete me)",
+                                             **login_kwargs)
+            GitHub_token = tok_dict['token']
+            token_id = tok_dict['id']
+
+        data = {'github_token': GitHub_token}
+        res = requests.post('https://api.travis-ci.com/auth/github', data=json.dumps(data), headers=headersv2)
+        return res.json()['access_token']
+    finally:
+        if token_id:
+            delete_GitHub_token(token_id, **login_kwargs)
+
+
 def generate_GitHub_token(*, note="Doctr token for pushing to gh-pages from Travis", scopes=None, **login_kwargs):
     """
     Generate a GitHub token for pushing from Travis
@@ -316,9 +344,12 @@ def check_repo_exists(deploy_repo, service='github', *, auth=None,
 
     Raises ``RuntimeError`` if the repo is not valid.
 
-    Returns whether or not the repo requires authorization to access. Private
-    repos require authorization, as to repos on travis-ci.com, regardless of
-    whether or not it is private.
+    Returns a dictionary with the following keys:
+
+    - 'private': Indicates whether or not the repo requires authorization to
+      access. Private repos require authorization.
+    - 'service': For service='travis', is 'travis-ci.com' or 'travis-ci.org',
+      depending on which should be used. Otherwise it is just equal to ``service``.
 
     For service='travis', if ask=True, it will ask at the command line if both
     travis-ci.org and travis-ci.com exist. If ask=False, service='travis' will
@@ -336,10 +367,10 @@ def check_repo_exists(deploy_repo, service='github', *, auth=None,
         REPO_URL = 'https://api.github.com/repos/{user}/{repo}'
     elif service == 'travis' or service == 'travis-ci.com':
         REPO_URL = 'https://api.travis-ci.com/repo/{user}%2F{repo}'
-        headers['Travis-API-Version'] = '3'
+        headers = {**headers, **Travis_APIv3}
     elif service == 'travis-ci.org':
         REPO_URL = 'https://api.travis-ci.org/repo/{user}%2F{repo}'
-        headers['Travis-API-Version'] = '3'
+        headers = {**headers, **Travis_APIv3}
     else:
         raise RuntimeError('Invalid service specified for repo check (should be one of {"github", "travis", "travis-ci.com", "travis-ci.org"}')
 
@@ -351,7 +382,7 @@ def check_repo_exists(deploy_repo, service='github', *, auth=None,
     def _try(url):
         r = requests.get(url, auth=auth, headers=headers)
 
-        if r.status_code == requests.codes.not_found:
+        if r.status_code in [requests.codes.not_found, requests.codes.forbidden]:
             return False
         if service == 'github':
             GitHub_raise_for_status(r)
@@ -361,18 +392,24 @@ def check_repo_exists(deploy_repo, service='github', *, auth=None,
 
     r = _try(REPO_URL.format(user=urllib.parse.quote(user),
         repo=urllib.parse.quote(repo)))
+    r_active = r and (service == 'github' or r.json().get('active', False))
 
     if service == 'travis':
         REPO_URL = 'https://api.travis-ci.org/repo/{user}%2F{repo}'
         r_org = _try(REPO_URL.format(user=urllib.parse.quote(user),
             repo=urllib.parse.quote(repo)))
-        if not r:
+        r_org_active = r_org and r_org.json().get('active', False)
+        if not r_active:
+            if not r_org_active:
+                raise RuntimeError('"{user}/{repo}" not found on travis-ci.org or travis-ci.com'.format(user=user, repo=repo))
             r = r_org
+            r_active = r_org_active
+            service = 'travis-ci.org'
         else:
-            if r and r_org:
+            if r_active and r_org_active:
                 if ask:
                     while True:
-                        print("{user}/{repo} appears to exist on both travis-ci.org and travis-ci.com.".format(user=user, repo=repo))
+                        print(green("{user}/{repo} appears to exist on both travis-ci.org and travis-ci.com.".format(user=user, repo=repo)))
                         preferred = input("Which do you want to use? [{default}/travis-ci.org] ".format(default=blue("travis-ci.com")))
                         preferred = preferred.lower().strip()
                         if preferred in ['o', 'org', '.org', 'travis-ci.org']:
@@ -386,12 +423,16 @@ def check_repo_exists(deploy_repo, service='github', *, auth=None,
                             print(red("Please type 'travis-ci.com' or 'travis-ci.org'."))
                 else:
                     service = 'travis-ci.com'
+            else:
+                # .com but not .org.
+                service = 'travis-ci.com'
 
-
-    if not r:
-        raise RuntimeError('"{user}/{repo}" not found on {service}'.format(user=user,
-                                                                           repo=repo,
-                                                                           service=service))
+    if not r_active:
+        msg = '' if auth else '. If the repo is private, then you need to authenticate.'
+        raise RuntimeError('"{user}/{repo}" not found on {service}{msg}'.format(user=user,
+                                                                                repo=repo,
+                                                                                service=service,
+                                                                                msg=msg))
 
     private = r.json().get('private', False)
 
@@ -401,9 +442,11 @@ def check_repo_exists(deploy_repo, service='github', *, auth=None,
             user=user, repo=repo)], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False)
         if p.stderr or p.returncode:
             raise RuntimeError('Wiki not found. Please create a wiki')
-        return False
 
-    return private or (service == 'travis-ci.com')
+    return {
+        'private': private,
+        'service': service,
+        }
 
 GIT_URL = re.compile(r'(?:git@|https://|git://)github\.com[:/](.*?)(?:\.git)?')
 


Test patch:
diff --git a/docs/tests.rst b/docs/tests.rst
index b2a3beda..1f482f0d 100644
--- a/docs/tests.rst
+++ b/docs/tests.rst
@@ -21,3 +21,49 @@ You can add the updated token to Travis on the `doctr Travis Settings Page
 Paste the token string into the ``Value`` field and ``TESTING_TOKEN`` in the
 ``Name`` field (unless you have changed this value in
 ``doctr/tests/test_local.py``).
+
+travis-ci.com cs. travis-ci.org
+-------------------------------
+
+Travis CI is `migrating
+<https://blog.travis-ci.com/2018-05-02-open-source-projects-on-travis-ci-com-with-github-apps>`_
+from .org to .com. While the migration is in place, it is possible to enable a
+repository on both. However, the same repository on each will have different
+public keys. Doctr presently only supports one at a time. On Travis itself,
+there is little difference in the doctr code, but there is a lot of code in
+``configure`` to automatically determine which is enabled.
+
+The repos:
+
+- https://github.com/drdoctr/testing-travis-ci-com
+- https://github.com/drdoctr/testing-travis-ci-org
+- https://github.com/drdoctr/testing-travis-ci-both
+- https://github.com/drdoctr/testing-travis-ci-neither
+
+Are enabled on Travis CI .com, .org, both, and neither. To enable a repo on
+.org, go to https://travis-ci.org/organizations/drdoctr/repositories and make
+sure it is checked. To enable a repo on .com, go to the `Travis CI Apps
+settings
+<https://github.com/organizations/drdoctr/settings/installations/272524>`_ on
+GitHub, and make sure "only selected repositories" is enabled with those repos
+that should be enabled.
+
+There are automated tests in the test suite that check the function that
+determines which of .org/.com it is enabled on, which test against these repos
+(``test_check_repo_exists_org_com``).
+
+Private Repositories
+--------------------
+
+Doctr also supports private repositories on GitHub. GitHub allows free private
+repositories, but they must be made on a user account, not the ``drdoctr``
+org.
+
+To build a private repo, you have to use travis-ci.com. The free plan only
+allows 100 builds, so you might have to make a new user to continue testing.
+Unless we get a paid plan, testing should only be done manually, when
+necessary.
+
+GitHub does not allow GitHub pages on private repositories on the free plan,
+but you can just manually verify that things are pushed to the ``gh-pages``
+branch.
diff --git a/doctr/tests/test_local.py b/doctr/tests/test_local.py
index 70ea9c94..97c9a0ed 100644
--- a/doctr/tests/test_local.py
+++ b/doctr/tests/test_local.py
@@ -27,8 +27,25 @@ def test_github_bad_repo():
 
 @pytest.mark.skipif(not TEST_TOKEN, reason="No API token present")
 def test_github_repo_exists():
-    assert not check_repo_exists('drdoctr/doctr', headers=HEADERS)
-    assert not check_repo_exists('drdoctr/doctr.wiki', headers=HEADERS)
+    assert check_repo_exists('drdoctr/doctr', headers=HEADERS) == {'private': False, 'service': 'github'}
+    assert check_repo_exists('drdoctr/doctr.wiki', headers=HEADERS) == {'private': False, 'service': 'github'}
+
+@pytest.mark.parametrize('service', ['travis', 'travis-ci.org', 'travis-ci.com'])
+@pytest.mark.parametrize('repo', ['com', 'org', 'both', 'neither'])
+def test_check_repo_exists_org_com(repo, service):
+    deploy_repo = 'drdoctr/testing-travis-ci-' + repo
+    if (repo == 'neither' or
+        repo == 'org' and service == 'travis-ci.com' or
+        repo == 'com' and service == 'travis-ci.org'):
+        with raises(RuntimeError):
+            check_repo_exists(deploy_repo, service)
+    elif (repo == 'org' or
+          repo == 'both' and service == 'travis-ci.org'):
+        assert check_repo_exists(deploy_repo, service) == {'private': False,
+                                                           'service': 'travis-ci.org'}
+    else:
+        assert check_repo_exists(deploy_repo, service) == {'private': False,
+                                                           'service': 'travis-ci.com'}
 
 @pytest.mark.skipif(not TEST_TOKEN, reason="No API token present")
 def test_github_invalid_repo():
@@ -48,13 +65,6 @@ def test_travis_bad_repo():
         # Travis is case-sensitive
         check_repo_exists('drdoctr/DoCtR', service='travis')
 
-# This test may need to be adjusted as travis-ci.org gets merged into
-# travis-ci.com. Currently drdoctr/doctr is enabled on both.
-def test_travis_repo_exists():
-    assert not check_repo_exists('drdoctr/doctr', service='travis-ci.org')
-    assert check_repo_exists('drdoctr/doctr', service='travis-ci.com')
-    assert check_repo_exists('drdoctr/doctr', service='travis')
-
 def test_GIT_URL():
     for url in [
         'https://github.com/drdoctr/doctr.git',