Skip to content

Commit 41fac37

Browse files
committed
Organize the python code conform with standards
1 parent 87ed937 commit 41fac37

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

oca/tests/integration_test_image.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
import oca
1010
from oca.exceptions import OpenNebulaException
1111

12-
condition = bool(os.environ.get('OCA_INT_TESTS', False)) & bool(os.environ.get('OCA_INT_IMAGE_TESTS', False))
12+
condition = (bool(os.environ.get(
13+
'OCA_INT_TESTS', False)) and bool(os.environ.get(
14+
'OCA_INT_IMAGE_TESTS', False)))
1315

1416

1517
@unittest.skipUnless(condition, "Skipping integration tests")
@@ -20,7 +22,8 @@ def setUp(self):
2022
except KeyError:
2123
pass
2224

23-
self.c = oca.Client(os.environ['OCA_INT_TESTS_ONE_AUTH'], os.environ['OCA_INT_TESTS_ONE_XMLRPC'])
25+
self.c = oca.Client(os.environ['OCA_INT_TESTS_ONE_AUTH'],
26+
os.environ['OCA_INT_TESTS_ONE_XMLRPC'])
2427

2528
def tearDown(self):
2629
print("teardown")
@@ -31,24 +34,36 @@ def tearDown(self):
3134
img.delete()
3235

3336
def test_allocate(self):
34-
path = os.environ.get('OCA_INT_TEST_IMAGE_PATH', '~/ttyvd-context.qcow2')
35-
# img = oca.Image.allocate(self.c, '<TEMPLATE><NAME>inttest_img_1</NAME><PATH>{p}</PATH></TEMPLATE>'.format(p=path), 1)
37+
# path = os.environ.get('OCA_INT_TEST_IMAGE_PATH',
38+
# '~/ttyvd-context.qcow2')
3639

37-
img = oca.Image.allocate(self.c, '<TEMPLATE><NAME>inttest_img_4</NAME><TYPE>DATABLOCK</TYPE><SIZE>382</SIZE></TEMPLATE>', 1)
38-
img = oca.Image.allocate(self.c, '<TEMPLATE><NAME>inttest_img_5</NAME><TYPE>DATABLOCK</TYPE><SIZE>382</SIZE></TEMPLATE>', 1)
39-
img = oca.Image.allocate(self.c, '<TEMPLATE><NAME>inttest_img_6</NAME><TYPE>DATABLOCK</TYPE><SIZE>382</SIZE></TEMPLATE>', 1)
40+
oca.Image.allocate(
41+
self.c, '<TEMPLATE><NAME>inttest_img_4</NAME><TYPE>DATABLOCK</TYPE>\
42+
<SIZE>382</SIZE></TEMPLATE>', 1)
43+
44+
oca.Image.allocate(
45+
self.c, '<TEMPLATE><NAME>inttest_img_5</NAME><TYPE>DATABLOCK</TYPE>\
46+
<SIZE>382</SIZE></TEMPLATE>', 1)
47+
oca.Image.allocate(
48+
self.c, '<TEMPLATE><NAME>inttest_img_6</NAME><TYPE>DATABLOCK</TYPE>\
49+
<SIZE>382</SIZE></TEMPLATE>', 1)
4050

4151
def test_allocate_with_same_name(self):
4252
with self.assertRaises(OpenNebulaException):
43-
img = oca.Image.allocate(self.c, '<TEMPLATE><NAME>inttest_img_6</NAME><TYPE>DATABLOCK</TYPE><SIZE>382</SIZE></TEMPLATE>', 1)
44-
img = oca.Image.allocate(self.c, '<TEMPLATE><NAME>inttest_img_6</NAME><TYPE>DATABLOCK</TYPE><SIZE>382</SIZE></TEMPLATE>', 1)
53+
oca.Image.allocate(
54+
self.c, '<TEMPLATE><NAME>inttest_img_6</NAME>\
55+
<TYPE>DATABLOCK</TYPE><SIZE>382</SIZE></TEMPLATE>', 1)
56+
oca.Image.allocate(
57+
self.c, '<TEMPLATE><NAME>inttest_img_6</NAME>\
58+
<TYPE>DATABLOCK</TYPE><SIZE>382</SIZE></TEMPLATE>', 1)
4559

4660
def test_update(self):
4761
imgs = oca.ImagePool(self.c)
4862
imgs.info()
4963
for img in imgs:
5064
if img.name.startswith('inttest'):
51-
img.update('<TEMPLATE><NAME>inttest_img_6</NAME><TYPE>DATABLOCK</TYPE><SIZE>382</SIZE></TEMPLATE>')
65+
img.update('<TEMPLATE><NAME>inttest_img_6</NAME>\
66+
<TYPE>DATABLOCK</TYPE><SIZE>382</SIZE></TEMPLATE>')
5267

5368
def test_chown(self):
5469
imgs = oca.ImagePool(self.c)

0 commit comments

Comments
 (0)