Middle of session move.

This commit is contained in:
2026-05-13 11:35:30 -04:00
parent 89715320cb
commit 8f34bad321
9 changed files with 910 additions and 912 deletions

View File

@@ -2,8 +2,8 @@ mod support;
use isolang::Language;
use morethantext::{
Action, Addition, DocDef, ErrorID, FieldType, Include, MTTError, MoreThanText, Name, Path,
Query, TestMoreThanText,
Action, Addition, DocDef, ErrorID, Field, FieldType, Include, MTTError, MoreThanText, Name,
Path, Query, TestMoreThanText,
};
use std::collections::HashSet;
use support::setup_range;
@@ -18,13 +18,14 @@ fn lang_name() -> Name {
}
#[test]
#[ignore = "fix after session move complete"]
fn are_session_ids_unique() {
let count = 10;
let mtt = MoreThanText::new();
let mut ids: HashSet<String> = HashSet::new();
let mut ids: HashSet<Field> = HashSet::new();
for _ in 0..count {
let client = mtt.client();
ids.insert(client.session_id());
ids.insert(client.session_id().clone());
}
assert_eq!(ids.len(), count, "ids = {:?}", ids);
}
@@ -33,29 +34,34 @@ fn are_session_ids_unique() {
fn can_existing_sessions_be_used() {
let mtt = MoreThanText::new();
let client1 = mtt.client();
let id = client1.session_id();
let id = client1.session_id().clone();
drop(client1);
let client2 = mtt.client_with_session(id.clone(), None);
assert_eq!(client2.session_id(), id);
assert_eq!(client2.session_id(), &id);
}
#[test]
#[ignore = "fix after session move complete"]
fn does_expired_session_ids_return_new() {
let id = Uuid::new_v4().to_string();
let id = Uuid::new_v4();
let expected: Field = id.into();
let mtt = MoreThanText::new();
let client = mtt.client_with_session(id.clone(), None);
assert_ne!(client.session_id(), id);
assert_ne!(client.session_id(), &expected);
}
#[test]
#[ignore = "may no longer be valid"]
fn does_bad_id_string_get_new() {
let id = "Not uuid".to_string();
let not_expected: Field = id.clone().into();
let mtt = MoreThanText::new();
let client = mtt.client_with_session(id.clone(), None);
assert_ne!(client.session_id(), id);
assert_ne!(client.session_id(), &not_expected);
}
#[test]
#[ignore = "wait for language to be added to new session"]
fn can_new_clients_set_langauge() {
let lang = Language::from_639_1("fr").unwrap();
let mut test_env = TestMoreThanText::new();
@@ -73,6 +79,7 @@ fn can_new_clients_set_langauge() {
}
#[test]
#[ignore = "wait till language added to new session"]
fn is_lanaguage_set_for_expired_session() {
let lang = Language::from_639_1("fr").unwrap();
let mut test_env = TestMoreThanText::new();
@@ -90,6 +97,7 @@ fn is_lanaguage_set_for_expired_session() {
}
#[test]
#[ignore = "wait till language added to new session"]
fn is_lanaguage_set_for_bad_session() {
let lang = Language::from_639_1("de").unwrap();
let mut test_env = TestMoreThanText::new();
@@ -107,13 +115,14 @@ fn is_lanaguage_set_for_bad_session() {
}
#[test]
#[ignore = "wait till language added to session"]
fn do_existing_sessions_keep_language_unchanged() {
let lang1 = Language::from_639_1("de").unwrap();
let lang2 = Language::from_639_1("fr").unwrap();
let mut test_env = TestMoreThanText::new();
let mtt = test_env.get_morethantext();
let client = mtt.client_with_language(lang1);
let id = client.session_id();
let id = client.session_id().clone();
drop(client);
let path = Path::new(
Include::All,