Esempio n. 1
0
    def test_add_props(self):
        old_node = Node(ElementTree.fromstring(NODE_XML))
        old_node.uri = 'vos:sometest'
        new_node = Node(ElementTree.fromstring(NODE_XML))
        new_node.props['quota'] = '1000'
        new_node.create = Mock(return_value=new_node.node)

        data = str(new_node)
        headers = {'size': str(len(data))}

        client = Client()
        client.get_node = Mock(return_value=old_node)
        client.get_node_url = Mock(return_value='http://foo.com/bar')
        mock_session = Mock()
        client.get_session = Mock(return_value=mock_session)

        client.add_props(new_node)
        client.get_session.assert_called_with('vos://foo.com!vospace/bar')
        mock_session.post.assert_called_with('http://foo.com/bar',
                                             headers=headers,
                                             data=data)
Esempio n. 2
0
from vos import Client

c = Client()

#for expnum in c.listdir('vos:cfis/solar_system/dbimages', force=True):
for expnum in open('expnum_list.txt').readlines():
    expnum = expnum.strip()
    n = c.get_node('vos:cfis/solar_system/dbimages/{}'.format(expnum), force=True)
    print n.uri
    for prop in n.props:
        if 'stationary' in prop:
           n.props[prop] = None
    c.add_props(n)
    print("Done")