Ejemplo n.º 1
0
    def test_export_rest(self):
        """ EXPORT (REST): Test the export of data."""
        mw = []
        headers1 = {
            'X-Rucio-Account': 'root',
            'X-Rucio-Username': '******',
            'X-Rucio-Password': '******'
        }
        r1 = TestApp(auth_app.wsgifunc(*mw)).get('/userpass',
                                                 headers=headers1,
                                                 expect_errors=True)
        token = str(r1.header('X-Rucio-Auth-Token'))
        headers2 = {
            'X-Rucio-Type': 'user',
            'X-Rucio-Account': 'root',
            'X-Rucio-Auth-Token': str(token)
        }

        r2 = TestApp(export_app.wsgifunc(*mw)).get('/',
                                                   headers=headers2,
                                                   expect_errors=True)
        rses = [export_rse(rse['rse']) for rse in list_rses()]
        assert_equal(r2.status, 200)
        assert_equal(
            r2.body,
            render_json(**{
                'rses': rses,
                'distances': export_distances()
            }))
Ejemplo n.º 2
0
 def test_export_client(self):
     """ EXPORT (CLIENT): Test the export of data."""
     export_client = ExportClient()
     data = export_client.export_data()
     rses = {}
     for rse in list_rses():
         rse_name = rse['rse']
         rses[rse_name] = export_rse(rse_name)
     assert_equal(data['rses'], parse_response(render_json(**rses)))
     assert_equal(data['distances'], parse_response(render_json(**export_distances())))
Ejemplo n.º 3
0
def export_rses(session=None):
    """
    Export RSE data.

    :param session: database session in use.
    """
    data = {}
    for rse in rse_module.list_rses(session=session):
        rse_name = rse['rse']
        data[rse_name] = rse_module.export_rse(rse_name, session=session)

    return data
Ejemplo n.º 4
0
def export_rses(vo='def', session=None):
    """
    Export RSE data.

    :param vo: The VO to export.
    :param session: database session in use.
    """
    data = {}
    for rse in rse_module.list_rses(filters={'vo': vo}, session=session):
        rse_id = rse['id']
        data[rse_id] = rse_module.export_rse(rse_id, session=session)

    return data
Ejemplo n.º 5
0
def export_data(session=None):
    """
    Export data.

    :param session: database session in use.
    """
    data = {
        'rses': [
            rse_module.export_rse(rse['rse'], session=session)
            for rse in rse_module.list_rses(session=session)
        ],
        'distances':
        distance_module.export_distances(session=session)
    }
    return data
Ejemplo n.º 6
0
 def test_export_core(self):
     """ EXPORT (CORE): Test the export of data."""
     data = export_data()
     assert_equal(data['rses'],
                  [export_rse(rse['rse']) for rse in list_rses()])
     assert_equal(data['distances'], export_distances())