Skip to content

Test failure: TestUtils.test_get_branch_name[paths0-directory1_directory2_directory3_directory4_directory5] #96

Description

@jhanarato

Test failure 2/3:

__________________________________________________________________________________________________________________________________________ TestUtils.test_get_branch_name[paths0-directory1_directory2_directory3_directory4_directory5] ___________________________________________________________________________________________________________________________________________

self = <app.tests.services.git.test_utils.TestUtils object at 0x72a316a12e40>, paths = [PosixPath('directory1/directory2/directory3/directory4/directory5/directory5a/file1.json'), PosixPath('directory1/directory2/directory3/directory4/directory5/directory5a/file2.json')], expected_output = 'directory1_directory2_directory3_directory4_directory5'
git_manager = <app.services.git.manager.GitManager object at 0x72a31566a540>

    @pytest.mark.parametrize(
        "paths, expected_output",
        [
            (
                [
                    Path("directory1/directory2/directory3/directory4/directory5/directory5a/file1.json"),
                    Path("directory1/directory2/directory3/directory4/directory5/directory5a/file2.json"),
                ],
                "directory1_directory2_directory3_directory4_directory5",
            ),
            (
                [Path("directory1/directory2/directory3/directory4/directory5/file1.json")],
                "directory1_directory2_directory3_directory4_directory5_file1",
            ),
            (
                [],
                None,
            ),
        ],
    )
    def test_get_branch_name(self, paths, expected_output, git_manager):
        if not paths:
            with pytest.raises(ValueError, match="No file paths provided."):
                utils.get_branch_name(git_manager, paths)
        else:
>           assert utils.get_branch_name(git_manager, paths) == expected_output

app/tests/services/git/test_utils.py:137: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
app/services/git/utils.py:33: in get_branch_name
    project_pr = manager.get_pr(project_head)
app/services/git/manager.py:157: in get_pr
    if (prs := self.get_prs(head, state)) and prs.totalCount > 0:
app/services/git/manager.py:152: in get_prs
    return self.github.get_repo(settings.GITHUB_REPO).get_pulls(
/usr/local/lib/python3.12/site-packages/github/MainClass.py:363: in get_repo
    headers, data = self.__requester.requestJsonAndCheck("GET", url)
/usr/local/lib/python3.12/site-packages/github/Requester.py:442: in requestJsonAndCheck
    return self.__check(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <github.Requester.Requester object at 0x72a315668ce0>, status = 401, responseHeaders = {'access-control-allow-origin': '*', 'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP...X-GitHub-Request-Id, Deprecation, Sunset', 'connection': 'close', 'content-security-policy': "default-src 'none'", ...}
output = '{\r\n  "message": "Bad credentials",\r\n  "documentation_url": "https://docs.github.com/rest",\r\n  "status": "401"\r\n}'

    def __check(
        self,
        status: int,
        responseHeaders: Dict[str, Any],
        output: str,
    ) -> Tuple[Dict[str, Any], Any]:
        data = self.__structuredFromJson(output)
        if status >= 400:
>           raise self.__createException(status, responseHeaders, data)
E           github.GithubException.BadCredentialsException: 401 {"message": "Bad credentials", "documentation_url": "https://docs.github.com/rest", "status": "401"}

/usr/local/lib/python3.12/site-packages/github/Requester.py:487: BadCredentialsException

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions