Commit Graph

16 Commits

Author SHA1 Message Date
Goutham Pacha Ravi 598223985a Use unittest.mock instead of third party lib
mock was adopted into standard python
in version 3.3 [1]. Since manila no longer
supports python2.7, we can use the inbuilt
mock package rather than the third party
lib.

Fix some issues with imports that weren't
following our import conventions of grouping
imports [3]

Add a hacking test to ensure we don't regress
on this.

[1] https://docs.python.org/3/library/unittest.mock.html
[2] http://lists.openstack.org/pipermail/openstack-discuss/2020-March/013281.html
[3] https://docs.openstack.org/hacking/latest/user/hacking.html#imports

Co-Authored-By: Sean McGinnis <sean.mcginnis@gmail.com>
Change-Id: If857a49fbf526983e712282a25d7e8bef5093533
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2020-04-17 16:24:27 -07:00
zhongjun2 3c37b942e7 Limit formatting routes when adding resources
By default, routes.mapper.Mapper.resource adds a bunch of formatted
routes that accept anything after a '.'. Our spec says only .xml
and .json are accepted so limit the formatting to those valuse.

This allows identifiers with a '.' in urls. A few tests were added
to the extensions test to prove that .xml and .json are stripped
but other values are not.

It is already modified in cinder [1].

[1] https://bugs.launchpad.net/cinder/+bug/1307956

Change-Id: I91d8aa967446b5d7ce52f1b245149304494777f3
Closes-bug: #1774353
2018-06-11 03:39:47 +00:00
dongdongpei ccbb1622ad Remove unused variables and broken links
Change-Id: Id7d276082329e070fa483c53ee2949f6720f7d17
2017-08-24 19:26:02 -07:00
Yusuke Hayashi 42ecc84a2c Fix order of arguments in assertEqual
Fix incorrect order assertEqual(observed, expected) as below.
  assertEqual(observed, expected) => assertEqual(expected, observed)

Target of this patch:
  manila/tests/api/*

Note:
I also fix following asserts aruond above fixed parts.
  assertEqual(xx, True), assertEqual(True, xx) => assertTrue(xx)

As for assertFalse,
I do not convert assertEqual(xx, False) to assertFalse(xx)
because assertFalse(None) does not raise exception.

Change-Id: I8131946efef654235b5e32344b3f5e42ab3d3ced
Partial-Bug: #1259292
2015-09-29 19:56:49 +09:00
Igor Malinovskiy a26824818f Remove Limited XML API Support from Manila
Remove the broken XML support presently available in Manila
in order to comply with the general direction among other
OpenStack projects to support JSON only.

Change-Id: Ibb542fa223f7f7d1bf95f3d1f568987ef839cd12
Closes-Bug: #1440782
2015-04-13 15:43:47 +03:00
Igor Malinovskiy 35b3a508f8 Implement private share_types
Add share_type_access extension which introduces
the ability to manage share type access:
* Share types are public by default
* Private share types can be created by setting
  the is_public boolean field to False at creation time.
* Access to a private share type can be controlled
  by adding or removing a project from it.
* Private share types without projects are only visible
  by users with the admin role/context.
Implementation details and unit tests were mostly adapted
from Cinder and Nova access extensions.

Implements bp private-share-types

Change-Id: I83ee57c6a516b5382d074c0082525ad7feadd59c
2015-03-10 12:17:26 +02:00
Thomas Bechtold 071d0b59c1 Switch to using oslo_* instead of oslo.*
The oslo team is recommending everyone to switch to the
non-namespaced versions of libraries. Updating the hacking
rule to include a check to prevent oslo.* import from
creeping back in.
oslo.messaging is the only exception because this package doesn't
currently support non-namespaced imports.

Change-Id: I3987e651bc880c8ffa7c0105df0298679dcd3a43
2015-01-27 09:19:50 +01:00
Andreas Jaeger 06a8dc7ae5 Use oslo.serialization
Replace usage of deprecated jsonutils module from oslo-incubator
and use oslo.serialization instead.

A followup-patch will sync with oslo-incubator and remove
the jsonutils module from manila.

Partial-Bug: #1382189

Change-Id: Iafa5090fd0c960ae8e996229ea3352f890decc6c
2014-10-22 16:40:42 +02:00
Marc Koderer ecf603bc05 Remove vim headers
As discussed in [1] remove all vim headers from manila files.

[1]: http://lists.openstack.org/pipermail/openstack-dev/2013-October/017353.html

Change-Id: I341486c66ffe4dad7db8608fdc66868ceb7ad95a
Closes-Bug: #1229324
2014-10-06 15:00:27 +02:00
Andreas Jaeger 43aeceff2f Fix H402 hacking rules
Fix and enable hacking test:
H402: one line docstring needs punctuation.

Fix testsuite, the change for manila/tests/api/extensions/foxinsocks.py
needs corresponding changes.

Change-Id: I587cd6771787ca56b1410f86a6ec13380bcc206b
2014-08-19 17:04:54 +02:00
Christian Berendt 799319baab Enabled hacking checks H305 and H307
* H305  imports not grouped correctly
* H307  like imports should be grouped together

Change-Id: I9dc5f995ea07d7c319d944e847a9d1c126937240
2014-07-20 18:48:31 +02:00
Christian Berendt bc43b162d7 change assert_ to assertTrue
According to http://docs.python.org/2/library/unittest.html
assert_ is a deprecated alias of assertTrue.

Change-Id: I6bd9658457cf2f6f6fc2d467fcdaa3ad022c2357
2014-05-14 21:20:06 +02:00
Andrei V. Ostapenko 3f24fee218 Removing deprecated using of flags module from project
Moving file flags.py to manila/common/config.py,
replacing FLAGS by CONF. Rename modules fake_flags to conf_fixture,
test_flags to test_conf, declare_flags to declare_conf,
runtime_flags to runtime_conf like it was done in cinder, nova, glance etc.

Implement bp: use-oslo-conf

Change-Id: I38d869123e5e706d3b06f1844b97ead05e22668f
2013-10-07 13:17:27 +03:00
Yulia Portnova 06d200f0aa Removed ubused unittests. 2013-09-06 14:39:55 +03:00
Yulia Portnova b2b51fb29f Mass replace osapi_volume to osapi_share
Removed locale
2013-09-05 15:27:46 +03:00
Yulia Portnova dc4ce932ed Renamed cinder to manila.
Fixed setup.py, fixed bin scripts.
2013-09-02 09:59:07 +03:00