core: run ruff format

This commit is contained in:
RhodeCode Admin 2025-01-13 17:47:37 +01:00
parent 7130effb58
commit 166db21812
821 changed files with 82905 additions and 84121 deletions

View file

@ -21,13 +21,11 @@ import pytest
from rhodecode.model.meta import Session
from rhodecode.model.pull_request import PullRequestModel
from rhodecode.api.tests.utils import (
build_data, api_call, assert_error)
from rhodecode.api.tests.utils import build_data, api_call, assert_error
@pytest.mark.usefixtures("testuser_api", "app")
class TestGetPullRequest(object):
@pytest.mark.backends("git", "hg")
def test_api_get_pull_requests(self, pr_util):
pull_request = pr_util.create_pull_request()
@ -44,37 +42,32 @@ class TestGetPullRequest(object):
description=pull_request.description,
)
Session().commit()
id_, params = build_data(
self.apikey, 'get_pull_requests',
repoid=pull_request.target_repo.repo_name)
id_, params = build_data(self.apikey, "get_pull_requests", repoid=pull_request.target_repo.repo_name)
response = api_call(self.app, params)
assert response.status == '200 OK'
assert len(response.json['result']) == 2
assert response.status == "200 OK"
assert len(response.json["result"]) == 2
PullRequestModel().close_pull_request(
pull_request_2, pull_request_2.author)
PullRequestModel().close_pull_request(pull_request_2, pull_request_2.author)
Session().commit()
id_, params = build_data(
self.apikey, 'get_pull_requests',
repoid=pull_request.target_repo.repo_name,
status='new')
self.apikey, "get_pull_requests", repoid=pull_request.target_repo.repo_name, status="new"
)
response = api_call(self.app, params)
assert response.status == '200 OK'
assert len(response.json['result']) == 1
assert response.status == "200 OK"
assert len(response.json["result"]) == 1
id_, params = build_data(
self.apikey, 'get_pull_requests',
repoid=pull_request.target_repo.repo_name,
status='closed')
self.apikey, "get_pull_requests", repoid=pull_request.target_repo.repo_name, status="closed"
)
response = api_call(self.app, params)
assert response.status == '200 OK'
assert len(response.json['result']) == 1
assert response.status == "200 OK"
assert len(response.json["result"]) == 1
@pytest.mark.backends("git", "hg")
def test_api_get_pull_requests_repo_error(self):
id_, params = build_data(self.apikey, 'get_pull_requests', repoid=666)
id_, params = build_data(self.apikey, "get_pull_requests", repoid=666)
response = api_call(self.app, params)
expected = 'repository `666` does not exist'
expected = "repository `666` does not exist"
assert_error(id_, expected, given=response.body)