def _exec_volume_types_encryption_changed(self, enc1, enc2, expected_result, mock_get_encryption): def _get_encryption(ctxt, type_id): if enc1 and enc1["volume_type_id"] == type_id: return enc1 if enc2 and enc2["volume_type_id"] == type_id: return enc2 return None mock_get_encryption.side_effect = _get_encryption actual_result = volume_types.volume_types_encryption_changed( self.ctxt, fake.VOLUME_TYPE_ID, fake.VOLUME_TYPE2_ID ) self.assertEqual(expected_result, actual_result)
def _exec_volume_types_encryption_changed(self, enc1, enc2, expected_result, mock_get_encryption): def _get_encryption(ctxt, type_id): if enc1 and enc1['volume_type_id'] == type_id: return enc1 if enc2 and enc2['volume_type_id'] == type_id: return enc2 return None mock_get_encryption.side_effect = _get_encryption actual_result = volume_types.volume_types_encryption_changed( self.ctxt, fake.VOLUME_TYPE_ID, fake.VOLUME_TYPE2_ID) self.assertEqual(expected_result, actual_result)