summaryrefslogtreecommitdiffstats
path: root/modules/base/tool_test.go
Commit message (Collapse)AuthorAgeFilesLines
* Add generic set type (#21408)KN4CK3R2022-10-121-9/+0
| | | | | This PR adds a generic set type to get rid of maps used as sets. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Prettify number of issues (#17760)Gusted2022-06-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Prettify number of issues - Use the PrettyNumber function to add commas in large amount of issues. * Use client-side formatting * prettify on both server and client * remove unused i18n entries * handle more cases, support other int types in PrettyNumber * specify locale to avoid issues with node default locale * remove superfluos argument * introduce template helper, octicon tweaks, js refactor * Update modules/templates/helper.go * Apply some suggestions. * Add comment * Update templates/user/dashboard/issues.tmpl Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fixed assert statements. (#16089)KN4CK3R2021-06-071-4/+4
|
* Add Image Diff for SVG files (#14867)KN4CK3R2021-06-051-92/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added type sniffer. * Switched content detection from base to typesniffer. * Added GuessContentType to Blob. * Moved image info logic to client. Added support for SVG images in diff. * Restore old blocked svg behaviour. * Added missing image formats. * Execute image diff only when container is visible. * add margin to spinner * improve BIN tag on image diffs * Default to render view. * Show image diff on incomplete diff. Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* fix truncate utf8 string (#15828)yan2021-05-131-0/+8
| | | | | * fix truncate utf8 string. * revoke truncated user info.
* Add some Unit-Tests (#14500)65432021-01-281-6/+93
| | | | | | | | | | | * fix url * modules/auth/pa: coverage: 40#.0% * modules/base coverage: 67.6% -> 89.9% * modules/cache coverage: 0% -> 12.0% * modules/convert coverage: 27.1% -> 29.7%
* Kd/fix allow svg doctype (#14344)Kyle D2021-01-151-0/+8
| | | | | | | | | * make svg regex case-insensitive & use strict word boundary * allow doctype svg * add doctype tests * allow <!DOCTYPE svg> and <svg/>
* Display SVG files as images instead of text (#14101)Jonathan Tran2021-01-121-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change to display SVG files as images * Remove unsafe styles from SVG CSP * Add integration test to test SVG headers * Add config setting to disable SVG rendering * Add test for img tag when loading SVG image * Remove the Raw view button for svg files since we don't fully support this * Fix copyright year * Rename and move config setting * Add setting to cheat sheet in docs * Fix so that comment matches cheat sheet * Add allowing styles in CSP based on pull request feedback * Re-enable raw button since we show SVG styles now * Change so that SVG files are editable * Add UI to toggle between source and rendered image for SVGs * Change to show blame button for SVG images * Fix to update ctx data * Add test for DetectContentType when file is longer than sniffLen Co-authored-by: Jonathan Tran <jon@allspice.io> Co-authored-by: Kyle D <kdumontnu@gmail.com>
* Fix panic in BasicAuthDecode (#14046)silverwind2020-12-171-0/+6
| | | | | | | | | | * Fix panic in BasicAuthDecode If the string does not contain ":" that function would run into an `index out of range [1] with length 1` error. prevent that. * Update BasicAuthDecode() Co-authored-by: 6543 <6543@obermui.de>
* Direct avatar rendering (#13649)silverwind2020-12-031-41/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Direct avatar rendering This adds new template helpers for avatar rendering which output image elements with direct links to avatars which makes them cacheable by the browsers. This should be a major performance improvment for pages with many avatars. * fix avatars of other user's profile pages * fix top border on user avatar name * uncircle avatars * remove old incomplete avatar selector * use title attribute for name and add it back on blame * minor refactor * tweak comments * fix url path join and adjust test to new result * dedupe functions
* Use a simple format for the big number on ui (#12822)赵智超2020-09-161-0/+8
| | | | | | | | | | | | | | | * Use a simple format for the big number on ui Signed-off-by: a1012112796 <1012112796@qq.com> * make fmt * Apply review suggestion @silverwind * Change name 2 * make fmt Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Add gitea-vet (#10948)John Olheiser2020-04-051-0/+4
| | | | | | | | | | | | | | | | | * Add copyright Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add gitea-vet and fix non-compliance Signed-off-by: jolheiser <john.olheiser@gmail.com> * Combine tools.go into build.go and clean up Signed-off-by: jolheiser <john.olheiser@gmail.com> * Remove extra GO111MODULE=on Signed-off-by: jolheiser <john.olheiser@gmail.com>
* make avatar lookup occur at image request (#10540)zeripath2020-03-271-11/+0
| | | | | | | | | | | | | speed up page generation by making avatar lookup occur at the browser not at page generation * Protect against evil email address ".." * hash the complete email address Signed-off-by: Andrew Thornton <art27@cantab.net> Co-Authored-By: Lauris BH <lauris@nix.lv>
* Show download count info in release list (#10124)Lauris BH2020-02-031-7/+7
| | | | | | * Show download count info in release list * Use go-humanize
* Display ui time with customize time location (#7792)Lunny Xiao2019-08-151-149/+0
| | | | | | | | | | | | | | | | | | * display ui time with customize time location * fix lint * rename UILocation to DefaultUILocation * move time related functions to modules/timeutil * fix tests * fix tests * fix build * fix swagger
* Convert files to utf-8 for indexing (#7814)guillep2k2019-08-151-36/+0
| | | | | | | | | | | | | | * Convert files to utf-8 for indexing * Move utf8 functions to modules/base * Bump repoIndexerLatestVersion to 3 * Add tests for base/encoding.go * Changes to pass gosimple * Move UTF8 funcs into new modules/charset package
* Add golangci (#6418)kolaente2019-06-121-8/+7
|
* refactor: append, build variable and type switch (#4940)Bo-Yi Wu2019-05-281-8/+8
| | | | | | * refactor: append, build variable and type switch * fix: remove redundant space.
* Hash App token (#6724)techknowlogick2019-05-041-0/+7
|
* Use type switch (#5122)Oleg Kovalov2018-10-191-8/+8
|
* Implements generator cli for secrets (#3531)Codruț Constantin Gușoi2018-02-181-6/+0
| | | Signed-off-by: Codruț Constantin Gușoi <codrut.gusoi@gmail.com>
* Fix avatar URLs (#3069)Ethan Koenig2017-12-031-4/+30
| | | | | | * Fix avatar URLs * import order
* Use identicon image for default gravatar. (#2767)harry2017-10-231-1/+1
| | | | | | * Use identicon image for default gravatar. * Fixed tests.
* Make time diff translatable (#2057)Lauris BH2017-06-281-9/+7
|
* xxx_active_code_live setting in printed in hours and minutes instead … (#1814)Jonas Östanbäck2017-05-291-0/+14
| | | | | | * xxx_active_code_live setting in printed in hours and minutes instead of just hours * Update app.ini description of xxx_code_lives settings
* Remove test that touch networkAndrey Nering2017-02-251-14/+2
|
* Fix race condition in unit test (#456)Ethan Koenig2016-12-231-2/+7
|
* Bindata is optional and over-writable on restart (#354)Thomas Boerger2016-12-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Moved conf assets into options folder * Dropped old bindata * Started to integrate options bindata and accessors * Do not enforce a builtin app.ini * Replaced bindata calls with options * Dropped bindata task from makefile, it's the generate task now * Always embedd app.ini to provide sane config defaults * Use sane defaults for the configuration * Defined default value for SSH_KEYGEN_PATH * Dropped "NEVER EVER MODIFY THIS FILE" header from app.ini * Fixed new paths in latest test additions * Drop bindata with make clean task * Set more proper default values
* Bug fixes and tests for modules/base (#442)Ethan Koenig2016-12-221-16/+217
| | | Also address other TODOs
* Fix random string generator (#384)Denis Denisov2016-12-201-1/+3
| | | | | | | | | | | * Remove unused custom-alphabet feature of random string generator Fix random string generator Random string generator should return error if it fails to read random data via crypto/rand * Fixes variable (un)initialization mixed assign Update test GetRandomString
* Update import paths from github.com/go-gitea to code.gitea.io (#135)Sandro Santilli2016-11-101-1/+1
| | | | | | | - Update import paths from github.com/go-gitea to code.gitea.io - Fix import path for travis See https://docs.travis-ci.com/user/languages/go#Go-Import-Path
* Add test for IsTextFile()Matthias Loibl2016-11-071-3/+7
|
* Add test for IsLetter()Matthias Loibl2016-11-071-1/+15
|
* Add test for Int64sToMap()Matthias Loibl2016-11-071-1/+8
|
* Add tests for StringsToInt64s() & Int64sToStrings()Matthias Loibl2016-11-071-8/+43
|
* Add tests for TruncateString()Matthias Loibl2016-11-071-1/+11
|
* Add tests for EllipsisString() and fix bug if param length < 3Matthias Loibl2016-11-071-4/+12
|
* Test AvatarLink and refactor with tests passingMatthias Loibl2016-11-071-1/+23
|
* Use testify/assert for all tests in tool_test.goMatthias Loibl2016-11-071-31/+12
|
* Add unit test for base.FileSize()Matthias Loibl2016-11-071-2/+23
|
* Start to add tests for modules/base/toolMatthias Loibl2016-11-071-0/+83