feature: simplify code

This commit is contained in:
ievgenii vdovenko 2025-11-07 11:54:20 +01:00
parent 746c5b4699
commit c4db0d33e5
5 changed files with 43 additions and 71 deletions

View file

@ -127,9 +127,8 @@ class TestAdminRepoSettingsAdvanced(object):
user: User = User.get_by_username(TEST_USER_REGULAR_LOGIN)
user.update_quotas(
max_disk_space_mb_allowance=200,
max_repository_count_allowance=2,
current_repos_count=1,
max_disk_space_mb_allowance=100,
max_repository_count_allowance=1,
used_disk_space_bytes=0,
)
@ -151,7 +150,8 @@ class TestAdminRepoSettingsAdvanced(object):
# check if repo was deleted from db
assert RepoModel().get_by_repo_name(repo_name) is None
assert not repo_on_filesystem(repo_name_str)
assert user.get_quotas()["current_repos_count"] == 0
user_repos = Repository.get_all_repos(user.user_id)
assert len(user_repos) == 0
@pytest.mark.parametrize("suffix", ["", "ąęł", "123"], ids=no_newline_id_generator)
def test_delete_broken_repo(self, autologin_user, backend, suffix, csrf_token):

View file

@ -158,9 +158,6 @@ class RepoSettingsAdvancedView(RepoAppView):
self.request.POST.get("backup", "false")
) # if this option is absent, this means that on FE side checkbox was unchecked
delete_res = RepoModel().delete(self.db_repo, fs_backup=backup)
repo_owner = self.db_repo.user
quota_model = UserQuotaModel(repo_owner)
quota_model.decrement_repo_count()
fork_action = delete_res.fork_action_result.action
fork_cnt = delete_res.fork_action_result.fork_count