Add an endpoint that summarizes the number of passed and failed tests per suite.

BUG=None
TEST=Manually on local setup of Autotest
DEPLOY=apache
Change-Id: I84ac81ba8b386c1317d9809d88dcc61860550386
Reviewed-on: https://chromium-review.googlesource.com/218320
Reviewed-by: Nick Matthijssen <nickam@chromium.org>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Tested-by: Jesus Moises Osorio <moisesosorio@chromium.org>
Commit-Queue: Aviv Keshet <akeshet@chromium.org>
diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py
index bccc23d..687ab15 100644
--- a/frontend/afe/rpc_utils.py
+++ b/frontend/afe/rpc_utils.py
@@ -72,6 +72,18 @@
         return data
 
 
+def fetchall_as_list_of_dicts(cursor):
+    """
+    Converts each row in the cursor to a dictionary so that values can be read
+    by using the column name.
+    @param cursor: The database cursor to read from.
+    @returns: A list of each row in the cursor as a dictionary.
+    """
+    desc = cursor.description
+    return [ dict(zip([col[0] for col in desc], row))
+             for row in cursor.fetchall() ]
+
+
 def raw_http_response(response_data, content_type=None):
     response = django.http.HttpResponse(response_data, mimetype=content_type)
     response['Content-length'] = str(len(response.content))