You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: gx_reauth_test.go
    path of file: ./repos/magma/feg/gateway/services/session_proxy/credit_control/gx
    
    the code of the file until where you have to start completion: /*
Copyright 2020 The Magma Authors.

This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package gx_test

import (
	"bytes"
	"errors"
	"fmt"
	"testing"

	"github.com/fiorix/go-diameter/v4/diam"
	"github.com/fiorix/go-diameter/v4/diam/dict"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/mock"

	policydb_mocks "magma/feg/gateway/policydb/mocks"
	"magma/feg/gateway/services/session_proxy/credit_control/gx"
	relay_mocks "magma/feg/gateway/services/session_proxy/relay/mocks"
	"magma/lte/cloud/go/protos"
)

// Tests data flow from feg to/from SessionProxyRespo
    
func TestReAuthRelay(t *testing.T) {
	sm, cloudRegistry := relay_mocks.StartMockSessionProxyResponder(t)
	mockPolicyClient := &policydb_mocks.PolicyDBClient{}
	handler := gx.GetGxReAuthHandler(cloudRegistry, mockPolicyClient)

	imsi := "IMSI000000000000001"
	sessionID := fmt.Sprintf("%s-%d", imsi, 1234)
	// We're not putting any rules in the request, those code paths are covered
	// by model conversion tests
	mockPolicyClient.On("GetRuleIDsForBaseNames", mock.Anything).Return([]string{})

	// Happy path
	req := &gx.PolicyReAuthRequest{SessionID: sessionID}
	sm.On("PolicyReAuth", mock.Anything, &protos.PolicyReAuthRequest{SessionId: sessionID, Imsi: imsi}).
		Return(&protos.PolicyReAuthAnswer{SessionId: "mock_ret"}, nil).Once()
	actual := handler(req)
	// Handler should use session ID from request instead of response
	assert.Equal(t, &gx.PolicyReAuthAnswer{SessionID: sessionID, ResultCode: diam.Success, RuleReports: []*gx.ChargingRuleReport{}}, actual)

	// Bad session ID
	req = &gx.PolicyReAuthRequest{SessionID: "bad"}
	actual = handler(req)
	assert.Equal(t, &gx.PolicyReAuthAnswer{SessionID: "bad", ResultCode: diam.UnknownSessionID}, actual)

	// Error from client
	req = &gx.PolicyReAuthRequest{SessionID: sessionID}
	sm.On("PolicyReAuth", mock.Anything, &protos.PolicyReAuthRequest{SessionId: sessionID, Imsi: imsi}).
		Return(nil, errors.New("oops")).Once()
	actual = handler(req)
	assert.Equal(t, &gx.PolicyReAuthAnswer{SessionID: sessionID, ResultCode: diam.UnableToDeliver}, actual)
	sm.AssertExpectations(t)
}