1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-30 13:33:24 +01:00
Commit Graph

85 Commits

Author SHA1 Message Date
Justin Baur
aad36496e4
Added Services and Utilities Tests to Core.Test project (#1068)
* Sorted usings

* Added CoreHelpersTests

* Added CloneObject test

* Added comments to SelfHostedAttributeTests

* Changed private variable declaration to be inline with the rest of the project

* Changed to SUT naming scheme

* Scaffolded AppleIapServiceTests

* Scaffolded I18nServiceTests.cs

* Scaffolded I18nViewLocalizerTests

* Scaffolded LocalSendStorageServiceTests

* Added tests to ReadableBytesSize_Success

* Add more CleanCertificateThumbprint tests

* Added more tests for the ExtendQuery method

* Removed AppleIapServiceTests

* Removed I18nServiceTests

* Removed I18nViewLocalizerTests

* Removed LocalSendStorageServiceTests

* Converted Batch_Success to theory with InlineData

* Simplified Batch_Success so there is less branching and more accuracy

* Switched to using size variable to format readable bytes for any number lower than 1024

* Fixed test data to work in all locales
2021-01-06 12:49:28 -06:00
Justin Baur
6803b61b9b
Core Tests (#1062)
* Added tests for SelfHostedAttribute

* Added Token Retrieval Tests
2020-12-28 13:49:18 -05:00
Addison Beck
fee5c932db
started charging sales tax on seat/storage upgrades and auto renewals (#1034)
* started charging sales tax on seat/storage upgrades and auto renewals

* Code review fixes for auto-renewing subscriptions charging sales tax
2020-12-09 14:04:46 -05:00
Matt Gibson
7eaf7ab770
[Bug] Fix cipher clone yielding incorrect RevisionDate (#1031)
* Fix cipher clone yielding incorrect RevisionDate

* PR fixes

Co-authored-by: Matt Gibson <mdgibson@Matts-MBP.lan>
2020-12-07 19:35:34 -06:00
Addison Beck
0d7c876904
fixed a broken test (#1027)
* fixed a broken test

* actually didn't need this line
2020-12-04 17:37:35 -05:00
Matt Gibson
edf30974dc
Validate cipher updates with revision date (#994)
* Add last updated validation to cipher replacements

* Add AutoFixture scaffolding.

AutoDataAttributes and ICustomizations are meant to automatically
produce valid test input. Examples are the Cipher customizations,
which enforce the model's mutual exclusivity of UserId and
OrganizationId.

FixtureExtensions create a fluent way to generate SUTs. We currently
use parameter injection to fascilitate service testing, which is nicely
handled by AutoNSubstitute. However, in order to gain access to the
substitutions, we need to Freeze them onto the Fixture. The For fluent
method allows specifying a Freeze to a specific type's constructor and
optionally to a parameter name in that constructor.

* Unit tests for single Cipher update version checks

* Fix test runner

Test runner requires Microsoft.NET.Test.Sdk

* Move to provider model for SUT generation

This model differs from previous in that you no longer need to specify
which dependencies you would like access to. Instead, all are
remembered and can be queried through the sutProvider.

* User cipher provided by Put method reads

Every put method already reads all relevant ciphers from database,
there's no need to re-read them.

JSON serialization of datetimes seems to leave truncate at second
precision. Verify last known date time is within one second rather than
exact.

* validate revision date for share many requests

* Update build script to use Github environment path

Co-authored-by: Matt Gibson <mdgibson@Matts-MBP.lan>
2020-11-23 08:48:05 -06:00
Vincent Salucci
50cf16a3fb
[SSO] New user provision flow (#945)
* Initial commit of accept user during set password flow

* changed new org user from accepted to invited // moved another check to token accept function

* Revised some white space // Moved business logic to UserService

* Fixed UserServiceTest

* Removed some white-space

* Removed more white-space

* Final white-space issues
2020-10-13 15:00:33 -05:00
Addison Beck
59f8467f7c
Create sso user api (#886)
* facilitate linking/unlinking existing users from an sso enabled org

* added user_identifier to identity methods for sso

* moved sso user delete method to account controller

* fixed a broken test

* Update AccountsController.cs

* facilitate linking/unlinking existing users from an sso enabled org

* added user_identifier to identity methods for sso

* moved sso user delete method to account controller

* fixed a broken test

* added a token to the existing user sso link flow

* added a token to the existing user sso link flow

* fixed a typo

* added an event log for unlink ssoUser records

* fixed a merge issue

* fixed a busted test

* fixed a busted test

* ran a formatter over everything & changed .vscode settings in .gitignore

* chagned a variable to use string interpolation

* removed a blank line

* Changed TokenPurpose enum to a static class of strings

* code review cleanups

* formatting fix

* Changed parameters & logging for delete sso user

* changed th method used to get organization user for deleting sso user records

Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>
2020-08-26 14:12:04 -04:00
Matt Portune
51fd87df0b
Added UseSso bool to Organization (#834)
* Added UseSso bool to org

* Update fields in migration script

* bump version & check enabled flag on ssoConfig
2020-07-22 09:38:39 -04:00
Chad Scharf
5ecdc77d3f
Fix broken unit tests (#816) 2020-07-08 15:05:24 -04:00
Kyle Spearrin
8559e144c6 bump dependency minor/patch versions 2020-06-24 16:37:23 -04:00
Mike Hanson
4115b2e13e Add unit test coverage for AmazonSqsBlockIpService 2020-06-18 10:16:23 -07:00
Kyle Spearrin
aeb6e4e7d4 formatting 2020-06-18 09:57:24 -04:00
Mike Hanson
dc42be710a
Add unit test coverage for AmazonSesMailDeliveryService (#783)
* Parameterize AmazonSimpleEmailServiceClient to allow testing

* Add unit test coverage for AmazonSesMailDeliveryService
2020-06-18 09:55:46 -04:00
Mike Hanson
d4647ba8a7 Add unit test coverage for EncryptedStringAttribute 2020-06-04 13:22:34 -07:00
Matt Portune
2cf7f18858 License expiration email for self-hosted org/premium accounts 2020-05-18 16:06:34 -04:00
Kyle Spearrin
518e94f60f upgrade more lgos. remove sendgrid 2020-03-05 10:33:44 -05:00
Kyle Spearrin
cd0ec26b07 upgrade libs 2020-03-04 22:01:28 -05:00
Kyle Spearrin
462303e701 fix tests 2020-02-20 14:36:31 -05:00
Kyle Spearrin
e8054df5b4 use policies property for orgs 2020-01-15 15:00:54 -05:00
Kyle Spearrin
7fd6e4359d fix warnings 2020-01-10 08:47:58 -05:00
Kyle Spearrin
29580684a3 upgrade to aspnet core 3.1 2020-01-10 08:33:13 -05:00
Kyle Spearrin
0bc034f620 fix ctor for stripe payment service test 2019-09-20 08:04:05 -04:00
Kyle Spearrin
a2460f86ec update test sdk 2019-09-20 07:45:22 -04:00
Kyle Spearrin
1b0d9481a7 remove old smtp tests 2019-08-27 09:23:58 -04:00
Kyle Spearrin
94188fa0b5 update to net core 2.2 2019-07-23 16:38:49 -04:00
Joshua Ford
0f3fcc122d Add basic Core.Services test files (#526)
Following the paradigms illustrated in "Working Effectively with Legacy
Code", this commit introduces at least one test for each service class
implementation. This test is a simple construction test -- we just
create each service and assert that it exists. Each test suite includes
a comment instructing the developer who comes next to remove the
constructor test. We don't want to keep these tests as the codebase
matures, as they aren't useful in the longterm. They only prove that we
have that class under test.

Where test suites failed to construct their associated classes, we skip
the test but leave behind the implementation. This is by design, so that
as the constructors for those classes change, we are forced to keep the
test suite current by leaning on the compiler.
2019-07-05 20:35:54 -07:00
Kyle Spearrin
6381634a92 update libs 2019-05-11 20:56:49 -04:00
Kyle Spearrin
7d5e3736f0 fix tests 2019-05-06 21:52:21 -04:00
Kyle Spearrin
6922cff638 fix tests 2019-03-02 15:28:32 -05:00
Kyle Spearrin
8a0a39f068 upgrade nsub lib 2019-02-26 07:57:57 -05:00
Kyle Spearrin
de85dbc67c tests for org import user marrying 2019-02-19 16:27:05 -05:00
Kyle Spearrin
f0fa1e00fb formatting 2019-02-09 22:05:24 -05:00
Tomasz Jarosik
c006325850 Add few unit tests for CollectionService (#437) 2019-02-09 22:01:45 -05:00
Kyle Spearrin
3be9542cce Core.Test with example test using nsub and xunit 2019-01-09 12:31:07 -05:00