forked from rucio/rucio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: upload prototype - rucio#3250
- Loading branch information
1 parent
10e6b3a
commit d082a8f
Showing
2 changed files
with
82 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Copyright 2019 CERN for the benefit of the ATLAS collaboration. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Authors: | ||
# - Hannes Hansen <hannes.jakob.hansen@cern.ch>, 2019 | ||
# - Tobias Wegner <twegner@cern.ch>, 2019 | ||
# - Mario Lassnig <mario.lassnig@cern.ch>, 2019 | ||
# | ||
# PY3K COMPATIBLE | ||
|
||
import logging | ||
import shutil | ||
|
||
import nose.tools | ||
import os.path | ||
|
||
from rucio.client.client import Client | ||
from rucio.client.uploadclient import UploadClient | ||
from rucio.common.utils import generate_uuid | ||
from rucio.tests.common import file_generator | ||
|
||
|
||
class TestUploadClient(object): | ||
|
||
def setup(self): | ||
logger = logging.getLogger('dlul_client') | ||
logger.addHandler(logging.StreamHandler()) | ||
logger.setLevel(logging.DEBUG) | ||
self.client = Client() | ||
self.upload_client = UploadClient(_client=self.client, logger=logger) | ||
|
||
self.file_path = file_generator() | ||
self.scope = 'mock' | ||
self.name = os.path.basename(self.file_path) | ||
self.rse = select_rse() | ||
self.guid = generate_uuid() | ||
|
||
item = {'path': self.file_path, | ||
'rse': self.rse, | ||
'did_scope': self.scope, | ||
'did_name': self.name, | ||
'guid': self.guid} | ||
|
||
def teardown(self): | ||
shutil.rmtree('mock') | ||
|
||
def select_rse(self): | ||
# alg. for picking up rse(s) | ||
return 'MOCK4' | ||
|
||
def test_download_item(self): | ||
""" DOWNLOAD (CLIENT): Download DIDs """ | ||
|
||
# Upload the test item | ||
result = self.upload_client.upload([item]) | ||
nose.tools.assert_true(result) |