Skip to content
Merged
Changes from all commits
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
22 changes: 22 additions & 0 deletions tests/test_bitbucket_cloud_oo.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ def test_not_exists_project(self):
def test_exists_repository(self):
assert CLOUD.workspaces.get("TestWorkspace1").repositories.exists("testrepository1"), "Exists repository"

def test_repository_commits_each_uses_paged_commit_data(self, monkeypatch):
repository = CLOUD.workspaces.get("TestWorkspace1").repositories.get("testrepository1")
commits = repository.commits
commit_data = {
"type": "commit",
"hash": "1fbd047cd99a",
"message": "src created online with Bitbucket",
}

monkeypatch.setattr(commits, "_get_paged", lambda *args, **kwargs: iter([commit_data]))

def fail_get(*args, **kwargs):
raise AssertionError("repository commits should not be fetched again by hash")

monkeypatch.setattr("atlassian.bitbucket.base.BitbucketBase.get", fail_get)

commit = list(commits.each())[0]

assert isinstance(commit, Commit)
assert commit.hash == "1fbd047cd99a"
assert commit.message == "src created online with Bitbucket"

def test_not_exists_repository(self):
assert not CLOUD.workspaces.get("TestWorkspace1").repositories.exists(
"testrepository1xxx"
Expand Down
Loading