func TestReplicationTransferCreate(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.MakeXferRequest("aptrust", "chron", resp.Bag().UUID)
	xferResp := client.ReplicationTransferCreate(xfer)
	require.NotNil(t, xferResp)
	require.Nil(t, xferResp.Error)

	newXfer := xferResp.ReplicationTransfer()
	require.NotNil(t, newXfer)

	assert.Equal(t, xfer.FromNode, newXfer.FromNode)
	assert.Equal(t, xfer.ToNode, newXfer.ToNode)
	assert.Equal(t, xfer.Bag, newXfer.Bag)
	assert.NotEmpty(t, newXfer.ReplicationId)
	assert.Equal(t, xfer.FixityAlgorithm, newXfer.FixityAlgorithm)
	assert.Equal(t, xfer.FixityNonce, newXfer.FixityNonce)
	assert.Equal(t, xfer.FixityValue, newXfer.FixityValue)
	assert.Equal(t, xfer.Stored, newXfer.Stored)
	assert.Equal(t, xfer.StoreRequested, newXfer.StoreRequested)
	assert.Equal(t, xfer.Cancelled, newXfer.Cancelled)
	assert.Equal(t, xfer.CancelReason, newXfer.CancelReason)
	assert.Equal(t, xfer.Protocol, newXfer.Protocol)
	assert.Equal(t, xfer.Link, newXfer.Link)
	assert.NotEmpty(t, newXfer.CreatedAt)
	assert.NotEmpty(t, newXfer.UpdatedAt)
}
func TestReplicationTransferUpdate(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.MakeXferRequest("chron", "aptrust", bag.UUID)

	// Null out the fixity value, because once it's set, we can't change
	// it. And below, we want to set a bad fixity value to see what happens.
	xfer.FixityValue = nil
	xferResp := client.ReplicationTransferCreate(xfer)
	require.NotNil(t, xferResp)
	require.Nil(t, xferResp.Error)

	// Mark as received, with a bad fixity.
	newXfer := xferResp.ReplicationTransfer()
	newFixityValue := "1234567890"
	newXfer.UpdatedAt = newXfer.UpdatedAt.Add(1 * time.Second)
	newXfer.FixityValue = &newFixityValue

	updateResp := client.ReplicationTransferUpdate(newXfer)
	require.NotNil(t, updateResp)
	require.Nil(t, updateResp.Error)
	updatedXfer := updateResp.ReplicationTransfer()
	require.NotNil(t, updatedXfer)
	assert.False(t, updatedXfer.StoreRequested)
}