Commit graph

61 commits

Author SHA1 Message Date
ad19ccbcfa PostIt testing setup 2026-06-19 16:55:42 +01:00
dcf2a93ad0 Split Site:Audience into Site:ExternalUrl + Site:CorsAllowedOrigins
The Site:Audience setting was conflating two distinct concepts: an OAuth
JWT audience (a single resource identifier) and a CORS allow-list (an
array of origins). Collapsing them caused several latent bugs:
- OAuth/JWT validation expected a single string while CORS WithOrigins
  accepts an array.
- Password-reset callback URLs and OAuth client RedirectUri/Origin were
  being built from what was meant to be an audience identifier, not a
  base URL.
- Yavsc.Org's main CORS policy was hardcoded to '*', with no way to
  restrict it without code changes.

Changes:
- SiteSettings.Audience (string) replaced with CorsAllowedOrigins
  (IList<string>).
- OAuth JWT Authority still reads Site:Authority; Audience now reads
  Site:ExternalUrl (Org only; Api/Blogs use ValidateAudience=false).
- MailSender and AccountController build reset-callback URLs from
  Site:ExternalUrl.
- ClientController uses Site:ExternalUrl for OAuth RedirectUri/Origin
  defaults on newly created clients.
- Yavsc.Api and Yavsc.Blogs now read CORS origins from
  Site:CorsAllowedOrigins instead of hardcoded URLs.

Add shared AddYavscCors / AddYavscJwtBearer extension methods in
Yavsc.Server/Helpers/ServiceExtensions.cs to enforce a single
configuration contract across all runtime services (Api, Blogs, Org).
Fails closed when CorsAllowedOrigins is empty; fails fast at startup
when Site:Authority is missing.

Remove obsolete ConfigurationHelpers.GetAudience (no remaining callers).

Local appsettings-*.json files (which carry deployment-specific values
and are gitignored) must be updated to add Site:CorsAllowedOrigins.
2026-06-19 13:15:21 +01:00
19cf073677 Regenerate the secret 2026-06-19 01:36:08 +01:00
3508f0a55d tests OK 2026-06-18 21:43:01 +01:00
c1f4d19975 fices the UI 2026-06-15 02:55:22 +01:00
5c6d6ee687 refactoring 2026-06-15 00:33:38 +01:00
69e81b9fd4 Giving up at UI testing 2026-06-15 00:00:39 +01:00
cba18df870 Fixes the css 2026-06-14 23:04:24 +01:00
e137c3e2ff Fixes the UI testing wwwroot 2026-06-14 20:05:01 +01:00
d454d4a513 An UI test 2026-06-14 18:53:14 +01:00
debb3231d3 fix(test): resolve ContentRoot path in WebServerFixture
The previous code computed the path as
  Path.Combine(BaseDir, "../../src/Yavsc.Org")
which from `bin/Debug/net10.0/` resolved to a non-existent
`test/yavscTests/src/Yavsc.Org` (two levels up, not four).
Kestrel logged:
  "The WebRootPath was not found: ... /wwwroot. Static files
   may be unavailable."

The fix walks up the directory tree from BaseDir until it
finds a directory that contains `src/Yavsc.Org`. This is
robust against the test runner changing the current working
directory (which it does: it runs from
`test/yavscTests/bin/Debug/net10.0`, not the repo root).

After this fix, UseStaticFiles correctly resolves the
wwwroot, so static assets under `wwwroot/` are served.

Note: this does NOT make the in-memory WebServerFixture
fully functional. Two pre-existing issues remain:
1. _Layout.cshtml references `~/css/site.css` but the
   actual file is now at `~/css/main/site.css` (moved by
   commit 31906a78). The .cshtml was not updated.
2. HomeController.Index() throws NullReferenceException
   on an empty EF Core InMemory database (no Activities
   seeded). UseDeveloperExceptionPage returns a 500 page
   that gets caught and re-rendered as 404 by the test
   client.
Both will be addressed in follow-up commits.

