Improve fake github commit status handling

Move the commit status handling from directly in fake pull request
objects to be part of the fake github object, to more closely model how
github itself works.

Change-Id: I195f7bad8ee499a48de57fa0d2bbb7a736f7b343
Story: 2000774
Task: 4609
diff --git a/tests/unit/test_github_driver.py b/tests/unit/test_github_driver.py
index 4979087..ba8e497 100644
--- a/tests/unit/test_github_driver.py
+++ b/tests/unit/test_github_driver.py
@@ -248,16 +248,18 @@
 
     @simple_layout('layouts/reporting-github.yaml', driver='github')
     def test_reporting(self):
+        project = 'org/project'
         # pipeline reports pull status both on start and success
         self.executor_server.hold_jobs_in_build = True
-        A = self.fake_github.openFakePullRequest('org/project', 'master', 'A')
+        A = self.fake_github.openFakePullRequest(project, 'master', 'A')
         self.fake_github.emitEvent(A.getPullRequestOpenedEvent())
         self.waitUntilSettled()
         # We should have a status container for the head sha
-        self.assertIn(A.head_sha, A.statuses.keys())
+        statuses = self.fake_github.statuses[project][A.head_sha]
+        self.assertIn(A.head_sha, self.fake_github.statuses[project].keys())
         # We should only have one status for the head sha
-        self.assertEqual(1, len(A.statuses[A.head_sha]))
-        check_status = A.statuses[A.head_sha][0]
+        self.assertEqual(1, len(statuses))
+        check_status = statuses[0]
         check_url = ('http://zuul.example.com/status/#%s,%s' %
                      (A.number, A.head_sha))
         self.assertEqual('tenant-one/check', check_status['context'])
@@ -270,8 +272,9 @@
         self.executor_server.release()
         self.waitUntilSettled()
         # We should only have two statuses for the head sha
-        self.assertEqual(2, len(A.statuses[A.head_sha]))
-        check_status = A.statuses[A.head_sha][0]
+        statuses = self.fake_github.statuses[project][A.head_sha]
+        self.assertEqual(2, len(statuses))
+        check_status = statuses[0]
         check_url = ('http://zuul.example.com/status/#%s,%s' %
                      (A.number, A.head_sha))
         self.assertEqual('tenant-one/check', check_status['context'])
@@ -286,7 +289,8 @@
         self.fake_github.emitEvent(
             A.getCommentAddedEvent('reporting check'))
         self.waitUntilSettled()
-        self.assertEqual(2, len(A.statuses[A.head_sha]))
+        statuses = self.fake_github.statuses[project][A.head_sha]
+        self.assertEqual(2, len(statuses))
         # comments increased by one for the start message
         self.assertEqual(2, len(A.comments))
         self.assertThat(A.comments[1],
@@ -295,8 +299,9 @@
         self.executor_server.release()
         self.waitUntilSettled()
         # pipeline reports success status
-        self.assertEqual(3, len(A.statuses[A.head_sha]))
-        report_status = A.statuses[A.head_sha][0]
+        statuses = self.fake_github.statuses[project][A.head_sha]
+        self.assertEqual(3, len(statuses))
+        report_status = statuses[0]
         self.assertEqual('tenant-one/reporting', report_status['context'])
         self.assertEqual('success', report_status['state'])
         self.assertEqual(2, len(A.comments))