Example #1
0
func TestRestoreTransferUpdate(t *testing.T) {
	if runRestTests(t) == false {
		return
	}
	client := getClient(t)

	// The transfer request must refer to an actual bag,
	// so let's make a bag...
	bag := testutil.MakeDPNBag()
	resp := client.DPNBagCreate(bag)
	require.NotNil(t, resp)
	require.Nil(t, resp.Error)

	// Make sure we can create a transfer request.
	xfer := testutil.MakeRestoreRequest("chron", "aptrust", bag.UUID)
	createResp := client.RestoreTransferCreate(xfer)
	require.NotNil(t, createResp)
	require.Nil(t, createResp.Error)

	newXfer := createResp.RestoreTransfer()
	require.NotNil(t, newXfer)

	// Accept this one...
	newXfer.Accepted = true

	updateResp := client.RestoreTransferUpdate(newXfer)
	require.NotNil(t, updateResp)
	require.Nil(t, updateResp.Error)

	updatedXfer := updateResp.RestoreTransfer()
	require.NotNil(t, updatedXfer)

	assert.True(t, updatedXfer.Accepted)
}
Example #2
0
func TestRestoreTransferCreate(t *testing.T) {
	if runRestTests(t) == false {
		return
	}
	client := getClient(t)

	// The transfer request must refer to an actual bag,
	// so let's make a bag...
	bag := testutil.MakeDPNBag()
	resp := client.DPNBagCreate(bag)
	require.NotNil(t, resp)
	require.Nil(t, resp.Error)

	// Make sure we can create a transfer request.
	xfer := testutil.MakeRestoreRequest("tdr", "aptrust", bag.UUID)
	createResp := client.RestoreTransferCreate(xfer)
	require.NotNil(t, createResp)
	require.Nil(t, createResp.Error)

	createdXfer := createResp.RestoreTransfer()
	require.NotNil(t, createdXfer)
	assert.Equal(t, xfer.FromNode, createdXfer.FromNode)
	assert.Equal(t, xfer.ToNode, createdXfer.ToNode)
	assert.Equal(t, xfer.Bag, createdXfer.Bag)
	assert.NotEmpty(t, createdXfer.RestoreId)
	assert.Equal(t, xfer.Protocol, createdXfer.Protocol)
	assert.Equal(t, xfer.Link, createdXfer.Link)
	assert.NotEmpty(t, createdXfer.CreatedAt)
	assert.NotEmpty(t, createdXfer.UpdatedAt)
}