コード例 #1
0
 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)}")
コード例 #2
0
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"
コード例 #3
0
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"
コード例 #4
0
ファイル: base_recipe.py プロジェクト: onophris/grayskull
 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)