chore: add changed_on_delta_humanized field on dashboard schema (#15542)

* chore: add changed_on_delta_humanized field on dashboard schema

* fix ut
This commit is contained in:
Yongjie Zhao 2021-07-07 22:59:49 +01:00 committed by GitHub
parent 58cda8f8d6
commit ae160f7f21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -159,6 +159,7 @@ class DashboardGetResponseSchema(Schema):
owners = fields.List(fields.Nested(UserSchema))
roles = fields.List(fields.Nested(RolesSchema))
table_names = fields.String() # legacy nonsense
changed_on_humanized = fields.String(data_key="changed_on_delta_humanized")
class DatabaseSchema(Schema):

View File

@ -344,9 +344,10 @@ class TestDashboardApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixi
}
data = json.loads(rv.data.decode("utf-8"))
self.assertIn("changed_on", data["result"])
self.assertIn("changed_on_delta_humanized", data["result"])
for key, value in data["result"].items():
# We can't assert timestamp values
if key != "changed_on":
if key not in ("changed_on", "changed_on_delta_humanized",):
self.assertEqual(value, expected_result[key])
# rollback changes
db.session.delete(dashboard)