[FIX] runbot_merge: testing of batch contents

* Add ids accessor to the remote Model fake
* Explicitly ignore order when unnecessary, a test fails since the
  ordering of prs has been changed for UI purposes. This is only an
  issue for Remote though it's unclear why (as the local Issue/PR
  objects should still have a per-repo sequence)
This commit is contained in:
Xavier Morel 2018-08-28 11:40:05 +02:00 committed by xmo-odoo
parent a15ab1c481
commit 63be381453
2 changed files with 5 additions and 2 deletions

View File

@ -303,6 +303,10 @@ class Model:
object.__setattr__(self, '_fields', fields or self._env(self._model, 'fields_get', attributes=['type', 'relation']))
@property
def ids(self):
return self._ids
def __bool__(self):
return bool(self._ids)

View File

@ -172,8 +172,7 @@ def test_merge_fail(env, project, repo_a, repo_b, users):
s2 = to_pr(env, pr2a) | to_pr(env, pr2b)
st = env['runbot_merge.stagings'].search([])
assert st
assert st.batch_ids.prs == s2
assert set(st.batch_ids.prs.ids) == set(s2.ids)
failed = to_pr(env, pr1b)
assert failed.state == 'error'