Re-enable requirement reject tests

Re-enable the reject layout tests.

Change-Id: I017726e5e82a32730354ca43296bd3f11ddc21c4
diff --git a/tests/fixtures/config/requirements/reject-username/git/common-config/zuul.yaml b/tests/fixtures/config/requirements/reject-username/git/common-config/zuul.yaml
new file mode 100644
index 0000000..92c7de2
--- /dev/null
+++ b/tests/fixtures/config/requirements/reject-username/git/common-config/zuul.yaml
@@ -0,0 +1,52 @@
+- pipeline:
+    name: pipeline
+    manager: independent
+    source:
+      gerrit
+    reject:
+      approval:
+        - username: 'jenkins'
+    trigger:
+      gerrit:
+        - event: comment-added
+    success:
+      gerrit:
+        verified: 1
+    failure:
+      gerrit:
+        verified: -1
+
+- pipeline:
+    name: trigger
+    manager: independent
+    source:
+      gerrit
+    trigger:
+      gerrit:
+        - event: comment-added
+          reject-approval:
+            - username: 'jenkins'
+    success:
+      gerrit:
+        verified: 1
+    failure:
+      gerrit:
+        verified: -1
+
+- job:
+    name: project1-job
+
+- job:
+    name: project2-job
+
+- project:
+    name: org/project1
+    pipeline:
+      jobs:
+        - project1-job
+
+- project:
+    name: org/project2
+    trigger:
+      jobs:
+        - project2-job
diff --git a/tests/fixtures/config/requirements/reject-username/git/org_project1/README b/tests/fixtures/config/requirements/reject-username/git/org_project1/README
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/tests/fixtures/config/requirements/reject-username/git/org_project1/README
@@ -0,0 +1 @@
+test
diff --git a/tests/fixtures/config/requirements/reject-username/git/org_project2/README b/tests/fixtures/config/requirements/reject-username/git/org_project2/README
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/tests/fixtures/config/requirements/reject-username/git/org_project2/README
@@ -0,0 +1 @@
+test
diff --git a/tests/fixtures/config/requirements/reject-username/main.yaml b/tests/fixtures/config/requirements/reject-username/main.yaml
new file mode 100644
index 0000000..a22ed5c
--- /dev/null
+++ b/tests/fixtures/config/requirements/reject-username/main.yaml
@@ -0,0 +1,6 @@
+- tenant:
+    name: tenant-one
+    source:
+      gerrit:
+        config-repos:
+          - common-config
diff --git a/tests/fixtures/layout-requirement-reject.yaml b/tests/fixtures/config/requirements/reject/git/common-config/zuul.yaml
similarity index 62%
rename from tests/fixtures/layout-requirement-reject.yaml
rename to tests/fixtures/config/requirements/reject/git/common-config/zuul.yaml
index 1f5d714..12a2538 100644
--- a/tests/fixtures/layout-requirement-reject.yaml
+++ b/tests/fixtures/config/requirements/reject/git/common-config/zuul.yaml
@@ -1,6 +1,8 @@
-pipelines:
-  - name: pipeline
-    manager: IndependentPipelineManager
+- pipeline:
+    name: pipeline
+    manager: independent
+    source:
+      gerrit
     require:
       approval:
         - username: jenkins
@@ -18,8 +20,11 @@
       gerrit:
         verified: -1
 
-  - name: trigger
-    manager: IndependentPipelineManager
+- pipeline:
+    name: trigger
+    manager: independent
+    source:
+      gerrit
     trigger:
       gerrit:
         - event: comment-added
@@ -35,10 +40,20 @@
       gerrit:
         verified: -1
 
-projects:
-  - name: org/project1
+- job:
+    name: project1-job
+
+- job:
+    name: project2-job
+
+- project:
+    name: org/project1
     pipeline:
-      - project1-pipeline
-  - name: org/project2
+      jobs:
+        - project1-job
+
+- project:
+    name: org/project2
     trigger:
