Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 02 15:05

    jeremydmiller on gh-pages

    Documentation Update for 5.0.0 (compare)

  • Dec 02 15:03

    jeremydmiller on master

    doc updates for Alba 6 (compare)

  • Dec 01 16:52
    dhaligas opened #98
  • Nov 29 19:40

    github-actions[bot] on v6.0.0

    (compare)

  • Nov 29 19:16

    jeremydmiller on master

    adding .net 6 to the gh actions (compare)

  • Nov 29 19:15
    jeremydmiller closed #32
  • Nov 29 19:15
    jeremydmiller commented #32
  • Nov 29 19:14

    jeremydmiller on master

    customizations are applied thro… can use Alba web application fa… (compare)

  • Nov 29 17:28
    jeremydmiller closed #95
  • Nov 29 17:28

    jeremydmiller on master

    hardening the assertion excepti… (compare)

  • Nov 29 17:27
    jeremydmiller commented #95
  • Nov 29 17:06

    jeremydmiller on master

    Working WebApplicationFactory e… (compare)

  • Nov 29 17:06
    jeremydmiller closed #97
  • Nov 22 03:21
    Hawxy ready_for_review #97
  • Nov 20 11:19
    Hawxy opened #97
  • Nov 19 19:55

    jeremydmiller on master

    updated docs a tiny bit for rem… initial concept for using Alba … (compare)

  • Nov 19 19:55
    jeremydmiller commented #95
  • Nov 19 19:52
    jeremydmiller labeled #95
  • Nov 19 19:52
    jeremydmiller closed #83
  • Nov 19 19:52
    jeremydmiller commented #83
Jeremy D. Miller
@jeremydmiller
You can still use it with ASP.Net Core 2.*
the latest I mean. Took a lot of conditional compilation to make it happen of course. Multi-targeting asp.net core versions is rough right now with the churn
Tomasz Jaskula
@tjaskula
yes, our test project targets right now net472
Jeremy D. Miller
@jeremydmiller
Ah, shoot, okay. I think we gave up on ASP.Net Core < 2 in the latest
Tomasz Jaskula
@tjaskula
that's why, we have a lot of "legacy" dependencies, we cannot migrate it easily
Jeremy D. Miller
@jeremydmiller
I completely get it
Tomasz Jaskula
@tjaskula
ahhh
I understand maintaining old platforms is not easy for you
Jeremy D. Miller
@jeremydmiller
It is when the platform changes a lot in a few years
Ralph Hendriks
@ralphhendriks

@jeremydmiller I just started playing around with Alba for some HTTP API integration tests. So far, I like it a lot. One thing that bugs me though is that the built-in assertion on the content type behaves not as I would expect. I have configured my scenario _.ContentTypeShouldBe("application/problem+json"), which then fails with:

Alba.ScenarioAssertionException : Expected a single header value of 'content-type'='application/problem+json', but the actual value was 'application/problem+json; charset=utf-8'

Of course I can include the charset on the expected value. However, it feels a bit clunky to do so. I could make a contribution to improve this if you like, but I am not sure if this fits in your ideas how the library should develop.

