Flatten test case
Flatten test case

mock doesn't have a way to do the below pattern:

  foo.bar(call_arg).AndReturn(return_arg)
  my_call()

Instead, you have to do the following:

  mock_foo.return_value = return_arg
  my_call()
  mock_foo.assert_call_once_with(call_arg)

As such, we can't easily map the below to mock:

  def check_something(self):
      mock_foo.assert_call_once_with(call_arg)

  def test_foo(self):
      self.check_something()
      self.check_something()
      self.check_something()
      my_call()

And we need to flatten this out, somewhat dumbly, to allow the
conversion.

Change-Id: I0f0e3e9ce4a410f60639c28aaadb9197aa47b492
Signed-off-by: Stephen Finucane <492121341a95b3c3aab646bed44634f739dd019b@redhat.com>

openstack/oslo.utils