-      - project2-trigger
+      jobs:
+        - project2-job
diff --git a/tests/fixtures/config/requirements/reject/git/org_project1/README b/tests/fixtures/config/requirements/reject/git/org_project1/README
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/tests/fixtures/config/requirements/reject/git/org_project1/README
@@ -0,0 +1 @@
+test
diff --git a/tests/fixtures/config/requirements/reject/git/org_project2/README b/tests/fixtures/config/requirements/reject/git/org_project2/README
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/tests/fixtures/config/requirements/reject/git/org_project2/README
@@ -0,0 +1 @@
+test
diff --git a/tests/fixtures/config/requirements/reject/main.yaml b/tests/fixtures/config/requirements/reject/main.yaml
new file mode 100644
index 0000000..a22ed5c
--- /dev/null
+++ b/tests/fixtures/config/requirements/reject/main.yaml
@@ -0,0 +1,6 @@
+- tenant:
+    name: tenant-one
+    source:
+      gerrit:
+        config-repos:
+          - common-config
diff --git a/tests/fixtures/layout-requirement-reject-username.yaml b/tests/fixtures/layout-requirement-reject-username.yaml
deleted file mode 100644
index 9c71045..0000000
--- a/tests/fixtures/layout-requirement-reject-username.yaml
+++ /dev/null
@@ -1,37 +0,0 @@
-pipelines:
-  - name: pipeline
-    manager: IndependentPipelineManager
-    reject:
-      approval:
-        - username: 'jenkins'
-    trigger:
-      gerrit:
-        - event: comment-added
-    success:
-      gerrit:
-        verified: 1
-    failure:
-      gerrit:
-        verified: -1
-
-  - name: trigger
-    manager: IndependentPipelineManager
-    trigger:
-      gerrit:
-        - event: comment-added
-          reject-approval:
-            - username: 'jenkins'
-    success:
-      gerrit:
-        verified: 1
-    failure:
-      gerrit:
-        verified: -1
-
-projects:
-  - name: org/project1
-    pipeline:
-      - project1-pipeline
-  - name: org/project2
-    trigger:
-      - project2-trigger
\ No newline at end of file
diff --git a/tests/test_requirements.py b/tests/test_requirements.py
index f2bdece..eecb5fa 100644
--- a/tests/test_requirements.py
+++ b/tests/test_requirements.py
@@ -16,7 +16,6 @@
 
 import logging
 import time
-from unittest import skip
 
 from tests.base import ZuulTestCase
 
@@ -317,111 +316,104 @@
         self.assertEqual(len(self.history), 1)
 
 
-class TestRequirements(ZuulTestCase):
-    """Test pipeline and trigger requirements"""
+class TestRequirementsRejectUsername(ZuulTestCase):
+    """Requirements with reject username requirement"""
 
-    tenant_config_file = 'config/requirements/main.yaml'
+    tenant_config_file = 'config/requirements/reject-username/main.yaml'
 
     def _test_require_reject_username(self, project, job):
         "Test negative username's match"
         # Should only trigger if Jenkins hasn't voted.
-        self.updateConfigLayout(
-            'tests/fixtures/layout-requirement-reject-username.yaml')
-        self.sched.reconfigure(self.config)
-        self.registerJobs()
-
         # add in a change with no comments
         A = self.fake_gerrit.addFakeChange(project, 'master', 'A')
         self.waitUntilSettled()
         self.assertEqual(len(self.history), 0)
 
         # add in a comment that will trigger
