aboutsummaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix incorrect TagName/BranchName usages (#33279)wxiaoguang2025-01-151-9/+17
| | | Add add a new test
* Refactor ref type (#33242)Lunny Xiao2025-01-141-0/+25
| | | | | | | | | | | | Major changes: 1. do not sync ".keep" file during tests 2. fix incorrect route handler and empty repo handling (backported as #33253 with tests) 3. do not use `RepoRef`: most of the calls are abuses. 4. Use `git.RefType` instead of a new type definition `RepoRefType` on `context`. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix 500 error when error occurred in migration page (#33256)yp053272025-01-141-1/+5
| | | | | | | | | | The template should be `repo/migrate/{service type}` But input element `service` is not in the form. Related: #33081 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Validate that the tag doesn't exist when creating a tag via the web (#33241)Kemal Zebari2025-01-141-1/+1
| | | | | | | | | | | | | | | | Found while investigating #33210. This line no longer makes sense because the form field "TagName" is required, so this would mean that this code path would never be covered. Because it isn't covered, we end up going down the "update release" logic where we eventually set `Release.IsTag` to false (meaning it will now be treated as a release instead of a tag). This snapshot rewrites the condition to ensure that we aren't trying to create a tag that already exists. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor context RefName and RepoAssignment (#33226)wxiaoguang2025-01-131-1/+3
| | | | | | | The `ctx.Repo.RefName` was used to be a "short name", it causes a lot of ambiguity. This PR does some refactoring and use `RefFullName` to replace the legacy `RefName`, and simplify RepoAssignment
* Fix sync fork for consistency (#33147)Chai-Shi2025-01-101-0/+122
| | | | | | | | | Fixes #33145 An integration test could be added. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix raw file API ref handling (#33172)wxiaoguang2025-01-101-24/+34
| | | Fix #33164 and add more tests
* Automerge supports deleting branch automatically after merging (#32343)Lunny Xiao2025-01-102-7/+9
| | | | | | | | | | | | Resolve #32341 ~Depends on #27151~ - [x] It will display a checkbox of deleting the head branch on the pull request view page when starting an auto-merge task. - [x] Add permission check before deleting the branch - [x] Add delete branch comment for those closing pull requests because of head branch or base branch was deleted. - [x] Merge `RetargetChildrenOnMerge` and `AddDeletePRBranchComment` into `service.DeleteBranch`.
* Fix fuzz test (#33156)Lunny Xiao2025-01-091-0/+2
|
* Refactor older tests to use testify (#33140)TheFox0x72025-01-095-58/+36
| | | | | Refactor checks to use assert/require Use require.Eventually for waiting in elastic and meilisearch tests Use require to exit early instead of assert
* Update status check for all supported on.pull_request.types in Gitea (#33117)yp053272025-01-081-22/+222
| | | | | | | | | | | | | | | | | | | | | | | Thanks @Zettat123 Follow #33116 Fix #33051 on.pull_request.types doc: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request on.pull_request.types added in this PR: ``` assigned, unassigned, review_requested, review_request_removed, milestoned, demilestoned, labeled, unlabeled ``` unsupported types in Gitea: ``` // Unsupported activity types: // converted_to_draft, ready_for_review, locked, unlocked, auto_merge_enabled, auto_merge_disabled, enqueued, dequeued ``` TODO: - [x] add test
* Make git clone URL could use current signed-in user (#33091)wxiaoguang2025-01-071-2/+2
| | | | | | | | | | | | | | close #33086 * Add a special value for "SSH_USER" setting: `(DOER_USERNAME)` * Improve parseRepositoryURL and add tests (now it doesn't have hard dependency on some setting values) Many changes are just adding "ctx" and "doer" argument to functions. By the way, improve app.example.ini, remove all `%(key)s` syntax, it only makes messy and no user really cares about it. Document: https://gitea.com/gitea/docs/pulls/138
* Refactor package (routes and error handling, npm peer dependency) (#33111)wxiaoguang2025-01-061-18/+29
|
* Fix repo empty guide (#33114)wxiaoguang2025-01-061-1/+5
|
* Use `Project-URL` metadata field to get a PyPI package's homepage URL (#33089)Kemal Zebari2025-01-031-6/+63
| | | Resolves #33085.
* Refactor env var related code (#33075)wxiaoguang2025-01-022-19/+0
| | | And add more comments
* Refactor pull-request compare&create page (#33071)wxiaoguang2025-01-021-2/+2
| | | The old code is unnecessarily complex.
* Remove some unnecessary template helpers (#33069)wxiaoguang2025-01-016-175/+175
| | | | DisableGitHooks and DisableImportLocal are only used when editing a user, so only set them in `editUserCommon`
* Refactor maven package registry (#33049)wxiaoguang2024-12-311-38/+70
| | | Close #33036
* [Feature] Private README.md for organization (#32872)Chai-Shi2024-12-311-0/+132
| | | | | | | | Implemented #29503 --------- Co-authored-by: Ben Chang <ben_chang@htc.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix templating in pull request comparison (#33025)TheFox0x72024-12-291-0/+68
| | | | | Adds test for expected behavior Closes: https://github.com/go-gitea/gitea/issues/33013
* Refactor tests (#33021)wxiaoguang2024-12-293-6/+8
| | | | | | | | | | | | | | | | 1. fix incorrect tests, for example: BeanExists doesn't do assert and shouldn't be used 2. remove unnecessary test functions 3. introduce DumpQueryResult to help to see the database rows during test (at least I need it) ``` ====== DumpQueryResult: SELECT * FROM action_runner_token ====== - # row[0] id: 1 token: xeiWBL5kuTYxGPynHCqQdoeYmJAeG3IzGXCYTrDX owner_id: 0 ... ```
* De-emphasize signed commits (#31160)Blender Defender2024-12-281-6/+6
| | | | | | | | | | The new code structure is easier to make more improvements or refactor, for example: change the colors to de-emphasize more, or design some new layouts. --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix Agit pull request permission check (#32999)a10121127962024-12-271-0/+19
| | | | | | | | | | | user with read permission should also can create agit flow pull request. looks this logic was broken in https://github.com/go-gitea/gitea/pull/31033 this pull request try fix it and add test code. --------- Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Support for email addresses containing uppercase characters when activating ↵Zettat1232024-12-272-10/+17
| | | | | | | | | user account (#32998) Fix #32807 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improve Actions test (#32883)Zettat1232024-12-263-0/+726
| | | This PR adds a mock runner to test more actions features.
* Support org labels when adding labels by label names (#32988)Zettat1232024-12-261-9/+15
| | | Fix #32891
* Clarify path param naming (#32969)wxiaoguang2024-12-241-7/+7
| | | | | | | | | In history (from some legacy frameworks), both `:name` and `name` are supported as path path name, `:name` is an alias to `name`. To make code consistent, now we should only use `name` but not `:name`. Also added panic check in related functions to make sure the name won't be abused in case some downstreams still use them.
* Add sub issue list support (#32940)wxiaoguang2024-12-241-1/+1
| | | Just like GitHub, show issue icon/title when the issue number is in a list
* Refactor template & test related code (#32938)wxiaoguang2024-12-222-13/+6
| | | Move some legacy code from "base" package to proper packages.
* Move some errors to their own sub packages (#32880)Lunny Xiao2024-12-203-17/+14
|
* Move RepoTransfer from models to models/repo sub package (#32506)Lunny Xiao2024-12-181-2/+1
| | | | | | | | | | | | | `RepoTransfer` now is at models, but if we want to move it into `repo` model, it will depend on `Team`. So this PR also makes repo model depend on org model to make it possible. Just refactor, no code change. - [x] Move `DeleteOrganization` from `models/organization` to service layer - [x] Move `AccessibleTeamReposEnv` to `models/repo` - [x] Move `RepoTransfer` from `models` to `models/repo` - [x] Merge `getUserTeamIDs` and `GetUserTeamIDs`, Merge `GetUserTeams` and `getUserTeams`. - [x] Remove `Team`'s `Repos []*repo_model.Repository` to avoid dependency recycle.
* Refactor some LDAP code (#32849)wxiaoguang2024-12-151-139/+217
|
* Enable tenv and testifylint rules (#32852)TheFox0x72024-12-1533-79/+75
| | | | Enables tenv and testifylint linters closes: https://github.com/go-gitea/gitea/issues/32842
* Avoid MacOS keychain dialog in integration tests (#32813)Rowan Bohde2024-12-121-0/+5
| | | | | | | | | | | | | | | | Mac's git installation ships with a system wide config that configures the credential helper `osxkeychain`, which will prompt the user with a dialog. ``` $ git config list --system credential.helper=osxkeychain ``` By setting the environment variable [`GIT_CONFIG_NOSYSTEM=true`](https://git-scm.com/docs/git-config#ENVIRONMENT), Git will not load the system wide config, preventing the dialog from populating. Closes #26717
* Make API "compare" accept commit IDs (#32801)wxiaoguang2024-12-122-9/+21
|
* Implement update branch API (#32433)Kemal Zebari2024-12-121-0/+32
| | | | | | | | | | Resolves #22526. Builds upon #23061. --------- Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add standard-compliant route to serve outdated R packages (#32783)Sebastian T. T.2024-12-111-0/+8
| | | | | | | | | | | | | The R package repository currently does not have support for older versions of packages which should be stored in a separate /Archive router. This PR remedies that by adding a new path router. I am a member of a group that loves using Gitea and this bug has been annoying us for a long time. Hope it can be merged in time for Gitea 1.23.0. Any feedback much appreciated. Fixes #32782
* Fix repo home file list (#32788)wxiaoguang2024-12-111-3/+3
| | | | | | | 1. use grid instead of table, completely drop "ui table" from that list 2. move some "commit sign" related styles into a new file by the way (no change) because I need to figure out where `#repo-files-table` is used. 3. move legacy "branch/tag selector" related code into repo-legacy.ts, now there are 13 `import $` files left.
* Rearrange Clone Panel (#31142)Blender Defender2024-12-111-4/+4
| | | | | | | | | | | | | Rearrange the clone panel to use less horizontal space. The following changes have been made to achieve this: - Moved everything into the dropdown menu - Moved the HTTPS/SSH Switch to a separate line - Moved the "Clone in VS Code"-Button up and added a divider - Named the dropdown button "Code", added appropriate icon --------- Co-authored-by: techknowlogick <techknowlogick@gitea.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Use batch database operations instead of one by one to optimze api pulls ↵Lunny Xiao2024-12-114-11/+88
| | | | | | | | | | | | | | | | | | | | (#32680) Resolve #31492 The response time for the Pull Requests API has improved significantly, dropping from over `2000ms` to about `350ms` on my local machine. It's about `6` times faster. A key area for further optimization lies in batch-fetching data for `apiPullRequest.ChangedFiles, apiPullRequest.Additions, and apiPullRequest.Deletions`. Tests `TestAPIViewPulls` does exist and new tests added. - This PR also fixes some bugs in `GetDiff` functions. - This PR also fixes data inconsistent in test data. For a pull request, the head branch's reference should be equal to the reference in `pull/xxx/head`.
* Make wiki pages visit fast (#32732)Lunny Xiao2024-12-061-0/+23
|
* Issue time estimate, meaningful time tracking (#23113)Illya Marchenko2024-12-052-34/+29
| | | | | | | | | | | | | Redesign the time tracker side bar, and add "time estimate" support (in "1d 2m" format) Closes #23112 --------- Co-authored-by: stuzer05 <stuzer05@gmail.com> Co-authored-by: Yarden Shoham <hrsi88@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add Arch package registry (#32692)KN4CK3R2024-12-041-0/+302
| | | | | | | | | | | | | | | | | | | | | | | Close #25037 Close #31037 This PR adds a Arch package registry usable with pacman. ![grafik](https://github.com/user-attachments/assets/81cdb0c2-02f9-4733-bee2-e48af6b45224) Rewrite of #25396 and #31037. You can follow [this tutorial](https://wiki.archlinux.org/title/Creating_packages) to build a package for testing. Docs PR: https://gitea.com/gitea/docs/pulls/111 Co-authored-by: [d1nch8g@ion.lc](mailto:d1nch8g@ion.lc) Co-authored-by: @ExplodingDragon --------- Co-authored-by: dancheg97 <dancheg97@fmnx.su> Co-authored-by: dragon <ExplodingFKL@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix delete branch perm checking (#32654)Lunny Xiao2024-12-041-0/+29
|
* Add Swift login endpoint (#32693)KN4CK3R2024-12-031-0/+18
| | | | | Fix #32683 This PR adds the login endpoint and fixes the documentation links.
* Allow to disable the password-based login (sign-in) form (#32687)wxiaoguang2024-12-021-0/+29
| | | | | | | | | | | | | | Usually enterprise/organization users would like to only allow OAuth2 login. This PR adds a new config option to disable the password-based login form. It is a simple and clear approach and won't block the future login-system refactoring works. Fix a TODO in #24821 Replace #21851 Close #7633 , close #13606
* Split mail sender sub package from mailer service package (#32618)Lunny Xiao2024-11-301-6/+10
| | | | | | | | Move all mail sender related codes into a sub package of services/mailer. Just move, no code change. Then we just have dependencies on go-mail package in the new sub package. We can use other package to replace it because it's unmaintainable. ref #18664
* Fix a bug in actions artifact test (#32672)Zettat1232024-11-291-5/+5
| | | | | | | | | | | | | | This bug exists in `TestActionsArtifactDownload`. https://github.com/go-gitea/gitea/blob/a1f56f83bff56f86180e59742efd3748908b82c1/tests/integration/api_actions_artifact_test.go#L123-L134 We assert that `listResp.Count` is `2`, so `artifactIdx` could be `0` or `1`. https://github.com/go-gitea/gitea/blob/a1f56f83bff56f86180e59742efd3748908b82c1/tests/integration/api_actions_artifact_test.go#L144-L147 Then we assert that the length of `downloadResp.Value` is `1`. If `artifactIdx` is `1` at this point, the assertion on Line 147 will throw an `index out of range` error.
* Validate OAuth Redirect URIs (#32643)Rowan Bohde2024-11-281-24/+93
| | | | | | | This fixes a TODO in the code to validate the RedirectURIs when adding or editing an OAuth application in user settings. This also includes a refactor of the user settings tests to only create the DB once per top-level test to avoid reloading fixtures.