Commit 8d49649c authored by Arkadiusz Hiler's avatar Arkadiusz Hiler

tests: Make read_mail overwrite project correctly

Mail object append headers, so to overwrite them correctly we have to
delete the original one first.

Also fix a chicken and egg problem spotted by this fix.
Signed-off-by: Arkadiusz Hiler's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent 6e8e7cd0
Pipeline #11446 passed with stage
in 9 minutes and 18 seconds
......@@ -515,11 +515,11 @@ class MBoxPatchTest(PatchTest):
class GitPullEventTest(PatchTest):
def setUp(self):
self.mail = read_mail('0001-git-pull-request.mbox',
project=self.project)
self.p1 = Project(linkname='oss-dev', name='OSS Dev',
listid='cbe-oss-dev.ozlabs.org',
listemail='cbe-oss-dev.ozlabs.org')
self.mail = read_mail('0001-git-pull-request.mbox',
project=self.p1)
self.p1.save()
def testGitPullRequest(self):
......
......@@ -123,6 +123,7 @@ def read_mail(filename, project=None):
if 'Message-Id' not in mail:
mail['Message-Id'] = make_msgid()
if project is not None:
del(mail['List-Id'])
mail['List-Id'] = project.listid
return mail
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment