github.com/gophercloud/gophercloud@v1.11.0/openstack/container/v1/capsules/testing/fixtures_test.go (about)

     1  package testing
     2  
     3  import (
     4  	"fmt"
     5  	"net/http"
     6  	"testing"
     7  
     8  	"github.com/gophercloud/gophercloud/openstack/container/v1/capsules"
     9  	th "github.com/gophercloud/gophercloud/testhelper"
    10  	fakeclient "github.com/gophercloud/gophercloud/testhelper/client"
    11  )
    12  
    13  // ValidJSONTemplate is a valid OpenStack Capsule template in JSON format
    14  const ValidJSONTemplate = `
    15  {
    16    "capsuleVersion": "beta",
    17    "kind": "capsule",
    18    "metadata": {
    19      "labels": {
    20        "app": "web",
    21        "app1": "web1"
    22      },
    23      "name": "template"
    24    },
    25    "spec": {
    26      "restartPolicy": "Always",
    27      "containers": [
    28        {
    29          "command": [
    30            "/bin/bash"
    31          ],
    32          "env": {
    33            "ENV1": "/usr/local/bin",
    34            "ENV2": "/usr/bin"
    35          },
    36          "image": "ubuntu",
    37          "imagePullPolicy": "ifnotpresent",
    38          "ports": [
    39            {
    40              "containerPort": 80,
    41              "hostPort": 80,
    42              "name": "nginx-port",
    43              "protocol": "TCP"
    44            }
    45          ],
    46          "resources": {
    47            "requests": {
    48              "cpu": 1,
    49              "memory": 1024
    50            }
    51          },
    52          "workDir": "/root"
    53        }
    54      ]
    55    }
    56  }
    57  `
    58  
    59  // ValidYAMLTemplate is a valid OpenStack Capsule template in YAML format
    60  const ValidYAMLTemplate = `
    61  capsuleVersion: beta
    62  kind: capsule
    63  metadata:
    64    name: template
    65    labels:
    66      app: web
    67      app1: web1
    68  spec:
    69    restartPolicy: Always
    70    containers:
    71    - image: ubuntu
    72      command:
    73        - "/bin/bash"
    74      imagePullPolicy: ifnotpresent
    75      workDir: /root
    76      ports:
    77        - name: nginx-port
    78          containerPort: 80
    79          hostPort: 80
    80          protocol: TCP
    81      resources:
    82        requests:
    83          cpu: 1
    84          memory: 1024
    85      env:
    86        ENV1: /usr/local/bin
    87        ENV2: /usr/bin
    88  `
    89  
    90  // ValidJSONTemplateParsed is the expected parsed version of ValidJSONTemplate
    91  var ValidJSONTemplateParsed = map[string]interface{}{
    92  	"capsuleVersion": "beta",
    93  	"kind":           "capsule",
    94  	"metadata": map[string]interface{}{
    95  		"name": "template",
    96  		"labels": map[string]string{
    97  			"app":  "web",
    98  			"app1": "web1",
    99  		},
   100  	},
   101  	"spec": map[string]interface{}{
   102  		"restartPolicy": "Always",
   103  		"containers": []map[string]interface{}{
   104  			{
   105  				"image": "ubuntu",
   106  				"command": []interface{}{
   107  					"/bin/bash",
   108  				},
   109  				"imagePullPolicy": "ifnotpresent",
   110  				"workDir":         "/root",
   111  				"ports": []interface{}{
   112  					map[string]interface{}{
   113  						"name":          "nginx-port",
   114  						"containerPort": float64(80),
   115  						"hostPort":      float64(80),
   116  						"protocol":      "TCP",
   117  					},
   118  				},
   119  				"resources": map[string]interface{}{
   120  					"requests": map[string]interface{}{
   121  						"cpu":    float64(1),
   122  						"memory": float64(1024),
   123  					},
   124  				},
   125  				"env": map[string]interface{}{
   126  					"ENV1": "/usr/local/bin",
   127  					"ENV2": "/usr/bin",
   128  				},
   129  			},
   130  		},
   131  	},
   132  }
   133  
   134  // ValidYAMLTemplateParsed is the expected parsed version of ValidYAMLTemplate
   135  var ValidYAMLTemplateParsed = map[string]interface{}{
   136  	"capsuleVersion": "beta",
   137  	"kind":           "capsule",
   138  	"metadata": map[string]interface{}{
   139  		"name": "template",
   140  		"labels": map[string]string{
   141  			"app":  "web",
   142  			"app1": "web1",
   143  		},
   144  	},
   145  	"spec": map[interface{}]interface{}{
   146  		"restartPolicy": "Always",
   147  		"containers": []map[interface{}]interface{}{
   148  			{
   149  				"image": "ubuntu",
   150  				"command": []interface{}{
   151  					"/bin/bash",
   152  				},
   153  				"imagePullPolicy": "ifnotpresent",
   154  				"workDir":         "/root",
   155  				"ports": []interface{}{
   156  					map[interface{}]interface{}{
   157  						"name":          "nginx-port",
   158  						"containerPort": 80,
   159  						"hostPort":      80,
   160  						"protocol":      "TCP",
   161  					},
   162  				},
   163  				"resources": map[interface{}]interface{}{
   164  					"requests": map[interface{}]interface{}{
   165  						"cpu":    1,
   166  						"memory": 1024,
   167  					},
   168  				},
   169  				"env": map[interface{}]interface{}{
   170  					"ENV1": "/usr/local/bin",
   171  					"ENV2": "/usr/bin",
   172  				},
   173  			},
   174  		},
   175  	},
   176  }
   177  
   178  const CapsuleGetBody_OldTime = `
   179  {
   180    "uuid": "cc654059-1a77-47a3-bfcf-715bde5aad9e",
   181    "status": "Running",
   182    "user_id": "d33b18c384574fd2a3299447aac285f0",
   183    "project_id": "6b8ffef2a0ac42ee87887b9cc98bdf68",
   184    "cpu": 1,
   185    "memory": "1024M",
   186    "meta_name": "test",
   187    "meta_labels": {"web": "app"},
   188    "created_at": "2018-01-12 09:37:25+00:00",
   189    "updated_at": "2018-01-12 09:37:26+00:00",
   190    "links": [
   191      {
   192        "href": "http://10.10.10.10/v1/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
   193        "rel": "self"
   194      },
   195      {
   196        "href": "http://10.10.10.10/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
   197        "rel": "bookmark"
   198      }
   199    ],
   200    "capsule_version": "beta",
   201    "restart_policy":  "always",
   202    "containers_uuids": ["1739e28a-d391-4fd9-93a5-3ba3f29a4c9b"],
   203    "addresses": {
   204      "b1295212-64e1-471d-aa01-25ff46f9818d": [
   205        {
   206          "version": 4,
   207          "preserve_on_delete": false,
   208          "addr": "172.24.4.11",
   209          "port": "8439060f-381a-4386-a518-33d5a4058636",
   210          "subnet_id": "4a2bcd64-93ad-4436-9f48-3a7f9b267e0a"
   211        }
   212      ]
   213    },
   214    "volumes_info": {
   215      "67618d54-dd55-4f7e-91b3-39ffb3ba7f5f": [
   216        "1739e28a-d391-4fd9-93a5-3ba3f29a4c9b"
   217      ]
   218    },
   219    "host": "test-host",
   220    "status_reason": "No reason",
   221    "containers": [
   222      {
   223        "addresses": {
   224          "b1295212-64e1-471d-aa01-25ff46f9818d": [
   225            {
   226              "version": 4,
   227              "preserve_on_delete": false,
   228              "addr": "172.24.4.11",
   229              "port": "8439060f-381a-4386-a518-33d5a4058636",
   230              "subnet_id": "4a2bcd64-93ad-4436-9f48-3a7f9b267e0a"
   231            }
   232          ]
   233        },
   234        "image": "test",
   235        "labels": {"foo": "bar"},
   236        "created_at": "2018-01-12 09:37:25+00:00",
   237        "updated_at": "2018-01-12 09:37:26+00:00",
   238        "started_at": "2018-01-12 09:37:26+00:00",
   239        "workdir": "/root",
   240        "disk": 0,
   241        "security_groups": ["default"],
   242        "image_pull_policy": "ifnotpresent",
   243        "task_state": "Creating",
   244        "user_id": "d33b18c384574fd2a3299447aac285f0",
   245        "project_id": "6b8ffef2a0ac42ee87887b9cc98bdf68",
   246        "uuid": "1739e28a-d391-4fd9-93a5-3ba3f29a4c9b",
   247        "hostname": "test-hostname",
   248        "environment": {"USER1": "test"},
   249        "memory": "1024M",
   250        "status": "Running",
   251        "auto_remove": false,
   252        "auto_heal": false,
   253        "host": "test-host",
   254        "image_driver": "docker",
   255        "status_detail": "Just created",
   256        "status_reason": "No reason",
   257        "name": "test-demo-omicron-13",
   258        "restart_policy": {
   259          "MaximumRetryCount": "0",
   260          "Name": "always"
   261        },
   262        "ports": [80],
   263        "command": ["testcmd"],
   264        "runtime": "runc",
   265        "cpu": 1,
   266        "interactive": true
   267      }
   268    ]
   269  }`
   270  
   271  const CapsuleGetBody_NewTime = `
   272  {
   273    "uuid": "cc654059-1a77-47a3-bfcf-715bde5aad9e",
   274    "status": "Running",
   275    "user_id": "d33b18c384574fd2a3299447aac285f0",
   276    "project_id": "6b8ffef2a0ac42ee87887b9cc98bdf68",
   277    "cpu": 1,
   278    "memory": "1024M",
   279    "meta_name": "test",
   280    "meta_labels": {"web": "app"},
   281    "created_at": "2018-01-12 09:37:25",
   282    "updated_at": "2018-01-12 09:37:26",
   283    "links": [
   284      {
   285        "href": "http://10.10.10.10/v1/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
   286        "rel": "self"
   287      },
   288      {
   289        "href": "http://10.10.10.10/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
   290        "rel": "bookmark"
   291      }
   292    ],
   293    "capsule_version": "beta",
   294    "restart_policy":  "always",
   295    "containers_uuids": ["1739e28a-d391-4fd9-93a5-3ba3f29a4c9b"],
   296    "addresses": {
   297      "b1295212-64e1-471d-aa01-25ff46f9818d": [
   298        {
   299          "version": 4,
   300          "preserve_on_delete": false,
   301          "addr": "172.24.4.11",
   302          "port": "8439060f-381a-4386-a518-33d5a4058636",
   303          "subnet_id": "4a2bcd64-93ad-4436-9f48-3a7f9b267e0a"
   304        }
   305      ]
   306    },
   307    "volumes_info": {
   308      "67618d54-dd55-4f7e-91b3-39ffb3ba7f5f": [
   309        "1739e28a-d391-4fd9-93a5-3ba3f29a4c9b"
   310      ]
   311    },
   312    "host": "test-host",
   313    "status_reason": "No reason",
   314    "containers": [
   315      {
   316        "addresses": {
   317          "b1295212-64e1-471d-aa01-25ff46f9818d": [
   318            {
   319              "version": 4,
   320              "preserve_on_delete": false,
   321              "addr": "172.24.4.11",
   322              "port": "8439060f-381a-4386-a518-33d5a4058636",
   323              "subnet_id": "4a2bcd64-93ad-4436-9f48-3a7f9b267e0a"
   324            }
   325          ]
   326        },
   327        "image": "test",
   328        "labels": {"foo": "bar"},
   329        "created_at": "2018-01-12 09:37:25",
   330        "updated_at": "2018-01-12 09:37:26",
   331        "started_at": "2018-01-12 09:37:26",
   332        "workdir": "/root",
   333        "disk": 0,
   334        "security_groups": ["default"],
   335        "image_pull_policy": "ifnotpresent",
   336        "task_state": "Creating",
   337        "user_id": "d33b18c384574fd2a3299447aac285f0",
   338        "project_id": "6b8ffef2a0ac42ee87887b9cc98bdf68",
   339        "uuid": "1739e28a-d391-4fd9-93a5-3ba3f29a4c9b",
   340        "hostname": "test-hostname",
   341        "environment": {"USER1": "test"},
   342        "memory": "1024M",
   343        "status": "Running",
   344        "auto_remove": false,
   345        "auto_heal": false,
   346        "host": "test-host",
   347        "image_driver": "docker",
   348        "status_detail": "Just created",
   349        "status_reason": "No reason",
   350        "name": "test-demo-omicron-13",
   351        "restart_policy": {
   352          "MaximumRetryCount": "0",
   353          "Name": "always"
   354        },
   355        "ports": [80],
   356        "command": ["testcmd"],
   357        "runtime": "runc",
   358        "cpu": 1,
   359        "interactive": true
   360      }
   361    ]
   362  }`
   363  
   364  const CapsuleListBody = `
   365  {
   366    "capsules": [
   367      {
   368        "uuid": "cc654059-1a77-47a3-bfcf-715bde5aad9e",
   369        "status": "Running",
   370        "user_id": "d33b18c384574fd2a3299447aac285f0",
   371        "project_id": "6b8ffef2a0ac42ee87887b9cc98bdf68",
   372        "cpu": 1,
   373        "memory": "1024M",
   374        "meta_name": "test",
   375        "meta_labels": {"web": "app"},
   376        "created_at": "2018-01-12 09:37:25+00:00",
   377        "updated_at": "2018-01-12 09:37:25+01:00",
   378        "links": [
   379          {
   380            "href": "http://10.10.10.10/v1/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
   381            "rel": "self"
   382          },
   383          {
   384            "href": "http://10.10.10.10/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
   385            "rel": "bookmark"
   386          }
   387        ],
   388        "capsule_version": "beta",
   389        "restart_policy":  "always",
   390        "containers_uuids": ["1739e28a-d391-4fd9-93a5-3ba3f29a4c9b", "d1469e8d-bcbc-43fc-b163-8b9b6a740930"],
   391        "addresses": {
   392          "b1295212-64e1-471d-aa01-25ff46f9818d": [
   393            {
   394              "version": 4,
   395              "preserve_on_delete": false,
   396              "addr": "172.24.4.11",
   397              "port": "8439060f-381a-4386-a518-33d5a4058636",
   398              "subnet_id": "4a2bcd64-93ad-4436-9f48-3a7f9b267e0a"
   399            }
   400          ]
   401        },
   402        "volumes_info": {
   403          "67618d54-dd55-4f7e-91b3-39ffb3ba7f5f": [
   404            "1739e28a-d391-4fd9-93a5-3ba3f29a4c9b"
   405          ]
   406        },
   407        "host": "test-host",
   408        "status_reason": "No reason"
   409      }
   410    ]
   411  }`
   412  
   413  const CapsuleV132ListBody = `
   414  {
   415    "capsules": [
   416      {
   417        "uuid": "cc654059-1a77-47a3-bfcf-715bde5aad9e",
   418        "status": "Running",
   419        "user_id": "d33b18c384574fd2a3299447aac285f0",
   420        "project_id": "6b8ffef2a0ac42ee87887b9cc98bdf68",
   421        "cpu": 1,
   422        "memory": "1024M",
   423        "name": "test",
   424        "labels": {"web": "app"},
   425        "created_at": "2018-01-12 09:37:25",
   426        "updated_at": "2018-01-12 09:37:25",
   427        "links": [
   428          {
   429            "href": "http://10.10.10.10/v1/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
   430            "rel": "self"
   431          },
   432          {
   433            "href": "http://10.10.10.10/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
   434            "rel": "bookmark"
   435          }
   436        ],
   437        "restart_policy": {
   438          "MaximumRetryCount": "0",
   439          "Name": "always"
   440        },
   441        "addresses": {
   442          "b1295212-64e1-471d-aa01-25ff46f9818d": [
   443            {
   444              "version": 4,
   445              "preserve_on_delete": false,
   446              "addr": "172.24.4.11",
   447              "port": "8439060f-381a-4386-a518-33d5a4058636",
   448              "subnet_id": "4a2bcd64-93ad-4436-9f48-3a7f9b267e0a"
   449            }
   450          ]
   451        },
   452        "host": "test-host",
   453        "status_reason": "No reason"
   454      }
   455    ]
   456  }`
   457  
   458  var ExpectedContainer1 = capsules.Container{
   459  	Name:      "test-demo-omicron-13",
   460  	UUID:      "1739e28a-d391-4fd9-93a5-3ba3f29a4c9b",
   461  	UserID:    "d33b18c384574fd2a3299447aac285f0",
   462  	ProjectID: "6b8ffef2a0ac42ee87887b9cc98bdf68",
   463  	CPU:       float64(1),
   464  	Memory:    "1024M",
   465  	Host:      "test-host",
   466  	Status:    "Running",
   467  	Image:     "test",
   468  	Labels: map[string]string{
   469  		"foo": "bar",
   470  	},
   471  	WorkDir: "/root",
   472  	Disk:    0,
   473  	Command: []string{
   474  		"testcmd",
   475  	},
   476  	Ports: []int{
   477  		80,
   478  	},
   479  	SecurityGroups: []string{
   480  		"default",
   481  	},
   482  	ImagePullPolicy: "ifnotpresent",
   483  	Runtime:         "runc",
   484  	TaskState:       "Creating",
   485  	HostName:        "test-hostname",
   486  	Environment: map[string]string{
   487  		"USER1": "test",
   488  	},
   489  	StatusReason: "No reason",
   490  	StatusDetail: "Just created",
   491  	ImageDriver:  "docker",
   492  	Interactive:  true,
   493  	AutoRemove:   false,
   494  	AutoHeal:     false,
   495  	RestartPolicy: map[string]string{
   496  		"MaximumRetryCount": "0",
   497  		"Name":              "always",
   498  	},
   499  	Addresses: map[string][]capsules.Address{
   500  		"b1295212-64e1-471d-aa01-25ff46f9818d": {
   501  			{
   502  				PreserveOnDelete: false,
   503  				Addr:             "172.24.4.11",
   504  				Port:             "8439060f-381a-4386-a518-33d5a4058636",
   505  				Version:          float64(4),
   506  				SubnetID:         "4a2bcd64-93ad-4436-9f48-3a7f9b267e0a",
   507  			},
   508  		},
   509  	},
   510  }
   511  
   512  var ExpectedCapsule = capsules.Capsule{
   513  	UUID:      "cc654059-1a77-47a3-bfcf-715bde5aad9e",
   514  	Status:    "Running",
   515  	UserID:    "d33b18c384574fd2a3299447aac285f0",
   516  	ProjectID: "6b8ffef2a0ac42ee87887b9cc98bdf68",
   517  	CPU:       float64(1),
   518  	Memory:    "1024M",
   519  	MetaName:  "test",
   520  	Links: []interface{}{
   521  		map[string]interface{}{
   522  			"href": "http://10.10.10.10/v1/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
   523  			"rel":  "self",
   524  		},
   525  		map[string]interface{}{
   526  			"href": "http://10.10.10.10/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
   527  			"rel":  "bookmark",
   528  		},
   529  	},
   530  	CapsuleVersion: "beta",
   531  	RestartPolicy:  "always",
   532  	MetaLabels: map[string]string{
   533  		"web": "app",
   534  	},
   535  	ContainersUUIDs: []string{
   536  		"1739e28a-d391-4fd9-93a5-3ba3f29a4c9b",
   537  	},
   538  	Addresses: map[string][]capsules.Address{
   539  		"b1295212-64e1-471d-aa01-25ff46f9818d": {
   540  			{
   541  				PreserveOnDelete: false,
   542  				Addr:             "172.24.4.11",
   543  				Port:             "8439060f-381a-4386-a518-33d5a4058636",
   544  				Version:          float64(4),
   545  				SubnetID:         "4a2bcd64-93ad-4436-9f48-3a7f9b267e0a",
   546  			},
   547  		},
   548  	},
   549  	VolumesInfo: map[string][]string{
   550  		"67618d54-dd55-4f7e-91b3-39ffb3ba7f5f": {
   551  			"1739e28a-d391-4fd9-93a5-3ba3f29a4c9b",
   552  		},
   553  	},
   554  	Host:         "test-host",
   555  	StatusReason: "No reason",
   556  	Containers: []capsules.Container{
   557  		ExpectedContainer1,
   558  	},
   559  }
   560  
   561  var ExpectedCapsuleV132 = capsules.CapsuleV132{
   562  	UUID:      "cc654059-1a77-47a3-bfcf-715bde5aad9e",
   563  	Status:    "Running",
   564  	UserID:    "d33b18c384574fd2a3299447aac285f0",
   565  	ProjectID: "6b8ffef2a0ac42ee87887b9cc98bdf68",
   566  	CPU:       float64(1),
   567  	Memory:    "1024M",
   568  	MetaName:  "test",
   569  	Links: []interface{}{
   570  		map[string]interface{}{
   571  			"href": "http://10.10.10.10/v1/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
   572  			"rel":  "self",
   573  		},
   574  		map[string]interface{}{
   575  			"href": "http://10.10.10.10/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e",
   576  			"rel":  "bookmark",
   577  		},
   578  	},
   579  	RestartPolicy: map[string]string{
   580  		"MaximumRetryCount": "0",
   581  		"Name":              "always",
   582  	},
   583  	MetaLabels: map[string]string{
   584  		"web": "app",
   585  	},
   586  	Addresses: map[string][]capsules.Address{
   587  		"b1295212-64e1-471d-aa01-25ff46f9818d": {
   588  			{
   589  				PreserveOnDelete: false,
   590  				Addr:             "172.24.4.11",
   591  				Port:             "8439060f-381a-4386-a518-33d5a4058636",
   592  				Version:          float64(4),
   593  				SubnetID:         "4a2bcd64-93ad-4436-9f48-3a7f9b267e0a",
   594  			},
   595  		},
   596  	},
   597  	Host:         "test-host",
   598  	StatusReason: "No reason",
   599  	Containers: []capsules.Container{
   600  		ExpectedContainer1,
   601  	},
   602  }
   603  
   604  // HandleCapsuleGetOldTimeSuccessfully test setup
   605  func HandleCapsuleGetOldTimeSuccessfully(t *testing.T) {
   606  	th.Mux.HandleFunc("/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e", func(w http.ResponseWriter, r *http.Request) {
   607  		th.TestMethod(t, r, "GET")
   608  		th.TestHeader(t, r, "X-Auth-Token", fakeclient.TokenID)
   609  
   610  		w.WriteHeader(http.StatusOK)
   611  		w.Header().Add("Content-Type", "application/json")
   612  		fmt.Fprintf(w, CapsuleGetBody_OldTime)
   613  	})
   614  }
   615  
   616  // HandleCapsuleGetNewTimeSuccessfully test setup
   617  func HandleCapsuleGetNewTimeSuccessfully(t *testing.T) {
   618  	th.Mux.HandleFunc("/capsules/cc654059-1a77-47a3-bfcf-715bde5aad9e", func(w http.ResponseWriter, r *http.Request) {
   619  		th.TestMethod(t, r, "GET")
   620  		th.TestHeader(t, r, "X-Auth-Token", fakeclient.TokenID)
   621  
   622  		w.WriteHeader(http.StatusOK)
   623  		w.Header().Add("Content-Type", "application/json")
   624  		fmt.Fprintf(w, CapsuleGetBody_NewTime)
   625  	})
   626  }
   627  
   628  // HandleCapsuleCreateSuccessfully creates an HTTP handler at `/capsules` on the test handler mux
   629  // that responds with a `Create` response.
   630  func HandleCapsuleCreateSuccessfully(t *testing.T) {
   631  	th.Mux.HandleFunc("/capsules", func(w http.ResponseWriter, r *http.Request) {
   632  		th.TestMethod(t, r, "POST")
   633  		th.TestHeader(t, r, "X-Auth-Token", fakeclient.TokenID)
   634  		th.TestHeader(t, r, "Accept", "application/json")
   635  		w.WriteHeader(http.StatusAccepted)
   636  		fmt.Fprintf(w, CapsuleGetBody_NewTime)
   637  	})
   638  }
   639  
   640  // HandleCapsuleListSuccessfully test setup
   641  func HandleCapsuleListSuccessfully(t *testing.T) {
   642  	th.Mux.HandleFunc("/capsules/", func(w http.ResponseWriter, r *http.Request) {
   643  		th.TestMethod(t, r, "GET")
   644  		th.TestHeader(t, r, "X-Auth-Token", fakeclient.TokenID)
   645  
   646  		w.Header().Add("Content-Type", "application/json")
   647  		w.WriteHeader(http.StatusOK)
   648  		fmt.Fprintf(w, CapsuleListBody)
   649  	})
   650  }
   651  
   652  // HandleCapsuleV132ListSuccessfully test setup
   653  func HandleCapsuleV132ListSuccessfully(t *testing.T) {
   654  	th.Mux.HandleFunc("/capsules/", func(w http.ResponseWriter, r *http.Request) {
   655  		th.TestMethod(t, r, "GET")
   656  		th.TestHeader(t, r, "X-Auth-Token", fakeclient.TokenID)
   657  
   658  		w.Header().Add("Content-Type", "application/json")
   659  		w.WriteHeader(http.StatusOK)
   660  		fmt.Fprintf(w, CapsuleV132ListBody)
   661  	})
   662  }
   663  
   664  func HandleCapsuleDeleteSuccessfully(t *testing.T) {
   665  	th.Mux.HandleFunc("/capsules/963a239d-3946-452b-be5a-055eab65a421", func(w http.ResponseWriter, r *http.Request) {
   666  		th.TestMethod(t, r, "DELETE")
   667  		th.TestHeader(t, r, "X-Auth-Token", fakeclient.TokenID)
   668  		w.WriteHeader(http.StatusNoContent)
   669  	})
   670  }