def _add_extra_section(self, maintainers: Optional[List] = None): if not self["extra"]: maintainers = maintainers if maintainers else [ get_git_current_user() ] self["extra"]["recipe-maintainers"].add_items(maintainers) prefix = f"\n - {Fore.LIGHTMAGENTA_EX}" print_msg(f"Maintainers:{prefix}{prefix.join(maintainers)}")
def test_get_git_current_user(monkeypatch): monkeypatch.setattr( grayskull.base.extra, "get_git_current_user_metadata", lambda: { "items": [{ "login": "******" }], "total_count": 1 }, ) assert get_git_current_user() == "marcelotrevisani" def _fake_exception(): raise Exception("fake exception") monkeypatch.setattr(grayskull.base.extra, "get_git_current_user_metadata", _fake_exception) assert get_git_current_user() == "AddYourGitHubIdHere"
def test_get_git_current_with_multiple_users(monkeypatch): monkeypatch.setattr( grayskull.base.extra, "get_git_current_user_metadata", lambda: { "items": [{ "login": "******" }, { "login": "******" }], "total_count": 2 }, ) assert get_git_current_user() == "user1"
def _add_extra_section(self, maintainers: Optional[List] = None): if not self["extra"]: maintainers = maintainers if maintainers else [ get_git_current_user() ] self["extra"]["recipe-maintainers"].add_items(maintainers)