

@requests_mock.mock()
def test_upload_context(self, m):
    'Verify context (ie token) is passed to swift on upload.'
    head_req = m.head('http://127.0.0.1/glance_123', text='Some data', status_code=201)
    put_req = m.put('http://127.0.0.1/glance_123/123')
    self.config(swift_store_multi_tenant=True)
    store = Store(self.conf)
    store.configure()
    content = b'Some data'
    pseudo_file = six.BytesIO(content)
    store.add('123', pseudo_file, len(content), context=m.ctx)
    self.assertEqual(b'0123', head_req.last_request.headers['X-Auth-Token'])
    self.assertEqual(b'0123', put_req.last_request.headers['X-Auth-Token'])

dataset/ETHPy150Open openstack/glance_store/glance_store/tests/unit/test_swift_store.py TestMultiTenantStoreContext.test_upload_context/VarMisuse@99/179 `self`->`m`