Test cases for V3 Project Actions

This submission adds a new test script "test_projects.py", so as
to verify the CRUD Operations of V3 Projects API. Required support
functions are added in client files under both XML/JSON interfaces.
Added methods to add resources (v3: users, projects, roles) in
DataGenerator class of base.py file.

Implements blueprint: add-keystone-v3-projects-tests

Change-Id: I1a0feb12e9ca503d7a03941b8e5bb1e5ae722fbc
diff --git a/tempest/services/identity/v3/xml/identity_client.py b/tempest/services/identity/v3/xml/identity_client.py
index 03e06dc..3fffc1f 100644
--- a/tempest/services/identity/v3/xml/identity_client.py
+++ b/tempest/services/identity/v3/xml/identity_client.py
@@ -163,6 +163,31 @@
         body = self._parse_body(etree.fromstring(body))
         return resp, body
 
+    def list_projects(self):
+        """Get the list of projects."""
+        resp, body = self.get("projects", self.headers)
+        body = self._parse_projects(etree.fromstring(body))
+        return resp, body
+
+    def update_project(self, project_id, **kwargs):
+        """Updates a Project."""
+        resp, body = self.get_project(project_id)
+        name = kwargs.get('name', body['name'])
+        desc = kwargs.get('description', body['description'])
+        en = kwargs.get('enabled', body['enabled'])
+        domain_id = kwargs.get('domain_id', body['domain_id'])
+        post_body = Element("project",
+                            xmlns=XMLNS,
+                            name=name,
+                            description=desc,
+                            enabled=str(en).lower(),
+                            domain_id=domain_id)
+        resp, body = self.patch('projects/%s' % project_id,
+                                str(Document(post_body)),
+                                self.headers)
+        body = self._parse_body(etree.fromstring(body))
+        return resp, body
+
     def get_project(self, project_id):
         """GET a Project."""
         resp, body = self.get("projects/%s" % project_id, self.headers)