-        self.fake_gerrit.addEvent(A.addApproval('CRVW', 1,
+        self.fake_gerrit.addEvent(A.addApproval('code-review', 1,
                                                 username='reviewer'))
         self.waitUntilSettled()
         self.assertEqual(len(self.history), 1)
         self.assertEqual(self.history[0].name, job)
 
         # add in a comment from jenkins user which shouldn't trigger
-        self.fake_gerrit.addEvent(A.addApproval('VRFY', 1, username='jenkins'))
+        self.fake_gerrit.addEvent(A.addApproval('verified', 1,
+                                                username='jenkins'))
         self.waitUntilSettled()
         self.assertEqual(len(self.history), 1)
 
         # Check future reviews also won't trigger as a 'jenkins' user has
         # commented previously
-        self.fake_gerrit.addEvent(A.addApproval('CRVW', 1,
+        self.fake_gerrit.addEvent(A.addApproval('code-review', 1,
                                                 username='reviewer'))
         self.waitUntilSettled()
         self.assertEqual(len(self.history), 1)
 
-    @skip("Disabled for early v3 development")
     def test_pipeline_reject_username(self):
         "Test negative pipeline requirement: no comment from jenkins"
         return self._test_require_reject_username('org/project1',
-                                                  'project1-pipeline')
+                                                  'project1-job')
 
-    @skip("Disabled for early v3 development")
     def test_trigger_reject_username(self):
         "Test negative trigger requirement: no comment from jenkins"
         return self._test_require_reject_username('org/project2',
-                                                  'project2-trigger')
+                                                  'project2-job')
+
+
+class TestRequirementsReject(ZuulTestCase):
+    """Requirements with reject requirement"""
+
+    tenant_config_file = 'config/requirements/reject/main.yaml'
 
     def _test_require_reject(self, project, job):
         "Test no approval matches a reject param"
-        self.updateConfigLayout(
-            'tests/fixtures/layout-requirement-reject.yaml')
-        self.sched.reconfigure(self.config)
-        self.registerJobs()
-
         A = self.fake_gerrit.addFakeChange(project, 'master', 'A')
         self.waitUntilSettled()
         self.assertEqual(len(self.history), 0)
 
         # First positive vote should not queue until jenkins has +1'd
-        comment = A.addApproval('VRFY', 1, username='reviewer_a')
+        comment = A.addApproval('verified', 1, username='reviewer_a')
         self.fake_gerrit.addEvent(comment)
         self.waitUntilSettled()
         self.assertEqual(len(self.history), 0)
 
         # Jenkins should put in a +1 which will also queue
-        comment = A.addApproval('VRFY', 1, username='jenkins')
+        comment = A.addApproval('verified', 1, username='jenkins')
         self.fake_gerrit.addEvent(comment)
         self.waitUntilSettled()
         self.assertEqual(len(self.history), 1)
         self.assertEqual(self.history[0].name, job)
 
         # Negative vote should not queue
-        comment = A.addApproval('VRFY', -1, username='reviewer_b')
+        comment = A.addApproval('verified', -1, username='reviewer_b')
         self.fake_gerrit.addEvent(comment)
         self.waitUntilSettled()
         self.assertEqual(len(self.history), 1)
 
         # Future approvals should do nothing
-        comment = A.addApproval('VRFY', 1, username='reviewer_c')
+        comment = A.addApproval('verified', 1, username='reviewer_c')
         self.fake_gerrit.addEvent(comment)
         self.waitUntilSettled()
         self.assertEqual(len(self.history), 1)
 
         # Change/update negative vote should queue
-        comment = A.addApproval('VRFY', 1, username='reviewer_b')
+        comment = A.addApproval('verified', 1, username='reviewer_b')
         self.fake_gerrit.addEvent(comment)
         self.waitUntilSettled()
         self.assertEqual(len(self.history), 2)
         self.assertEqual(self.history[1].name, job)
 
         # Future approvals should also queue
-        comment = A.addApproval('VRFY', 1, username='reviewer_d')
+        comment = A.addApproval('verified', 1, username='reviewer_d')
         self.fake_gerrit.addEvent(comment)
         self.waitUntilSettled()
         self.assertEqual(len(self.history), 3)
         self.assertEqual(self.history[2].name, job)
 
-    @skip("Disabled for early v3 development")
     def test_pipeline_require_reject(self):
         "Test pipeline requirement: rejections absent"
-        return self._test_require_reject('org/project1', 'project1-pipeline')
+        return self._test_require_reject('org/project1', 'project1-job')
 
-    @skip("Disabled for early v3 development")
     def test_trigger_require_reject(self):
         "Test trigger requirement: rejections absent"
-        return self._test_require_reject('org/project2', 'project2-trigger')
+        return self._test_require_reject('org/project2', 'project2-job')