-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Added guard to FormsAuthentication as per issue #1755 #1778
base: master
Are you sure you want to change the base?
Added guard to FormsAuthentication as per issue #1755 #1778
Conversation
…Enable' has been called. Added tests- a bit hacky, as FormsAuthentication is static.
@@ -162,7 +161,71 @@ public void Should_return_ok_response_when_user_logs_in_without_redirect() | |||
result.StatusCode.ShouldEqual(HttpStatusCode.OK); | |||
} | |||
|
|||
[Fact] | |||
#region Throw helpful exception when the configuration is not enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use 4 spaces instead of tabs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ug. Yuck. Spaces. Ok. There isn't a style-guide, is there? There seems to be a space for one, but no link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please get rid of the region? Thanks 😋
Errr... so what happens now? Can a committer have a look at this and decide how to resolve? Leave it as is, or accept it's not testable? |
Leave it as it is for now. You can go to the chat and ask one of the commiters to have a look at it. Sent from my iPhone
|
…/Worthaboutapig/Nancy into NancyFx#1755-FormsAuthentication
var result = Record.Exception(() => FormsAuthentication.UserLoggedInResponse(userGuid)); | ||
|
||
// Then | ||
result.ShouldBeOfType(typeof(InvalidOperationException)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this to use the generic overload result.ShouldBeOfType<InvalidOperationException>();
Need to convert tabs to spaces in all affected files + verify that the indentation is correct (currently it's not) |
@@ -85,9 +85,9 @@ | |||
<DocumentationFile>bin\MonoRelease\Nancy.Testing.XML</DocumentationFile> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Reference Include="CsQuery, Version=1.3.3.5, Culture=neutral, processorArchitecture=MSIL"> | |||
<Reference Include="CsQuery, Version=1.3.3.249, Culture=neutral, processorArchitecture=MSIL"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not change the version of our dependencies 😄
This pull-request does seem to touch a lot of unrelated file for no good reason
All of these things needs to be resolved if we are going to pull this in. @Worthaboutapig are you still interested in working with us to update this pull-request or would you rather we close it and apply a fix ourselves ? Looking at resolving #1755 very soon |
I'm happy to do the fix- tbh I thought it had been ignored. I've numerous other fixes/ suggestions. |
@Worthaboutapig I do sincerely apologies that this was left hanging for so long without any feedback from us. We're trying to improve on that now and we've closed nearly 100 issues in 2 weeks :) |
The one thing that I do not like is the |
Clearly I can fix up all the unnecessary changes, but this last point you raise was the main reason I hadn't. Presumably you don't want to change that, but as I said originally, adding a If someone has a better approach, that would be good. I'm happy to fix up my code, but then until you have a design you're happy with, you won't merge it, so I also don't want to waste my time. What do you suggest? |
@Worthaboutapig All the config stuff is changing from static to instance based in 2.0. See #1999 and #2003. |
@khellang can you think of a decent workaround for the |
It would seem sensible to me to move it to 2.x, I can't think of a workaround and presumably the problem won't exist with an instance-based system and it's not a critical problem. I'll take a look at implementing it into 2.x, if that's ok with you? |
Yep, we'll put this in 2.x and migrate it over to the new configuration API instread 👍 |
Created guards on the four login/out methods.
Created tests for the changes- unfortunately all the FormsAuthentication stuff is static, so it can't really be tested properly. I've added an internal method for the test assembly to allow disabling FormsAuthentication so it can be tested. Not ideal, but with a static FormsAuthentication it's not really unit-testable.
Can't see another simple way to provide unit-testing, however, it introduces code only for testing, which is not great...
Believed I followed the correct procedures- read how to contribute, so I hope it's correctly setup.