Public bug reported:

In the test_full_uuids_skip_port_id_lookup test in test_security_group.py,  
there are a couple of problems
with how a mock return value is being set for a database query.

The first problem is that in this line:
    fmock = sess_mock.query.return_value.outerjoin.return_value.filter
there is a missing '.return_value' missing between 'sess_mock' and 'query'.

The second problem is that in this line:
    fmock.return_value.all.return_value = []
the 'all.return_value' should not be used.

For reference, the query for which this mock return value is being set is in the
get_sg_ids_grouped_by_port() method in ML2's db.py:
        query = session.query(models_v2.Port,
                              sg_db.SecurityGroupPortBinding.security_group_id)
        query = query.outerjoin(sg_db.SecurityGroupPortBinding,
                                models_v2.Port.id == sg_binding_port)
        query = query.filter(or_(*or_criteria))

If the mock return values are set correctly, the last statement should
yield an empty list.

** Affects: neutron
     Importance: Undecided
     Assignee: Dane LeBlanc (leblancd)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Dane LeBlanc (leblancd)

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

Title:
  Fix mock return settings in test_full_uuids_skip_port_id_lookup

Status in OpenStack Neutron (virtual network service):
  New

Bug description:
  In the test_full_uuids_skip_port_id_lookup test in test_security_group.py,  
there are a couple of problems
  with how a mock return value is being set for a database query.

  The first problem is that in this line:
      fmock = sess_mock.query.return_value.outerjoin.return_value.filter
  there is a missing '.return_value' missing between 'sess_mock' and 'query'.

  The second problem is that in this line:
      fmock.return_value.all.return_value = []
  the 'all.return_value' should not be used.

  For reference, the query for which this mock return value is being set is in 
the
  get_sg_ids_grouped_by_port() method in ML2's db.py:
          query = session.query(models_v2.Port,
                                
sg_db.SecurityGroupPortBinding.security_group_id)
          query = query.outerjoin(sg_db.SecurityGroupPortBinding,
                                  models_v2.Port.id == sg_binding_port)
          query = query.filter(or_(*or_criteria))

  If the mock return values are set correctly, the last statement should
  yield an empty list.

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

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to