Commit Graph

34 Commits

Author SHA1 Message Date
Thomas Goirand eb12c770cc Python 3.12: use assertAlmostEqual
The old failUnlessAlmostEqual is removed from Python 3.12. Let's
use assertAlmostEqual instead.

Change-Id: I25c4d43c580d9b101be5ed3e0e23fead704b09f0
2023-12-17 22:23:50 +01:00
songwenping 8ee8ee15b1 Replace assertDictMatch with assertDictEqual method in tests
assertDictMatch was introduced for Python 2.6 only.
Python 2.7+ contains assertDictEqual.

Closes-Bug: #1646433
Change-Id: I41738cc0bd90656508fc6ff390072b55130cc6fc
2021-07-14 01:32:08 +00:00
haixin 3831e5500f remove usage of six library from unit tests
Replace six with Python 3 style code.

Change-Id: I5077e71663f6b60bd774f30fcf64b36d4078cf8e
2021-01-28 10:47:40 +08:00
Cloud User 6bb021375c Fix missing group and group_snapshots in absolute limits
Modified limits API to make it return the max number of
share_groups and share_group_snapshots, as well as the total number
of resources used

Change-Id: Ia4e69219b107fc0630cb9e97401b9a8bda5b1adc
Closes-Bug: #1868644
2021-01-13 14:52:41 +00:00
silvacarloss dceced6d6e Add new quota for share replicas
This patch adds new quotas for share replicas and replica sizes.
This quotas can be related to either tenants and users or tenants
and share types. Now, when creating a share replica, manila will
check if there are resources available for that specific request.

Partially-Implements: bp limit-share-replicas-per-share
Change-Id: I8ba7bc6f167c28d6c169b2187d0e1bda7cad3f69
2020-04-06 13:17:30 +00:00
Andreas Jaeger 3be50ced7a Hacking: Fix E741
E741 ambiguous variable name 'l'

Also fix other problems found by hacking in files touched.

Change-Id: I8171994716092ae7f12018861e95ed52fee57b18
2020-04-01 13:27:33 +02:00
Goutham Pacha Ravi 3bd1e5054a [pylint] Fix/ignore pylint errors in test modules
- Add ignores to pylint false positives in the
  test modules.
- Remove unnecessary fake data
- Fix wrong mock methods used in tests

Change-Id: I64ffff15cc546c67e7e545b1da7ec0efa002bdc5
2019-02-28 08:36:11 -08:00
dongdongpei ccbb1622ad Remove unused variables and broken links
Change-Id: Id7d276082329e070fa483c53ee2949f6720f7d17
2017-08-24 19:26:02 -07:00
Bin Zhou b6fa89bae3 Modify use of assertTrue(A in B)
Developers should use assertIn(A, B) instead of assertTrue(A in B ).

TrivialFix

Change-Id: Icb1f58f462f982d9c4b0795d1a7f010b08c9b387
2016-09-20 09:11:20 +08:00
Valeriy Ponomaryov 30d9144aac Port used limits to core API
Extension 'used limits' was extending core 'limits' API with used
resources information. So, provide such information in core API and
remove extension completely.
It does not require neither update of API router nor bump of
microversion.

Partially implements bp ext-to-core

Change-Id: I0ff71fbd0281eb2e34a9acbfc72ff8c14390e8d9
2015-10-19 15:15:20 +03: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
Yusuke Hayashi cb0a5c9829 Replace assertEqual(None, *) with assertIsNone in tests
Replace assertEqual(None, *) with assertIsNone in tests to have
more clear messages in case of failure.

Closes-Bug: #1280522
Change-Id: I2d5285add72678b5a61b4f66879c4d066afc34c7
2015-08-23 09:07:13 +09:00
Valeriy Ponomaryov ed6ed47202 Fix string/binary conversions for py34 compatibility
Default type of strings in py 2 and 3 are different. So, convert them
explicitly when it is needed for py 2/3 compatibility.

Partially-Implements: bp py3-compatibility
Change-Id: I9b2d7e97fdc7d073a16e729ce0e90b92281fdf8d
2015-08-07 15:33:36 +03:00
Julia Varlamova c3e749dafd Fix imports for py34 compatibility
Fix imports of:
    urllib2
    httplib
    __builtin__
    StringIO
    UserDict

Partially-Implements: bp py3-compatibility

Change-Id: I0da74d504456cbb9680973bdabc091cf8786bc9a
2015-08-05 17:32:13 +03: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
Clinton Knight 65d1158526 Replace legacy StubOutForTesting class
The Manila test module uses a class called StubOutForTesting, which
is an awkward holdover from when the unit tests were using Mox.
Alex wrote a more elegant and capable mocker method,
manila.test.TestCase.mock_object, in the Cinder project which we
have now added to Manila. So to remove the duplicate functionality
and legacy code, all references to self.stubs.Set() in the Manila
tests should be replaced with self.mock_object() and any related
dead code should be removed.

