Re-enable test_idle

This is the second test that wants to switch between two sources. This
time it wants to do that 3 times, so we just reset hard each time.

To make this simpler, we made addCommitToRepo return the commit from
before this one. We also refactor the update from one config fixture to
another into a generic method that should be useful a few more times.

Change-Id: I409a86b3c92cc8f7984967f50ef0db50bf37ea6b
Story: 2000773
Task: 3473
diff --git a/tests/base.py b/tests/base.py
index 66fd85a..2e8012f 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -1793,12 +1793,23 @@
                 f.write(content)
             repo.index.add([fn])
         commit = repo.index.commit(message)
+        before = repo.heads[branch].commit
         repo.heads[branch].commit = commit
         repo.head.reference = branch
         repo.git.clean('-x', '-f', '-d')
         repo.heads[branch].checkout()
         if tag:
             repo.create_tag(tag)
+        return before
+
+    def commitLayoutUpdate(self, orig_name, source_name):
+        source_path = os.path.join(self.test_root, 'upstream',
+                                   source_name, 'zuul.yaml')
+        with open(source_path, 'r') as nt:
+            before = self.addCommitToRepo(
+                orig_name, 'Pulling content from %s' % source_name,
+                {'zuul.yaml': nt.read()})
+        return before
 
     def addEvent(self, connection, event):
         """Inject a Fake (Gerrit) event.