Exemplo n.º 1
0
def test_add_single_from_str_with_dir(client, cleanup_pins):
    res = client.add(FAKE_FILE1_PATH, wrap_with_directory=True)
    assert pytest_cid.match(FAKE_FILE1_DIR_HASH) == res

    dir_hash = None
    for item in res:
        if item["Name"] == "":
            dir_hash = item["Hash"]
    assert dir_hash in client.pin.ls(type="recursive")["Keys"]
Exemplo n.º 2
0
def test_only_hash_file(client):
	client.repo.gc()
	
	res = client.add(FAKE_FILE1_PATH, only_hash=True)
	
	assert pytest_cid.match(FAKE_FILE1_HASH) == res
	
	assert res["Hash"] not in client.pin.ls(type="recursive")
	assert res["Hash"] not in list(map(lambda i: i["Ref"], client.unstable.refs.local()))
Exemplo n.º 3
0
def test_add_relative_path(client, cleanup_pins):
    res = client.add(calc_path_rel_to_cwd(FAKE_FILE1_PATH))
    assert pytest_cid.match(FAKE_FILE1_HASH) == res
    assert res["Hash"] in client.pin.ls(type="recursive")["Keys"]
Exemplo n.º 4
0
def check_add_with_raw_leaves(client, res):
    assert pytest_cid.match(FAKE_FILE1_RAW_LEAVES_HASH) == res
    assert res["Hash"] in client.pin.ls(type="recursive")["Keys"]
Exemplo n.º 5
0
def test_add_multiple_from_list(client, cleanup_pins):
    res = client.add(FAKE_FILE1_PATH, FAKE_FILE2_PATH)
    assert pytest_cid.match(FAKE_FILES_HASH) == res