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: job_endpoints_test.go
    path of file: ./repos/erda/internal/tools/orchestrator/scheduler/endpoints
    
    the code of the file until where you have to start completion: // Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// 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 endpoints

import (
	"bytes"
	"context"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
	"reflect"
	"testing"

	"bou.ke/monkey"
	"github.com/pkg/errors"

	"github.com/erda-project/erda/apistructs"
	"github.com/erda-project/erda/internal/tools/orchestrator/scheduler/impl/cap"
	"github.com/erda-project/erda/internal/tools/orchestrator/scheduler/impl/cluster"
	"github.com/erda-project/erda/internal/tools/orchestrator/scheduler/impl/clusterinfo"
	"github.com/erda-project/erda/internal/tools/orchestrator/scheduler/impl/instanceinfo"
	"github.com/erda-project/erda/internal/tools/orchestrator/scheduler/impl/job"
	"github.com/erda-project/erda/internal/tools/orchestrator/scheduler/impl/labelmanager"
	"github.com/erda-project/erda/internal/tools/orchestrator/scheduler/impl/resourceinfo"
	"github.com/erda-project/erda/internal/tools/orchestrator/scheduler/impl/servicegroup"
	"github.c
    
func TestHTTPEndpoints_JobInspect(t *testing.T) {
	type fields struct {
		volumeImpl        volume.Volume
		serviceGroupImpl  servicegroup.ServiceGroup
		clusterImpl       cluster.Cluster
		job               job.Job
		labelManager      labelmanager.LabelManager
		instanceinfoImpl  instanceinfo.InstanceInfo
		clusterinfoImpl   clusterinfo.ClusterInfo
		componentinfoImpl instanceinfo.ComponentInfo
		resourceinfoImpl  resourceinfo.ResourceInfo
		Cap               cap.Cap
	}

	jobImpl := &job.JobImpl{}

	type args struct {
		ctx  context.Context
		r    *http.Request
		vars map[string]string
	}
	tests := []struct {
		name    string
		fields  fields
		args    args
		want    httpserver.Responser
		wantErr bool
	}{
		// TODO: Add test cases.
		{
			name: "Test_01",
			fields: fields{
				job: jobImpl,
			},
			args: args{
				vars: map[string]string{
					"namespace": "testnamespace",
					"name":      "testjob",
				},
			},
			want: httpserver.HTTPResponse{
				Status: http.StatusOK,
				Content: apistructs.Job{
					JobFromUser: apistructs.JobFromUser{
						Name:      "testjob",
						Namespace: "testnamespace",
					},
				},
			},
			wantErr: false,
		},
		{
			name: "Test_02",
			fields: fields{
				job: jobImpl,
			},
			args: args{
				vars: map[string]string{
					"name": "testjob",
				},
			},
			want: httpserver.HTTPResponse{
				Status:  http.StatusBadRequest,
				Content: "failed to inspect job, empty name or namespace",
			},
			wantErr: false,
		},
		{
			name: "Test_03",
			fields: fields{
				job: jobImpl,
			},
			args: args{
				vars: map[string]string{
					"namespace": "testnamespace",
					"name":      "testjob",
				},
			},
			want: httpserver.HTTPResponse{
				Status:  http.StatusInternalServerError,
				Content: "failed to inspect job, err: failed",
			},
			wantErr: false,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			h := &HTTPEndpoints{
				volumeImpl:        tt.fields.volumeImpl,
				ServiceGroupImpl:  tt.fields.serviceGroupImpl,
				clusterImpl:       tt.fields.clusterImpl,
				Job:               tt.fields.job,
				labelManager:      tt.fields.labelManager,
				instanceinfoImpl:  tt.fields.instanceinfoImpl,
				ClusterinfoImpl:   tt.fields.clusterinfoImpl,
				componentinfoImpl: tt.fields.componentinfoImpl,
				resourceinfoImpl:  tt.fields.resourceinfoImpl,
				Cap:               tt.fields.Cap,
			}

			os.Setenv(apistructs.ENABLE_SPECIFIED_K8S_NAMESPACE, "testnamespace")
			os.Getenv(apistructs.ENABLE_SPECIFIED_K8S_NAMESPACE)
			defer os.Unsetenv(apistructs.ENABLE_SPECIFIED_K8S_NAMESPACE)

			patch1 := monkey.PatchInstanceMethod(reflect.TypeOf(tt.fields.job), "Inspect", func(_ *job.JobImpl, namespace, name string) (apistructs.Job, error) {
				if tt.name == "Test_01" {
					return apistructs.Job{
						JobFromUser: apistructs.JobFromUser{
							Namespace: "testnamespace",
							Name:      "testjob",
						},
					}, nil
				}

				return apistructs.Job{}, errors.Errorf("failed")
			})
			defer patch1.Unpatch()

			got, err := h.JobInspect(tt.args.ctx, tt.args.r, tt.args.vars)
			if (err != nil) != tt.wantErr {
				t.Errorf("JobInspect() error = %v, wantErr %v", err, tt.wantErr)
				return
			}
			if !reflect.DeepEqual(got, tt.want) {
				t.Errorf("JobInspect() got = %#v, want %#v", got, tt.want)
			}
		})
	}
}