gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit097c52ba097c52baStyle the login error through its View idmre097c52ba/tests/app-auth-unit.hl

1.7 KB

  1. // tests/app-auth-unit.hl — run by tests/app-token.mjs with its own GITORIA_STORAGE: appOfRequest (lib/app-auth.hl) called directly, because no apps API route uses it yet (#44).
  2. // Prints one line per case: `<case> <status or ok>`.
  3. import { now } from 'hl:time'
  4. import { sha256 } from 'hl:crypto'
  5. import { reposTable } from './../lib/repos.hl'
  6. import { removeApp } from './../lib/apps.hl'
  7. import { appsTable } from './../lib/apps-table.hl'
  8. import { issueToken, dropTokensOfApp } from './../lib/app-tokens.hl'
  9. import { appOfRequest } from './../lib/app-auth.hl'
  10. r1 = reposTable.put({ slug = 'one' description = 'x' owner = 'u' created = now() org = '' priv = true })
  11. r2 = reposTable.put({ slug = 'two' description = 'x' owner = 'u' created = now() org = '' priv = false })
  12. a1 = appsTable.put({ repo = r1 name = 'A' hookUrl = 'https://x.worldapi.org/' keyHash = sha256('k1') secret = 's' createdBy = 'u' created = now() lastDelivery = 0 lastStatus = '' })
  13. app1 = appsTable.fetch(a1)
  14. t = issueToken(app1)
  15. static ask = (host, token) => {
  16. headers = { host = host }
  17. if (token != null) { headers['authorization'] = 'Bearer ' + token }
  18. return appOfRequest({ params = {} }, { headers = headers })
  19. }
  20. static show = (label, r) => {
  21. console.log(label + ' ' + (r.error != null ? r.error.status + ' ' + JSON.parse(r.error.body).error.code : 'ok ' + r.app.name + ' ' + r.repo.slug))
  22. }
  23. show('good', ask('one.localhost:1', t.token))
  24. show('none', ask('one.localhost:1', null))
  25. show('unknown', ask('one.localhost:1', 'gat_' + 'b'.repeat(40)))
  26. show('other-repo', ask('two.localhost:1', t.token))
  27. show('no-repo', ask('zzz.localhost:1', t.token))
  28. dropTokensOfApp(a1)
  29. show('dropped', ask('one.localhost:1', t.token))
  30. t2 = issueToken(app1)
  31. appsTable.delete(a1)
  32. show('app-gone', ask('one.localhost:1', t2.token))

Branches

Latest commits

  • 097c52baStyle the login error through its View idmre
  • c6d9c86aOwn the not-found code rule in its componentmre
  • 055424c2Record W61 replacement theme gates, sidebar repro and baselinemre
  • 2ed09441Use layouts theme 17e0f03 for W61 compatibilitymre
  • b8609a91Merge branch 'main' into w61-stylemre
  • 4639caf7Report W61 theme startup blocker and day39 Style probemre
  • 81f0a0bbREADME: two caches were restored by 90b4f72; log W62mre
  • 4a3f557eImport layouts theme ebd00b6 for W61 (startup blocked)mre
  • ab12a257Merge W62: #25 commit page measurements and proc repromre
  • 41323e49gitoria#25: measure commit request costs and reproduce blocking process waitsmre
  • 53ca42b2log: W60 merged, W61 W62 startedmre
  • 80870a33mission W61: style passmre
  • 560fd208Merge W60: helpers, bound forms, login in topics, two form fixes (gitoria#28 #32 #33)mre
  • ac5ba6a4log: W60, #25 measuredmre
  • 220f6342W60: record corrected form proof, full AE and remaining gapsmre
  • 7e31cac5gitoria#28: restrict reply form layout to reply formsmre
  • ae373cfdgitoria#28: keep each reply draft in its thread componentmre
  • eeeebd5agitoria: insert a newly created organization oncemre
  • 34d2d5cagitoria: clear the bound public-key textarea after creationmre
  • 119e54c0W60: restore conductor-owned tracking filesmre