mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-11-13 23:56:05 +02:00
Run the Bitwarden SDK's live end-to-end tests against Vaultwarden (#7953)
* Add a test seeder behind the unsafe_test_mode feature For the end-to-end tests: with the feature, /test/seeder answers the calls the SDK's live tests make to a seeder API (POST /seed with SingleUserScene or TestVectorUserScene, DELETE /seed/<playId>), behind HTTP basic auth from TEST_SEEDER_USERNAME and TEST_SEEDER_PASSWORD, and 404 without them. It creates accounts without any checks, so no release build has the feature. CI builds and tests it with sqlite. * Run the SDK live tests against the test seeder tools/sdk-live-tests/run.sh builds the server with unsafe_test_mode and runs the live tests of the SDK's e2e/wasm suite. For SDK versions whose tests log in to one given account, each user test vector with a master password is seeded with its vault on a fresh server; for versions that seed their own accounts, the tests get the seeder's address. Every vector runs, then a summary. The workflow runs it by hand, and on changes to the seeder or the runner. * Run the SDK live tests daily * Test the published SDK package by default in the SDK live tests
This commit is contained in:
1 parent
730048e3c6
commit
d2d1294098
12 files changed
+997
-1
No files matched your search
@@ -126,6 +126,23 @@ async fn enforce_disable_hide_email_policy(data: &SendData, headers: &Headers, c
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Stores a text Send that is already encrypted, as [`create_send`] does, for the test seeder (`unsafe_test_mode`).
|
||||
/// Its deletion date becomes a week from now: a recorded one can be years ahead, more than a Send may be.
|
||||
#[cfg(feature = "unsafe_test_mode")]
|
||||
pub async fn seed_send(mut encrypted: Value, user_id: &UserId, conn: &DbConn) -> ApiResult<SendId> {
|
||||
let Some(fields) = encrypted.as_object_mut() else {
|
||||
err!("A seeded Send has to be a JSON object")
|
||||
};
|
||||
fields.insert("deletionDate".to_owned(), serde_json::to_value(Utc::now() + TimeDelta::try_days(7).unwrap())?);
|
||||
let data: SendData = serde_json::from_value(encrypted)?;
|
||||
if data.r#type != SendType::Text as i32 {
|
||||
err!("Only text Sends can be seeded: a file Send needs its file")
|
||||
}
|
||||
let mut send = create_send(data, user_id.clone())?;
|
||||
send.save(conn).await?;
|
||||
Ok(send.uuid)
|
||||
}
|
||||
|
||||
fn create_send(data: SendData, user_id: UserId) -> ApiResult<Send> {
|
||||
let data_val = if data.r#type == SendType::Text as i32 {
|
||||
data.text
|
||||
|
||||
Reference in new issue
Block a user