Пример #1
0
    def test_init_quota(self):

        tests = [(test_account_1, test_quota_1, GENT, 'vsc400'),
                 (test_account_3, test_quota_2, BRUSSEL, 'vsc100')]

        for account, quota, site, fileset in tests:
            mock_client = mock.MagicMock()
            test_account = mkVscAccount(account)
            mock_client.account[test_account.vsc_id].quota.get.return_value = (
                200, quota)

            accountpageuser = user.VscTier2AccountpageUser(
                test_account.vsc_id,
                storage=config.VscStorage(),
                rest_client=mock_client,
                account=test_account,
                host_institute=site)

            self.assertEqual(accountpageuser.user_home_quota, [
                q['hard'] for q in quota if q['storage']['name'] == 'VSC_HOME'
                and q['fileset'] == fileset
            ][0])
            self.assertEqual(accountpageuser.user_data_quota, [
                q['hard'] for q in quota if q['storage']['name'] == 'VSC_DATA'
                and q['fileset'] == fileset
            ][0])
Пример #2
0
    def test_create_scratch_dir_tier2_user(self,
                                        mock_client,
                                        mock_gpfsoperations,
                                        ):

        test_account = mkVscAccount(test_account_1)
        accountpageuser = user.VscTier2AccountpageUser(test_account.vsc_id, rest_client=mock_client, account=test_account, host_institute=GENT)
        accountpageuser.create_scratch_dir('VSC_SCRATCH_KYUKON')
Пример #3
0
    def test_init_quota(self):

        mock_client = mock.MagicMock()
        test_account = mkVscAccount(test_account_1)
        mock_client.account[test_account.vsc_id].quota.get.return_value = (200, test_quota_1)

        accountpageuser = user.VscTier2AccountpageUser(test_account.vsc_id, rest_client=mock_client, account=test_account, host_institute=GENT)

        self.assertEqual(accountpageuser.user_home_quota, [q['hard'] for q in test_quota_1 if q['storage']['name'] == 'VSC_HOME' and q['fileset'] == 'vsc400'][0])
        self.assertEqual(accountpageuser.user_data_quota, [q['hard'] for q in test_quota_1 if q['storage']['name'] == 'VSC_DATA' and q['fileset'] == 'vsc400'][0])
Пример #4
0
        def set_up_accountpageuser(account, quota, site):
            mock_client = mock.MagicMock()
            test_account = mkVscAccount(account)
            mock_client.account[test_account.vsc_id].quota.get.return_value = (
                200, quota)

            return user.VscTier2AccountpageUser(test_account.vsc_id,
                                                storage=config.VscStorage(),
                                                rest_client=mock_client,
                                                account=test_account,
                                                host_institute=site)
Пример #5
0
    def test_create_scratch_dir_tier2_user(self, mock_client,
                                           mock_gpfsoperations):

        test_accounts = [(test_account_1, GENT), (test_account_3, BRUSSEL)]

        for account, site in test_accounts:
            test_account = mkVscAccount(account)
            accountpageuser = user.VscTier2AccountpageUser(
                test_account.vsc_id,
                storage=config.VscStorage(),
                rest_client=mock_client,
                account=test_account,
                host_institute=site)
            accountpageuser.create_scratch_dir(VSC_PRODUCTION_SCRATCH[site][0])