def test_make_available__lifetime_not_specified__should_call_add_rule__lifetime_none(mocker, rucio): mocker.patch.dict(rucio.instance_config, {'destination_rse': 'SWAN-EOS'}) mocker.patch.object(rucio, 'add_replication_rule', return_value={}) handler = ReplicaModeHandler(namespace='atlas', rucio=rucio) handler.make_available(scope='scope', name='name') expected_dids = [{'scope': 'scope', 'name': 'name'}] rucio.add_replication_rule.assert_called_once_with(dids=expected_dids, rse_expression='SWAN-EOS', copies=1, lifetime=None)
def post(self): namespace = self.get_query_argument('namespace') json_body = self.get_json_body() did = json_body['did'] scope, name = did.split(':') rucio_instance = self.rucio.for_instance(namespace) mode = rucio_instance.instance_config.get('mode', 'replica') if mode == 'replica': handler = ReplicaModeHandler(namespace, rucio_instance) elif mode == 'download': handler = DownloadModeHandler(namespace, rucio_instance) try: output = handler.make_available(scope, name) except RucioAuthenticationException: self.set_status(401) output = {'error': 'Authentication error'} self.finish(json.dumps(output))