fn plasma_client_get()

in plasma-store/src/tests.rs [69:87]


fn plasma_client_get() {
    let pc = build_client();

    // put object into the store
    let oid = ObjectId::rand();
    let data = [1u8, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
    let meta = [1, 2, 3, 4];
    pc.create_and_seal(oid.clone(), &data, &meta).unwrap();

    // get object out of the store and make sure data and metadata are the same
    let ob = pc.get(oid, 5).unwrap().unwrap();
    assert_eq!(data, ob.data(), "object data should match");
    assert_eq!(meta, ob.meta(), "object metadata should match");
    assert_eq!(false, ob.is_mutable(), "object should not be mutable");

    // if we try to retrieve a non-existent object, we should get None back
    let ob = pc.get(ObjectId::rand(), 5).unwrap();
    assert!(ob.is_none());
}