-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some tests #450
base: main
Are you sure you want to change the base?
Add some tests #450
Conversation
In your tests, you need to use the ITenantStorageFactory, and mock it to return an Then for
Directly using the When API keys are being validated, you will always have to use the factory for this reason. |
[Obsolete("Use injected |
See my comment above :-) |
thanks |
@jonashendrickx |
Can you run Looks good overall, you could theoretically also verify you're calling It could look like:
|
.Be("appId:public:"); | ||
|
||
storageMock.Verify(x => x.StoreApiKeyAsync(It.IsAny<string>(), It.IsAny<string>(), | ||
It.Is<string[]>(p => p == scopes.Select(s => s.GetValue()).ToArray())), Times.Once); |
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.
@jonashendrickx it don't work I don't know why
I don't have the pk and publicKey in arrange level of test, the guid is generated inside of SetupApiKeyAsync method I wrote it like this storageMock.Verify(x => x.StoreApiKeyAsync(It.IsAny<string>(), It.IsAny<string>(),
It.Is<string[]>(p => p == scopes.Select(s => s.GetValue()).ToArray())), Times.Once); but it give this error " Expected invocation on the mock once, but was 0 times" I don't know why |
Added Tests to SharedManagementServiceTests for CreateApiKeyAsync method
and I like to know what should I use instead of
passwordless-server/src/Service/Storage/Ef/DbTenantFactory.cs
Line 14 in 1f47bf1