Repository: repobee/repobee

Issue:
command module calls get_repo_urls with students kwarg
Will obviously crash, fix ASAP!

Discussion:
codecov-io: # [Codecov](https://codecov.io/gh/repobee/repobee/pull/225?src=pr&el=h1) Report
> Merging [#225](https://codecov.io/gh/repobee/repobee/pull/225?src=pr&el=desc) into [master](https://codecov.io/gh/repobee/repobee/commit/6d643bd78e9f3be1b0e28e135400bb01f09e9e89?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

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

```diff
@@           Coverage Diff           @@
##           master     #225   +/-   ##
=======================================
  Coverage   91.38%   91.38%           
=======================================
  Files          19       19           
  Lines        1312     1312           
  Branches      237      237           
=======================================
  Hits         1199     1199           
  Misses         93       93           
  Partials       20       20
```


| [Impacted Files](https://codecov.io/gh/repobee/repobee/pull/225?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [repobee/command.py](https://codecov.io/gh/repobee/repobee/pull/225/diff?src=pr&el=tree#diff-cmVwb2JlZS9jb21tYW5kLnB5) | `95.23% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/repobee/repobee/pull/225?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/225?src=pr&el=footer). Last update [6d643bd...f462b16](https://codecov.io/gh/repobee/repobee/pull/225?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/repobee/command.py b/repobee/command.py
index e6e5d15..4a8e0ae 100644
--- a/repobee/command.py
+++ b/repobee/command.py
@@ -165,7 +165,7 @@ def update_student_repos(
 
     master_repo_names = [util.repo_name(url) for url in urls]
 
-    repo_urls = api.get_repo_urls(master_repo_names, students=teams)
+    repo_urls = api.get_repo_urls(master_repo_names, teams=teams)
 
     with tempfile.TemporaryDirectory() as tmpdir:
         LOGGER.info("cloning into master repos ...")
@@ -354,7 +354,7 @@ def clone_repos(
         teams: Team objects specifying student groups.
         api: A GitHubAPI instance.
     """
-    repo_urls = api.get_repo_urls(master_repo_names, students=teams)
+    repo_urls = api.get_repo_urls(master_repo_names, teams=teams)
 
     LOGGER.info("cloning into student repos ...")
     git.clone(repo_urls)


Test patch:
diff --git a/tests/test_command.py b/tests/test_command.py
index cf0df02..4f657e3 100644
--- a/tests/test_command.py
+++ b/tests/test_command.py
@@ -1,7 +1,9 @@
 import os
-import pytest
+from functools import partial
 from unittest.mock import patch, MagicMock, call, ANY, PropertyMock
 
+import pytest
+
 import repobee
 from repobee import command
 from repobee import git
@@ -78,17 +80,20 @@ def generate_repo_url(name):
     return generate_team_repo_url(name, "d")[:-2]
 
 
-def get_repo_urls_fake(master_repo_names, org_name=None, students=None):
+def get_repo_urls_fake(self, master_repo_names, org_name=None, teams=None):
     return list(
         map(
             generate_repo_url,
             master_repo_names
-            if not students
-            else util.generate_repo_names(students, master_repo_names),
+            if not teams
+            else util.generate_repo_names(teams, master_repo_names),
         )
     )
 
 
+# check that get_repo_urls_fake conforms to APISpec.get_repo_urls
+apimeta.check_signature(apimeta.APISpec.get_repo_urls, get_repo_urls_fake)
+
 MASTER_NAMES = ("week-1", "week-2", "week-3")
 MASTER_URLS = tuple(generate_repo_url(name) for name in MASTER_NAMES)
 
@@ -144,7 +149,9 @@ def api_mock(request, mocker):
     api_class = mocker.patch("repobee.command.GitHubAPI", autospec=True)
     api_class.return_value = mock
 
-    mock.get_repo_urls.side_effect = get_repo_urls_fake
+    mock.get_repo_urls.side_effect = partial(
+        get_repo_urls_fake, None  # pass None for self arg
+    )
     mock.create_repos.side_effect = lambda repo_infos: list(
         map(url_from_repo_info, repo_infos)
     )
@@ -367,7 +374,10 @@ class TestUpdateStudentRepos:
             fail_students, [master_name]
         )
         fail_repo_urls = get_repo_urls_fake(
-            [master_name], students=fail_students
+            # passing None for self is fine here
+            None,
+            [master_name],
+            teams=fail_students,
         )
 
         async def raise_specific(pt):