Tested: dotnet test 11/11 green (existing tests use
Services DI, not HTTP). UI tests not added yet (blocked by
the issues above).
2026-06-14 18:04:34 +01:00
e98bba4247 refacts and PostIt Nav 2026-06-11 20:02:32 +01:00
fa7d6242f1 postit and them also 2026-06-10 00:23:17 +01:00
8dc1680582 no Microsoft.Playwright depedency 2026-06-07 06:52:24 +01:00
e24208e77b refact 2026-05-30 19:34:22 +01:00
95dec3636a Use InMemory db driver at testing 2026-05-28 22:18:26 +01:00
6cc0c519d2 tests OK 2026-04-20 00:35:51 +01:00
5620213cf5 better 2026-04-19 20:36:03 +01:00
65db349c0a fixes the current date at testing phase 2026-04-19 19:17:34 +01:00
2e26cfcfa2 configure a test scope 2026-04-19 18:10:00 +01:00
e1ad899158 Modernization 2026-04-19 17:23:18 +01:00
5b6caa72b5 a web server fixture shared state 2026-04-19 17:15:10 +01:00
b1a7a47f69 generate a cert for tests 2026-04-19 16:18:37 +01:00
d21337d4a6 about to test remote access 2026-04-19 16:02:50 +01:00
47323b2d85 fix: resolve nullability compilation errors in test fixtures
- Make WebServerFixture properties nullable to match async initialization
- Add null-coalescing assertions where properties are guaranteed non-null
- Fix GetDiscoveryDocumentAsync delegate signature in Remoting to allow nullable parameters
- Build now succeeds with 0 errors, 7/9 tests passing
2026-04-19 14:43:37 +01:00
87d62791b8 fix: test infrastructure with in-memory DB, SMTP mocking, and thread-safe billing configuration
- Add in-memory database support for test isolation in WebServerFixture
- Implement TestMailSender fake SMTP provider for email test support
- Add thread synchronization to billing service registration to prevent race conditions
- Make RegisterBilling<T> idempotent to safely handle reconfiguration
- Configure test environment via in-memory settings (UseTestEmailSender, UseInMemoryDatabase)
- Add regression tests for billing module idempotency and duplicate registration detection
- Fix tests: EMaillingTests.SendEMailSynchrone, BillingServiceTests (2 tests), HaveConfigurationRoot (3 tests)

All core test infrastructure tests now passing.
2026-04-19 14:40:40 +01:00
Paul Schneider
be7df3d054 APi Scopes 2026-03-16 23:16:12 +00:00
Paul Schneider
e042e34bf7 refact and login 2026-03-09 02:07:42 +00:00
Paul Schneider
40e8e08690 reorg 2026-02-28 21:17:54 +00:00
Paul Schneider
f1dd648970 refactoring the Register 2026-02-22 23:39:56 +00:00
Paul Schneider
2f645b7f0f load the cert file 2026-02-21 21:00:37 +00:00
Paul Schneider
5cf4bd48e8 refact & cookies 2026-02-17 19:24:30 +00:00
Paul Schneider
ca03b496db cleanup 2026-02-16 00:14:33 +00:00
Paul Schneider
a68287d847 Dockerfile & actions 2026-02-02 00:39:24 +00:00
Paul Schneider
e5fa31c9cb using AscDocCsharp, and fixing the tag helper 2025-09-14 17:47:11 +01:00
Paul Schneider
03161bbfb6 Id Stores from db 2025-08-24 16:07:53 +01:00
Paul Schneider
27a05bf9c9 testing 2025-07-30 15:52:01 +01:00
Paul Schneider
5c046dfa88 build cli 2025-07-16 00:47:50 +01:00
Paul Schneider
b3d565b6d9 Refactoring
The main server owns the migrations, it's the server part,
it's simpler.

It's Yavsc, not one of its lib.
2025-07-15 20:17:39 +01:00
Paul Schneider
52edbff231 a client store 2025-07-15 17:35:14 +01:00
Paul Schneider
72bae76c75 null paiment id 2025-07-15 15:42:30 +01:00
Paul Schneider
8fc1153e59 testing 2025-07-14 20:35:13 +01:00
Paul Schneider
2ba13c7825 build tests 2025-07-13 18:13:04 +01:00
Paul Schneider
32c1482bfb MEF & Settings 2025-07-11 13:04:50 +01:00
Paul Schneider
253a2919f3 misc 2025-07-07 07:49:18 +01:00
Paul Schneider
5998c474af bump sdk to net-9 2025-06-08 14:41:50 +01:00
Paul Schneider
050b8a7aa4 Track vscode setup 2025-03-02 16:53:56 +00:00
Paul Schneider
25b261f4ee more services from Web API 2025-02-15 12:45:27 +00:00
Paul Schneider
49826eae4a WIP separation Web et API 2025-02-12 20:41:14 +00:00
Paul Schneider
852020f98f bug fixes 2024-11-10 23:12:02 +00:00