Merge "Add a note about sqlalchemy metadata"
This commit is contained in:
commit
3eb23d2276
|
@ -733,11 +733,13 @@ class TestArtifacts(ZuulDBTestCase, BaseTestWeb, AnsibleZuulTestCase):
|
|||
"job_name=project-test1").json()
|
||||
self.assertEqual(len(build_query), 1)
|
||||
self.assertEqual(len(build_query[0]['artifacts']), 3)
|
||||
arts = build_query[0]['artifacts']
|
||||
arts.sort(key=lambda x: x['name'])
|
||||
self.assertEqual(build_query[0]['artifacts'], [
|
||||
{'url': 'http://example.com/tarball',
|
||||
'name': 'tarball'},
|
||||
{'url': 'http://example.com/docs',
|
||||
'name': 'docs'},
|
||||
{'url': 'http://logs.example.com/build/relative/docs',
|
||||
'name': 'relative'},
|
||||
{'url': 'http://example.com/tarball',
|
||||
'name': 'tarball'},
|
||||
])
|
||||
|
|
|
@ -223,6 +223,11 @@ class SQLConnection(BaseConnection):
|
|||
|
||||
def createArtifact(self, *args, **kw):
|
||||
session = orm.session.Session.object_session(self)
|
||||
# SQLAlchemy reserves the 'metadata' attribute on
|
||||
# object models, so our model and table names use
|
||||
# 'meta', but here we accept data directly from
|
||||
# zuul_return where it's called 'metadata'. Transform
|
||||
# the attribute name.
|
||||
if 'metadata' in kw:
|
||||
kw['meta'] = kw['metadata']
|
||||
del kw['metadata']
|
||||
|
|
Loading…
Reference in New Issue