'Testing a pvc create'

@mock.patch('oc_pvc.Utils.create_tmpfile_copy')
@mock.patch('oc_pvc.OCPVC._run')
def test_update_pvc(self, mock_run, mock_tmpfile_copy):

    params = copy.deepcopy(OCPVCTest.params)
    params['access_modes'] = 'ReadWriteMany'
    pvc = '{"kind":    "PersistentVolumeClaim",\n                                                            "apiVersion":    "v1",\n                                                            "metadata":    {\n                                                                            "name":    "mypvc",\n                                                                            "namespace":    "test",\n                                                                            "selfLink":    "/api/v1/namespaces/test/persistentvolumeclaims/mypvc",\n                                                                            "uid":    "77597898-d8d8-11e6-aea5-0e3c0c633889",\n                                                                            "resourceVersion":    "126510787",\n                                                                            "creationTimestamp":    "2017-01-12T15:04:50Z",\n                                                                            "labels":    {\n                                                                                            "mypvc":    "database"\n                                                                            },\n                                                                            "annotations":    {\n                                                                                            "pv.kubernetes.io/bind-completed":    "yes",\n                                                                                            "pv.kubernetes.io/bound-by-controller":    "yes",\n                                                                                            "v1.2-volume.experimental.kubernetes.io/provisioning-required":    "volume.experimental.kubernetes.io/provisioning-completed"\n                                                                            }\n                                                            },\n                                                            "spec":    {\n                                                                            "accessModes":    [\n                                                                                            "ReadWriteOnce"\n                                                                            ],\n                                                                            "resources":    {\n                                                                                            "requests":    {\n                                                                                                            "storage":    "1Gi"\n                                                                                            }\n                                                                            },\n                                                                            "volumeName":    "pv-aws-ow5vl"\n                                                            },\n                                                            "status":    {\n                                                                        "phase":    "Bound",\n                                                                            "accessModes":    [\n                                                                                            "ReadWriteOnce"\n                                                                            ],\n                                                                                "capacity":    {\n                                                                                        "storage":    "1Gi"\n                                                                                }\n                                                            }\n                                                        }'
    mod_pvc = '{"kind":    "PersistentVolumeClaim",\n                                                            "apiVersion":    "v1",\n                                                            "metadata":    {\n                                                                            "name":    "mypvc",\n                                                                            "namespace":    "test",\n                                                                            "selfLink":    "/api/v1/namespaces/test/persistentvolumeclaims/mypvc",\n                                                                            "uid":    "77597898-d8d8-11e6-aea5-0e3c0c633889",\n                                                                            "resourceVersion":    "126510787",\n                                                                            "creationTimestamp":    "2017-01-12T15:04:50Z",\n                                                                            "labels":    {\n                                                                                            "mypvc":    "database"\n                                                                            },\n                                                                            "annotations":    {\n                                                                                            "pv.kubernetes.io/bind-completed":    "yes",\n                                                                                            "pv.kubernetes.io/bound-by-controller":    "yes",\n                                                                                            "v1.2-volume.experimental.kubernetes.io/provisioning-required":    "volume.experimental.kubernetes.io/provisioning-completed"\n                                                                            }\n                                                            },\n                                                            "spec":    {\n                                                                            "accessModes":    [\n                                                                                            "ReadWriteMany"\n                                                                            ],\n                                                                            "resources":    {\n                                                                                            "requests":    {\n                                                                                                            "storage":    "1Gi"\n                                                                                            }\n                                                                            },\n                                                                            "volumeName":    "pv-aws-ow5vl"\n                                                            },\n                                                            "status":    {\n                                                                        "phase":    "Bound",\n                                                                            "accessModes":    [\n                                                                                            "ReadWriteOnce"\n                                                                            ],\n                                                                                "capacity":    {\n                                                                                        "storage":    "1Gi"\n                                                                                }\n                                                            }\n                                                        }'
    mock_run.side_effect = [(0, pvc, ''), (0, pvc, ''), (0, '', ''), (0, mod_pvc, '')]
    mock_tmpfile_copy.side_effect = ['/tmp/mocked_kubeconfig']
    results = OCPVC.run_ansible(params, False)
    self.assertFalse(results['changed'])
    self.assertEqual(results['results']['msg'], '#####    -    This    volume    is    currently    bound.        Will    not    update    -    ####')
