Commit Graph

19 Commits (1df62fafb99c03d4d3d4b26c99839d165d5425da)

Author SHA1 Message Date
Joe Chen 1df62fafb9
db: use `context` and go-mockgen for `ReposStore` (#7046) 2022-06-11 12:43:56 +08:00
Joe Chen 5e32058c13
db: use `context` and go-mockgen for `TwoFactorsStore` (#7045) 2022-06-11 11:54:11 +08:00
Joe Chen f837ea6346
db: use `context` and go-mockgen for `UsersStore` (#7042) 2022-06-11 09:42:17 +08:00
Joe Chen 9776bdc9b8
db: use `context` and go-mockgen for login sources (#7041) 2022-06-10 19:54:36 +08:00
Joe Chen 94059f291d
db: use `context` and go-mockgen for `LFSStore` (#7038) 2022-06-10 11:27:06 +08:00
Joe Chen 7229dd893f
db: use `context` and go-mockgen for `PermsStore` (#7033) 2022-06-08 19:26:20 +08:00
Joe Chen fe1d07f29c
db: rename `AccessTokensStore.Save` to `Touch` (#7029) 2022-06-08 13:34:10 +08:00
Joe Chen 0a92ad27ef
db: use `context` and go-mockgen for `AccessTokensStore` (#7013) 2022-06-06 12:10:36 +08:00
E99p1ant a328e7ccc4
access_token: encrypt access token with SHA256 (#7008)
* access_token: encrypt access token with SHA256

* revert list access token

* fix lint

* generate schemadoc

* add database migrations

* fix tests

* fix tests

* add test case for access token golden

* fix test in postgres

* `Sha256` -> `SHA256`

* Use GORM for migration

* task generate-schemadoc

* Use unique

* change migration name

* allow read

* task generate-schemadoc

* add changelog

* fix lint error

* update changelog

* remove Debug

* add comments

Co-authored-by: Joe Chen <jc@unknwon.io>
2022-06-05 13:34:21 +08:00
ᴜɴᴋɴᴡᴏɴ 2eaf1d693a
db: migrate access table to use GORM (#6371) 2020-10-06 15:43:28 +08:00
ᴜɴᴋɴᴡᴏɴ 3af91d7cfd
auth: decouple types and functions from db (#6320) 2020-09-20 11:19:02 +08:00
ᴜɴᴋɴᴡᴏɴ 9d64d222a8
db: add tests for users (#6116)
* Add new methods

* Use Users.Create to replace previous hack

* Reduce side effect

* Do not clear tables when test failed

* test_users_Authenticate

* Rename constant

* test_users_Create

* test_users_GetByEmail

* test_users_GetByID

* test_users_GetByUsername
2020-04-18 12:07:30 +08:00
ᴜɴᴋɴᴡᴏɴ cb439a126a
db: add tests for two factors (#6099)
* Rename to TwoFactors.Create

* Use GORM to execute queries

* TwoFactor.GetByUserID

* Add tests

* Fix failing tests

* Add MD5 tests

* Add tests for RandomChars
2020-04-14 09:41:54 +08:00
ᴜɴᴋɴᴡᴏɴ 41f56ad05d
login_source: migrate to GORM and add tests (#6090)
* Use GORM in all write paths

* Migrate to GORM

* Fix lint errors

* Use GORM  to init table

* dbutil: make writer detect error

* Add more tests

* Rename to clearTables

* db: finish adding tests

* osutil: add tests

* Fix load source files path
2020-04-11 20:18:05 +08:00
ᴜɴᴋɴᴡᴏɴ 76bb647d24
db: add tests for permissions (#6088)
* Add flag to print SQLs

* Add tests for perms

* Make results stable

* codecov: only show diff

* Once again, stable find results
2020-04-11 05:39:45 +08:00
ᴜɴᴋɴᴡᴏɴ 62dda96159
access_token: migrate to GORM and add tests (#6086)
* access_token: migrate to GORM

* Add tests

* Fix tests

* Fix test clock
2020-04-11 01:25:19 +08:00
ᴜɴᴋɴᴡᴏɴ 9a5b227f3e
lfsutil: add `Storager` interface and local storage (#6083)
* Add Storager interface

* Add tests

* Add back note

* Add tests for basic protocol routes

* Fix lint errors
2020-04-10 22:13:42 +08:00
ᴜɴᴋɴᴡᴏɴ 2b3655fa11
lfs: add tests to batch endpoint (#6073) 2020-04-06 23:53:55 +08:00
ᴜɴᴋɴᴡᴏɴ ee0ea2c5fc
lfs: add unit test for middleware (#6070)
* Add unit test for `authenticate` middleware

* Add more cases

* Add tests for verifyOID and internalServerError

* Add tests for verifyHeader

* Add tests for authroize
2020-04-06 18:35:10 +08:00