Wrong assertion methods in unit test

Bug #1928471 reported by Takashi Natsume
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Takashi Natsume

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)

Tags: unittest
Changed in neutron:
assignee: nobody → Takashi Natsume (natsume-takashi)
Changed in neutron:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/791497

Changed in neutron:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/791497
Committed: https://opendev.org/openstack/neutron/commit/4e3f65ceef8b3c7321194c3087eb01ca4553bf56
Submitter: "Zuul (22348)"
Branch: master

commit 4e3f65ceef8b3c7321194c3087eb01ca4553bf56
Author: Takashi Natsume <email address hidden>
Date: Fri May 14 23:12:14 2021 +0900

    Fix wrong assertion methods in a unit test

    Fix wrong assertion methods in the
    test_delete_port_binding_delete_binding_and_levels method in
    neutron.tests.unit.plugins.ml2.test_plugin.TestMl2PluginOnly.

    Change-Id: Ib9c5f9ba660484df6048238375bc31f624228677
    Closes-Bug: 1928471
    Signed-off-by: Takashi Natsume <email address hidden>

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 19.0.0.0rc1

This issue was fixed in the openstack/neutron 19.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.