Repository: repobee/repobee

Issue:
Remove REPOBEE_OAUTH environment variable
It has been deprecated for a long time now, since it was replaced with `REPOBEE_TOKEN`

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/repobee/repobee/pull/457?src=pr&el=h1) Report
> Merging [#457](https://codecov.io/gh/repobee/repobee/pull/457?src=pr&el=desc) into [master](https://codecov.io/gh/repobee/repobee/commit/74d7e576978e03e43e3ae0c3639f299a61e8e507&el=desc) will **decrease** coverage by `4.25%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/repobee/repobee/pull/457/graphs/tree.svg?width=650&height=150&src=pr&token=5vOKgkphZe)](https://codecov.io/gh/repobee/repobee/pull/457?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master     #457      +/-   ##
==========================================
- Coverage   92.82%   88.56%   -4.26%     
==========================================
  Files          40       40              
  Lines        2173     2151      -22     
  Branches      372      370       -2     
==========================================
- Hits         2017     1905     -112     
- Misses        124      212      +88     
- Partials       32       34       +2     
```


| [Impacted Files](https://codecov.io/gh/repobee/repobee/pull/457?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/\_repobee/constants.py](https://codecov.io/gh/repobee/repobee/pull/457/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2NvbnN0YW50cy5weQ==) | `100.00% <ø> (ø)` | |
| [src/\_repobee/config.py](https://codecov.io/gh/repobee/repobee/pull/457/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2NvbmZpZy5weQ==) | `98.38% <100.00%> (-0.15%)` | :arrow_down: |
| [src/\_repobee/ext/gitlab.py](https://codecov.io/gh/repobee/repobee/pull/457/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2V4dC9naXRsYWIucHk=) | `63.86% <0.00%> (-28.56%)` | :arrow_down: |
| [src/\_repobee/git.py](https://codecov.io/gh/repobee/repobee/pull/457/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2dpdC5weQ==) | `96.62% <0.00%> (-3.38%)` | :arrow_down: |
| [src/\_repobee/command/repos.py](https://codecov.io/gh/repobee/repobee/pull/457/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2NvbW1hbmQvcmVwb3MucHk=) | `92.62% <0.00%> (-2.46%)` | :arrow_down: |
| [src/\_repobee/plugin.py](https://codecov.io/gh/repobee/repobee/pull/457/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL3BsdWdpbi5weQ==) | `93.07% <0.00%> (-2.35%)` | :arrow_down: |
| [src/\_repobee/cli/mainparser.py](https://codecov.io/gh/repobee/repobee/pull/457/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2NsaS9tYWlucGFyc2VyLnB5) | `94.64% <0.00%> (-1.79%)` | :arrow_down: |
| [src/\_repobee/ext/query.py](https://codecov.io/gh/repobee/repobee/pull/457/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2V4dC9xdWVyeS5weQ==) | `48.48% <0.00%> (-1.52%)` | :arrow_down: |
| [src/\_repobee/cli/parsing.py](https://codecov.io/gh/repobee/repobee/pull/457/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2NsaS9wYXJzaW5nLnB5) | `92.26% <0.00%> (-1.20%)` | :arrow_down: |
| [src/\_repobee/ext/defaults/github.py](https://codecov.io/gh/repobee/repobee/pull/457/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2V4dC9kZWZhdWx0cy9naXRodWIucHk=) | `90.29% <0.00%> (-0.11%)` | :arrow_down: |
| ... and [5 more](https://codecov.io/gh/repobee/repobee/pull/457/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/repobee/repobee/pull/457?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/repobee/repobee/pull/457?src=pr&el=footer). Last update [74d7e57...e38679b](https://codecov.io/gh/repobee/repobee/pull/457?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

slarse: Coverage decrease is fine, this PR only removes code.

Patch:
diff --git a/src/_repobee/config.py b/src/_repobee/config.py
index 1a1b194..59aabe2 100644
--- a/src/_repobee/config.py
+++ b/src/_repobee/config.py
@@ -11,7 +11,7 @@ Contains the code required for pre-configuring user interfaces.
 import os
 import pathlib
 import configparser
-from typing import Union, List, Mapping, Optional
+from typing import Union, List, Mapping
 
 import daiquiri
 import repobee_plug as plug
@@ -137,21 +137,8 @@ def get_all_tasks() -> List[plug.Task]:
     return plug.manager.hook.setup_task() + plug.manager.hook.clone_task()
 
 
-def _fetch_token() -> Optional[str]:
-    token = os.getenv(constants.TOKEN_ENV)
-    token_from_old = os.getenv(constants.TOKEN_ENV_OLD)
-    if token_from_old:
-        LOGGER.warning(
-            "The {} environment variable has been deprecated, "
-            "use {} instead".format(
-                constants.TOKEN_ENV_OLD, constants.TOKEN_ENV
-            )
-        )
-    return token or token_from_old
-
-
 def _read_defaults(config_file: pathlib.Path) -> dict:
-    token = _fetch_token()
+    token = os.getenv(constants.TOKEN_ENV)
     if not config_file.is_file():
         return {} if not token else dict(token=token)
     defaults = dict(_read_config(config_file)[constants.DEFAULTS_SECTION_HDR])
diff --git a/src/_repobee/constants.py b/src/_repobee/constants.py
index 5a55a27..a174027 100644
--- a/src/_repobee/constants.py
+++ b/src/_repobee/constants.py
@@ -39,4 +39,3 @@ ORDERED_CONFIGURABLE_ARGS = (
 CONFIGURABLE_ARGS = set(ORDERED_CONFIGURABLE_ARGS)
 
 TOKEN_ENV = "REPOBEE_TOKEN"
-TOKEN_ENV_OLD = "REPOBEE_OAUTH"


Test patch:
diff --git a/tests/unit_tests/repobee/conftest.py b/tests/unit_tests/repobee/conftest.py
index 8d004ed..5b8d481 100644
--- a/tests/unit_tests/repobee/conftest.py
+++ b/tests/unit_tests/repobee/conftest.py
@@ -21,7 +21,6 @@ import _repobee  # noqa: E402
 
 EXPECTED_ENV_VARIABLES = [
     _repobee.constants.TOKEN_ENV,
-    _repobee.constants.TOKEN_ENV_OLD,
     "REPOBEE_NO_VERIFY_SSL",
 ]
 
diff --git a/tests/unit_tests/repobee/test_config.py b/tests/unit_tests/repobee/test_config.py
index 7466b82..7e88fa5 100644
--- a/tests/unit_tests/repobee/test_config.py
+++ b/tests/unit_tests/repobee/test_config.py
@@ -55,23 +55,6 @@ class TestGetConfiguredDefaults:
         defaults = config.get_configured_defaults(str(config_mock))
         assert defaults["token"] == constants.TOKEN
 
-    @pytest.mark.skipif(
-        "_repobee.__version__ >= '3.0.0'",
-        msg="Old token should have been removed",
-    )
-    def test_deprecated_token_env(self, config_mock, mock_getenv):
-        token = "superdupertoken"
-
-        def _env(name):
-            if name == _repobee.constants.TOKEN_ENV_OLD:
-                return token
-            return None
-
-        mock_getenv.side_effect = _env
-
-        defaults = config.get_configured_defaults(str(config_mock))
-        assert defaults["token"] == token
-
     def test_get_configured_defaults_raises_on_invalid_keys(
         self, empty_config_mock, students_file
     ):