Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: add base64 encode and decode functions for in-toto attestation payload#587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
nathanwn wants to merge2 commits intostaging
base:staging
Choose a base branch
Loading
fromnathanwn/base64-encoder-decoder
Draft
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
chore: fix unit tests that assume initial branch is alwaysmaster
  • Loading branch information
@nathanwn
nathanwn committedJan 3, 2024
commitcab02e08435c3e54039ac64660eb934ed6a88ff2
1 change: 0 additions & 1 deletionsrc/macaron/intoto/encoder_decoder.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,6 @@
import json

from macaron.intoto.errors import DecodeIntotoAttestationError
from macaron.util import JsonType


def encode_payload(payload: dict) -> str:
Expand Down
9 changes: 7 additions & 2 deletionstests/repo_finder/test_commit_finder.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023 -2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2023 -2024, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.

"""This module tests the commit finder."""
Expand DownExpand Up@@ -91,7 +91,12 @@ def test_commit_finder() -> None:
"""Test commit finder using mocked repository."""
if os.path.exists(REPO_DIR):
shutil.rmtree(REPO_DIR)
git_obj = initiate_repo(REPO_DIR)
git_obj = initiate_repo(
REPO_DIR,
git_init_options={
"initial_branch": "master",
},
)

# Create a commit from a newly created file.
with open(os.path.join(REPO_DIR, "file_1"), "w", encoding="utf-8") as file:
Expand Down
8 changes: 5 additions & 3 deletionstests/slsa_analyzer/mock_git_utils.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022 -2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2022 -2024, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.

"""
Expand All@@ -15,7 +15,7 @@
from macaron.slsa_analyzer.analyze_context import AnalyzeContext


def initiate_repo(repo_path: str | os.PathLike) -> Git:
def initiate_repo(repo_path: str | os.PathLike, git_init_options: dict | None = None) -> Git:
"""Init the repo at `repo_path` and return a Git wrapper of that repository.

This function will create the directory `repo_path` if it does not exist.
Expand All@@ -30,6 +30,8 @@ def initiate_repo(repo_path: str | os.PathLike) -> Git:
Git
The wrapper of the Git repository.
"""
git_init_options = git_init_options or {}

if not os.path.isdir(repo_path):
os.makedirs(repo_path)

Expand All@@ -38,7 +40,7 @@ def initiate_repo(repo_path: str | os.PathLike) -> Git:
return git_wrapper
except GitError:
# No git repo at repo_path
git.Repo.init(repo_path)
git.Repo.init(repo_path, **git_init_options)
return Git(repo_path)


Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp