← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1928471] [NEW] Wrong assertion methods in unit test

 

Public bug reported:

The following test code is not appropriate. The
'assert_called_once_with' method should be used.


        self.assertTrue(clear_bl_mock.called_with(self.context,
                                                  port_id=port_id,
                                                  host=host))
        self.assertTrue(delete_port_binding_mock.called_with(self.context,
                                                             host=host,
                                                             port_id=port_id))


See https://opendev.org/openstack/neutron/src/commit/92fa8ce6af42db5b88f640137d823a11c5a44a2c/neutron/tests/unit/plugins/ml2/test_plugin.py#L1932-L1937 (master)

** Affects: neutron
     Importance: Undecided
     Assignee: Takashi Natsume (natsume-takashi)
         Status: New


** Tags: unittest

** Changed in: neutron
     Assignee: (unassigned) => Takashi Natsume (natsume-takashi)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1928471

Title:
  Wrong assertion methods in unit test

Status in neutron:
  New

Bug description:
  The following test code is not appropriate. The
  'assert_called_once_with' method should be used.

  
          self.assertTrue(clear_bl_mock.called_with(self.context,
                                                    port_id=port_id,
                                                    host=host))
          self.assertTrue(delete_port_binding_mock.called_with(self.context,
                                                               host=host,
                                                               port_id=port_id))

  
  See https://opendev.org/openstack/neutron/src/commit/92fa8ce6af42db5b88f640137d823a11c5a44a2c/neutron/tests/unit/plugins/ml2/test_plugin.py#L1932-L1937 (master)

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1928471/+subscriptions


Follow ups