'Testing a label list'

@mock.patch('oc_image.Utils.create_tmpfile_copy')
@mock.patch('oc_image.OCImage._run')
def test_state_list(self, mock_cmd, mock_tmpfile_copy):

    params = {'registry_url': 'registry.ops.openshift.com', 'image_name': 'oso-rhel7-zagg-web', 'image_tag': 'int', 'namespace': 'default', 'state': 'list', 'kubeconfig': '/etc/origin/master/admin.kubeconfig', 'debug': False}
    istream = '{\n                                                "kind":    "ImageStream",\n                                                "apiVersion":    "v1",\n                                                "metadata":    {\n                                                                "name":    "oso-rhel7-zagg-web",\n                                                                "namespace":    "default",\n                                                                "selfLink":    "/oapi/v1/namespaces/default/imagestreams/oso-rhel7-zagg-web",\n                                                                "uid":    "6ca2b199-dcdb-11e6-8ffd-0a5f8e3e32be",\n                                                                "resourceVersion":    "8135944",\n                                                                "generation":    1,\n                                                                "creationTimestamp":    "2017-01-17T17:36:05Z",\n                                                                "annotations":    {\n                                                                                "openshift.io/image.dockerRepositoryCheck":    "2017-01-17T17:36:05Z"\n                                                                }\n                                                },\n                                                "spec":    {\n                                                                "tags":    [\n                                                                                {\n                                                                                                "name":    "int",\n                                                                                                "annotations":    null,\n                                                                                                "from":    {\n                                                                                                                "kind":    "DockerImage",\n                                                                                                                "name":    "registry.ops.openshift.com/ops/oso-rhel7-zagg-web:int"\n                                                                                                },\n                                                                                                "generation":    1,\n                                                                                                "importPolicy":    {}\n                                                                                }\n                                                                ]\n                                                },\n                                                "status":    {\n                                                                "dockerImageRepository":    "172.30.183.164:5000/default/oso-rhel7-zagg-web",\n                                                                "tags":    [\n                                                                                {\n                                                                                                "tag":    "int",\n                                                                                                "items":    [\n                                                                                                                {\n                                                                                                                                "created":    "2017-01-17T17:36:05Z",\n                                                                                                                                "dockerImageReference":    "registry.ops.openshift.com/ops/oso-rhel7-zagg-web@sha256:645bab780cf18a9b764d64b02ca65c39d13cb16f19badd0a49a1668629759392",\n                                                                                                                                "image":    "sha256:645bab780cf18a9b764d64b02ca65c39d13cb16f19badd0a49a1668629759392",\n                                                                                                                                "generation":    1\n                                                                                                                }\n                                                                                                ]\n                                                                                }\n                                                                ]\n                                                }\n                                }\n                                '
    mock_cmd.side_effect = [(0, istream, '')]
    mock_tmpfile_copy.side_effect = ['/tmp/mocked_kubeconfig']
    results = OCImage.run_ansible(params, False)
    self.assertFalse(results['changed'])
    self.assertEquals(results['results']['results'][0]['metadata']['name'], 'oso-rhel7-zagg-web')