Resolves-bug: #1415602
Change-Id: Ie5f203c0b2cb57ad00d9ec8db0529075b6fef261
2015-02-03 14:31:17 +00: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
chen-li 346b7c468a py3: use six.moves.range instead of xrange
six is the canonical compatibility library for supporting
Python 2 and 3 in a single codebase.

The xrange module  was removed in Python 3 and we should
use 'six.moves.range' instead of 'xrange' to make
code compatible with py 2 and 3 as well.

Partially-implements blueprint py3-compatibility

Change-Id: Id054857f320d9eda02bc0b82e5512c0595342290
2014-12-27 18:41:21 +08: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
Andreas Jaeger 732ccbc661 Use six instead of str for exceptions
Use six.text_type instead of str for exceptions to allow lazy
translations with oslo.i18n.

Remove some unneeded msg assignment.

Change-Id: Ie26c2b90503f130f69444cfb51bf5cef8f592f98
2014-10-19 19:16:21 +02:00
Rafael Rivero e08d717b47 Fixes several typos (Manila)
Fixes several docstring typographical errors.

Change-Id: I335a74e9fe7fe03e8c95a66e6e3f63a8329043f7
2014-09-25 12:50:12 -07:00
Valeriy Ponomaryov b3d584bbcc py3: Use six module for StringIO imports
It is python 2/3 compatibility change.
six.StringIO an alias for StringIO.StringIO in Python 2 and
io.StringIO in Python 3.

Partially implements blueprint py3-compatibility

Change-Id: Ib2f570645d3b0a4b3bd38c017693e0b1b77f3236
2014-08-31 09:58:08 +03:00
Andreas Jaeger 2641eb9b57 Flake8: Fix and enable H405
Fix H405:
H405  multi line docstring summary not separated with an empty line

With this patch, flake8 passes all checks (incl. hacking checks)
except the on-purpose disabled check H904.
Closes-Bug: #1333290

Change-Id: If41259aefc4d6d588da5036f1f25df17b88db04f
2014-08-27 13:39:22 +02:00
Andreas Jaeger 8203c51081 Flake8: Fix and enable H404
Fix and enable flake8 test H404:
H404  multi line docstring should start without a leading new line

Change-Id: I13dc13bb5e81d65300680df094cde538c7a6f6df
Partial-Bug: #1333290
2014-08-27 10:47:45 +00:00
Andreas Jaeger e1ab0e25c7 Flake8: Fix F841
Enable F841 and fix all issues.

Flake F841 is:
F841 local variable 'XXX' is assigned to but never used

Also fix in changed files some occurences of:
E128 continuation line under-indented for visual indent
H404  multi line docstring should start without a leading new line
H405  multi line docstring summary not separated with an empty line

Change-Id: Ifb08a82d05ac15c8e90f214a96e73d82ff850018
Partial-Bug: #1333290
2014-08-25 08:58:38 +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
Dirk Mueller c4b022524b Fix E265 block comment should start with '# '
Address the new pep8 warning that block comments should
start with the sequence '# '.

Change-Id: I52ca5d63b1ca9a465ba36dc9254928f858f2a094
2014-07-14 10:17:10 +02:00
Christian Berendt 942503d8ed Enabled hacking check H403
* [H403] Multi line docstrings should end on a new line.

Change-Id: Idd2d40c6304a0f75b192dbbe88c1d81b59dfa957
2014-07-10 16:53:41 +02:00
Jenkins b8fe89de80 Merge "Use testtools module instead unittest module" 2014-06-17 06:32:48 +00:00
Valeriy Ponomaryov ea26ee3c9a Use testtools module instead unittest module
It allows us to use a bunch of skip
decorators, addCleanup method with
2.6 and 2.7 python versions.
Provides more strict usage of setUp
and tearDown methods.

Change-Id: I62144ba43d62e3becb90427d5d6600f97db458df
2014-06-16 09:19:37 +03:00
Dirk Mueller f1f0cb64b2 Use Python 3.x compatible except construct
except x,y: can be rewritten as except x as y: which
works with all Python versions >= 2.6

Change-Id: I3fb2dd9c0e1c292accffc934e45983cb9e12b171
2014-05-23 00:35:36 +02:00
vponomaryov 0d354cafb9 Made max limit name for snapshots unique
Current max limit for snapshots in manila has same name
as cinder does. It causes overwrites in horizon.

Change-Id: I8504b4c378809a4f307057bcb77efc0293822a91
2014-04-03 08:44:47 -04:00
Yulia Portnova a0ed749e13 Fixed absolute limits. 2013-09-18 17:19:49 +03:00
Yulia Portnova dc4ce932ed Renamed cinder to manila.
Fixed setup.py, fixed bin scripts.
2013-09-02 09:59:07 +03:00