MCPcopy Index your code
hub / github.com/endbasic/endbasic / test_login_and_mount_other_user

Function test_login_and_mount_other_user

client/src/drive.rs:323–379  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

321
322 #[test]
323 fn test_login_and_mount_other_user() {
324 let mut t = ClientTester::default();
325 t.get_service().borrow_mut().add_mock_login(
326 "mock-username",
327 "mock-password",
328 Ok(LoginResponse { access_token: AccessToken::new("random token"), motd: vec![] }),
329 );
330 t.get_service().borrow_mut().add_mock_get_files(
331 "mock-username",
332 Ok(GetFilesResponse {
333 files: vec![DirectoryEntry {
334 filename: "one".to_owned(),
335 mtime: 1622556024,
336 length: 15,
337 }],
338 disk_quota: Some(DiskSpace::new(10000, 100).into()),
339 disk_free: Some(DiskSpace::new(123, 45).into()),
340 }),
341 );
342 t.get_service().borrow_mut().add_mock_get_files(
343 "user2",
344 Ok(GetFilesResponse {
345 files: vec![DirectoryEntry {
346 filename: "two".to_owned(),
347 mtime: 1622556024,
348 length: 17,
349 }],
350 disk_quota: None,
351 disk_free: None,
352 }),
353 );
354 t.run(format!(
355 r#"LOGIN "{}", "{}": MOUNT "cloud://user2" AS "x": DIR "cloud:/": DIR "x:/""#,
356 "mock-username", "mock-password",
357 ))
358 .expect_access_token("random token")
359 .expect_prints([
360 "",
361 " Directory of CLOUD:/",
362 "",
363 " Modified Size Name",
364 " 2021-06-01 14:00 15 one",
365 "",
366 " 1 file(s), 15 bytes",
367 " 123 of 10000 bytes free",
368 "",
369 "",
370 " Directory of X:/",
371 "",
372 " Modified Size Name",
373 " 2021-06-01 14:00 17 two",
374 "",
375 " 1 file(s), 17 bytes",
376 "",
377 ])
378 .check();
379 }
380}

Callers

nothing calls this directly

Calls 7

add_mock_loginMethod · 0.80
get_serviceMethod · 0.80
add_mock_get_filesMethod · 0.80
expect_access_tokenMethod · 0.80
checkMethod · 0.45
expect_printsMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected