def test_log_artifact(mock_client, tmpdir): repo = AzureBlobArtifactRepository(TEST_URI, mock_client) d = tmpdir.mkdir("data") f = d.join("test.txt") f.write("hello world!") fpath = d + '/test.txt' fpath = fpath.strpath repo.log_artifact(fpath) mock_client.create_blob_from_path.assert_called_with( "container", TEST_ROOT_PATH + "/test.txt", fpath)
def test_log_artifact(mock_client, tmpdir): repo = AzureBlobArtifactRepository(TEST_URI, mock_client) d = tmpdir.mkdir("data") f = d.join("test.txt") f.write("hello world!") fpath = posixpath.join(d.strpath, "test.txt") repo.log_artifact(fpath) mock_client.get_container_client.assert_called_with("container") arg1, arg2 = mock_client.get_container_client().upload_blob.call_args[0] assert arg1 == posixpath.join(TEST_ROOT_PATH, "test.txt") # arg2 should be a filebuffer assert arg2.name == fpath