Jeremy D. Miller
@jeremydmiller
A PR for this would be very welcome. I think you’d end up making hte content type check be a custom assertion so it can be smart enough to parse mime types
dionfoster
@dionfoster
:wave:
hi guys, i'm looking to use alba for integration testing of a dotnet core 3.1 api endpoint
it is using multipart/formdata with an IFormFile
i don't mind putting together a PR for this but need some help
first off, is there a way to view the raw request alba is sending?
Jeremy D. Miller
@jeremydmiller
Right now the answer is “debugger”. I’d happily take a PR if you want an optional sink to display the incoming request.
dionfoster
@dionfoster
:thumbsup:
dionfoster
@dionfoster
hey guys i've posted a PR for review to add support for multipart form data and IFormFile, hopefully a starting point for conversation on a few aspects
dionfoster
@dionfoster
feedback appreciated
Jeremy D. Miller
@jeremydmiller
@dionfoster I’ll get something to you tomorrow. It was on my TODO list in the morning, but I didn’t get to it
dionfoster
@dionfoster
no problems! thanks!
dionfoster
@dionfoster
depending on what is desirable from an api perspective, might need some implementation changes with regards to the formcollection as the only way i could get this going was to replace the entire formcollection on the HttpRequest
JT
@Hawxy
@jeremydmiller I know you're not focusing on alba right now, but would you accept a semver major maintenance PR that drops support for .net core 2.x and adds a .net 5 target with related test host?
Jeremy D. Miller
@jeremydmiller
Oh hell yes I would, and thank you!
JT
@Hawxy
#80 is up for review
Jeremy D. Miller
@jeremydmiller
@Hawxy Alba v4 is up on Nuget, and I’ve published the doc updates you did. Thank you so much for taking that on!
JT
@Hawxy
:thumbsup:
Ismail Mayat
@ismailmayat
is it possible to post ToUrl where the url has param [FromRoute] ?
Jeremy D. Miller
@jeremydmiller
ToUrl() is just passing the Url as a string, and it’s completely agnostic of what is handling that in your ASP.Net Core application. Long winded way of saying “yes"
Ismail Mayat
@ismailmayat
@jeremydmiller ah yes you are right, so i think the issue is something else basically i was writing a test for the Add method on this controller https://github.com/joaofbantunes/OOPsIDidItAgain/blob/main/src/OOPsIDidItAgain.06.MinimizingExceptions.Web/Controllers/CartsController.cs
it has input param AddItemCartModel which looks like https://bit.ly/2OWlYHx the ItemId field is another type and that is hydrated by https://bit.ly/3tn7oYo modelbinder and i think issue is here
Jeremy D. Miller
@jeremydmiller
Hey, if anybody is paying attention to this, here's a set of proposed changes for Alba V5: JasperFx/alba#86
The big driver is wanting helpers for testing APIs secured by JWTs post haste at my work
JT
@Hawxy
For JWT's we just have a fake JWT generator and override the JwtBearerOptions within the hostbuilder passed into the SystemUnderTest
 s.PostConfigure<JwtBearerOptions>(JwtBearerDefaults.AuthenticationScheme, options =>
                    {
                        options.TokenValidationParameters = new TokenValidationParameters
                        {
                            IssuerSigningKey = FakeJwtGenerator.SecurityKey,
                            ValidIssuer = FakeJwtGenerator.Issuer,
                            ValidAudience = FakeJwtGenerator.Audience
                        };
                    });
Although in our case our identity provider is Auth0, so I'm guessing there's some extra complexity when it comes to IdentityServer.
Jeremy D. Miller
@jeremydmiller
@Hawxy Do you run a parallel web app for the fake JWT generation, or do something else?
JT
@Hawxy
No need, it's just a static class that creates random security keys & signing credentials on each run, with a function that generates a token with the ability to set some claims the backend uses like user/tenant/scopes.
I'm overriding the token validation, so as long as the rest of the data on the token meets the authorization requirements we're all good.
Jeremy D. Miller
@jeremydmiller
So I'm gonna plead ignorance then, I thought that the bearer token authentication had to make a call to the OIDC server to validate the token -- and I typed that out before you wrote the last message
How are you overriding the token validation?
JT
@Hawxy
The PostConfigure call I posted above

My Startup.cs contains

            services.AddAuthentication(options =>
                {
                    options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                    options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
                })
                .AddJwtBearer(options =>
                {
                    options.Authority = Configuration["Auth0:Domain"];
                    options.Audience = Configuration["Auth0:Audience"];
                })

PostConfigure runs after the bearer options were set, thereby wiping out the configuration and validating the token with the fake signing key instead of reaching out and getting the JWKs from Auth0.

Jeremy D. Miller
@jeremydmiller
Gotcha. I didn't catch that you were completely wiping out the TokenValidationParameters
JT
@Hawxy
Ah right, so I just ran some tests, the authority must still be a valid OIDC server that the middleware can fetch metadata from, despite not using it as part of the validation.
Jeremy D. Miller
@jeremydmiller
Okay, so I'm not crazy. I've been trying hard to disable the validation and it was still trying to call out.
Also, doing difficult exploratory coding while watching Peppa Pig with a sick 4yo hanging on your arm is not terribly effective.
The simple thing I haven't tried yet is just sticking a ClaimsPrincipal on the HttpContext first.