Skip to content

Commit 47e2ce3

Browse files
committed
Fix tests
1 parent 2cb4d7e commit 47e2ce3

File tree

2 files changed

+17
-30
lines changed

2 files changed

+17
-30
lines changed

test/user.py

+11-16
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def test_person_instantiation(self):
352352
mock_client = mock.MagicMock()
353353
test_account = mkVscAccount(account)
354354
accountpageuser = user.VscAccountPageUser(
355-
test_account.vsc_id,
355+
test_account.vsc_id,
356356
rest_client=mock_client,
357357
account=test_account)
358358

@@ -417,10 +417,10 @@ def test_init_quota(self):
417417
mock_client.account[test_account.vsc_id].quota.get.return_value = (200, quota)
418418

419419
accountpageuser = user.VscTier2AccountpageUser(
420-
test_account.vsc_id,
420+
test_account.vsc_id,
421421
storage=config.VscStorage(),
422422
rest_client=mock_client,
423-
account=test_account,
423+
account=test_account,
424424
host_institute=site)
425425

426426
self.assertEqual(
@@ -442,8 +442,6 @@ class UserDeploymentTest(TestCase):
442442
def test_process_regular_users(self, mock_client):
443443

444444
test_accounts = [(['vsc40075', 'vsc40123', 'vsc40039'], GENT), (['vsc10001'], BRUSSEL)]
445-
Options = namedtuple("Options", ['dry_run'])
446-
options = Options(dry_run=False)
447445

448446
mock_client.return_value = mock.MagicMock()
449447

@@ -455,7 +453,7 @@ def test_process_regular_users(self, mock_client):
455453
mock_user.return_value = mock.MagicMock()
456454
mock_user_instance = mock_user.return_value
457455

458-
user.process_users(options, accounts, storage_name, mock_client, host_institute=site)
456+
user.process_users(accounts, storage_name, mock_client, host_institute=site, dry_run=False)
459457

460458
mock_user_instance.set_scratch_quota.assert_not_called()
461459
mock_user_instance.set_home_quota.assert_not_called()
@@ -495,10 +493,10 @@ def test_create_home_dir_tier2_user(self, mock_client, mock_gpfsoperations):
495493
for account, site in test_accounts:
496494
test_account = mkVscAccount(account)
497495
accountpageuser = user.VscTier2AccountpageUser(
498-
test_account.vsc_id,
496+
test_account.vsc_id,
499497
storage=config.VscStorage(),
500498
rest_client=mock_client,
501-
account=test_account,
499+
account=test_account,
502500
host_institute=site)
503501
accountpageuser.create_home_dir()
504502

@@ -511,10 +509,10 @@ def test_create_data_dir_tier2_user(self, mock_client, mock_gpfsoperations):
511509
for account, site in test_accounts:
512510
test_account = mkVscAccount(account)
513511
accountpageuser = user.VscTier2AccountpageUser(
514-
test_account.vsc_id,
512+
test_account.vsc_id,
515513
storage=config.VscStorage(),
516514
rest_client=mock_client,
517-
account=test_account,
515+
account=test_account,
518516
host_institute=site)
519517
accountpageuser.create_data_dir()
520518

@@ -527,10 +525,10 @@ def test_create_scratch_dir_tier2_user(self, mock_client, mock_gpfsoperations):
527525
for account, site in test_accounts:
528526
test_account = mkVscAccount(account)
529527
accountpageuser = user.VscTier2AccountpageUser(
530-
test_account.vsc_id,
528+
test_account.vsc_id,
531529
storage=config.VscStorage(),
532530
rest_client=mock_client,
533-
account=test_account,
531+
account=test_account,
534532
host_institute=site)
535533
accountpageuser.create_scratch_dir(VSC_PRODUCTION_SCRATCH[site][0])
536534

@@ -540,9 +538,6 @@ def test_process_regular_users_quota(self, mock_client):
540538
TestQuota = namedtuple("TestQuota", ['user'])
541539
test_accounts = [(['vsc40075', 'vsc40123', 'vsc40039'], GENT), (['vsc10001'], BRUSSEL)]
542540

543-
Options = namedtuple("Options", ['dry_run'])
544-
options = Options(dry_run=False)
545-
546541
mock_client.return_value = mock.MagicMock()
547542

548543
for accounts, site in test_accounts:
@@ -554,7 +549,7 @@ def test_process_regular_users_quota(self, mock_client):
554549
mock_user.return_value = mock.MagicMock()
555550
mock_user_instance = mock_user.return_value
556551

557-
user.process_users_quota(options, test_quota, storage_name, mock_client, host_institute=site)
552+
user.process_users_quota(test_quota, storage_name, mock_client, host_institute=site, dry_run=False)
558553

559554
if storage_name in (VSC_HOME,):
560555
self.assertEqual(mock_user_instance.set_home_quota.called, True)

test/vo.py

+6-14
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import vsc.config.base as config
2929

3030
from vsc.accountpage.wrappers import VscAutogroup
31-
from vsc.config.base import VSC_DATA, VSC_HOME, GENT_PRODUCTION_SCRATCH, VSC_DATA_SHARED
31+
from vsc.config.base import VSC_DATA, VSC_HOME, GENT_PRODUCTION_SCRATCH, VSC_DATA_SHARED, GENT
3232
from vsc.install.testing import TestCase
3333

3434

@@ -47,8 +47,6 @@ def test_process_regular_vos(self, mock_storage, mock_client):
4747
"""Test to see if the VscTier2AccountpageVo class is used properly"""
4848

4949
test_vo_id = "gvo00002"
50-
Options = namedtuple("Options", ['dry_run'])
51-
options = Options(dry_run=False)
5250

5351
mc = mock_client.return_value
5452
mc.vo = mock.MagicMock()
@@ -85,7 +83,7 @@ def test_process_regular_vos(self, mock_storage, mock_client):
8583
with mock.patch.object(vo.VscTier2AccountpageVo, 'set_member_scratch_quota') as mock_s_m_s_quota:
8684
with mock.patch.object(vo.VscTier2AccountpageVo, 'create_member_scratch_dir') as mock_cr_m_s_dir:
8785
mock_user.return_value = mock.MagicMock()
88-
ok, errors = vo.process_vos(options, [test_vo_id], storage_name, mc, date)
86+
ok, errors = vo.process_vos([test_vo_id], storage_name, mc, date, GENT, False)
8987
self.assertEqual(errors, {})
9088

9189
if storage_name in (VSC_HOME, VSC_DATA):
@@ -117,8 +115,6 @@ def test_process_regular_vos(self, mock_storage, mock_client):
117115
def test_process_non_gent_institute_vos(self, mock_storage, mock_client):
118116

119117
test_vo_id = "gvo00018"
120-
Options = namedtuple("Options", ['dry_run'])
121-
options = Options(dry_run=False)
122118

123119
mc = mock_client.return_value
124120
mc.vo = mock.MagicMock()
@@ -156,7 +152,7 @@ def test_process_non_gent_institute_vos(self, mock_storage, mock_client):
156152
with mock.patch.object(vo.VscTier2AccountpageVo, 'create_member_scratch_dir') as mock_cr_m_s_dir:
157153

158154
mock_user.return_value = mock.MagicMock()
159-
ok, errors = vo.process_vos(options, [test_vo_id], storage_name, mc, "99991231")
155+
ok, errors = vo.process_vos([test_vo_id], storage_name, mc, "99991231", GENT, False)
160156
self.assertEqual(errors, {})
161157

162158
if storage_name in (VSC_HOME, VSC_DATA):
@@ -185,8 +181,6 @@ def test_process_non_gent_institute_vos(self, mock_storage, mock_client):
185181
def test_process_gent_institute_vo(self, mock_storage, mock_client):
186182

187183
test_vo_id = "gvo00012"
188-
Options = namedtuple("Options", ['dry_run'])
189-
options = Options(dry_run=False)
190184

191185
mc = mock_client.return_value
192186
mc.vo = mock.MagicMock()
@@ -224,7 +218,7 @@ def test_process_gent_institute_vo(self, mock_storage, mock_client):
224218
with mock.patch.object(vo.VscTier2AccountpageVo, 'create_member_scratch_dir') as mock_cr_m_s_dir:
225219

226220
mock_user.return_value = mock.MagicMock()
227-
ok, errors = vo.process_vos(options, [test_vo_id], storage_name, mc, "99991231")
221+
ok, errors = vo.process_vos([test_vo_id], storage_name, mc, "99991231", GENT, False)
228222
self.assertEqual(errors, {})
229223

230224
mock_cr_s_fileset.assert_not_called()
@@ -242,8 +236,6 @@ def test_process_gent_institute_vo(self, mock_storage, mock_client):
242236
def test_process_gent_institute_vo_data_share(self, mock_storage, mock_client):
243237

244238
test_vo_id = "gvo03442"
245-
Options = namedtuple("Options", ['dry_run'])
246-
options = Options(dry_run=False)
247239

248240
mc = mock_client.return_value
249241
mc.vo = mock.MagicMock()
@@ -274,7 +266,7 @@ def test_process_gent_institute_vo_data_share(self, mock_storage, mock_client):
274266
members=['vsc40075'],
275267
description="test autogroup"
276268
)
277-
ok, errors = vo.process_vos(options, [test_vo_id], storage_name, mc, "99991231")
269+
ok, errors = vo.process_vos([test_vo_id], storage_name, mc, "99991231", GENT, False)
278270
self.assertEqual(errors, {})
279271

280272
mock_cr_s_fileset.assert_not_called()
@@ -297,7 +289,7 @@ def test_create_sharing_fileset(self, mock_gpfs):
297289
mc.vo = mock.MagicMock()
298290
v = mock.MagicMock()
299291
mc.vo[test_vo_id].get.return_value = v
300-
292+
301293

302294
with mock.patch('vsc.administration.vo.mkVscAccount') as mock_mkvscaccount:
303295
mock_mkvscaccount.side_effect = IndexError("Nope")

0 commit comments

Comments
 (0)