New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add extras fields to discussion #1360
Add extras fields to discussion #1360
Conversation
b545845
to
a26a0ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine, but the test method needs to be renamed
udata/tests/test_discussions.py
Outdated
@@ -100,6 +100,44 @@ def test_new_discussion_missing_subject(self): | |||
}) | |||
self.assertStatus(response, 400) | |||
|
|||
def test_new_discussion(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function must be renamed (test_new_discussion_with_extras
?) because it's already used (and so one of the test is hiding the other)
udata/tests/test_discussions.py
Outdated
@@ -100,6 +100,44 @@ def test_new_discussion_missing_subject(self): | |||
}) | |||
self.assertStatus(response, 400) | |||
|
|||
def test_new_discussion(self): | |||
self.app.config['USE_METRICS'] = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you're only testing the extras part, I think you can safely remove everything related to metrics
udata/tests/test_discussions.py
Outdated
self.assert201(response) | ||
|
||
dataset.reload() | ||
self.assertEqual(dataset.metrics['discussions'], 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 lines too (metrics related, can be removed)
a26a0ee
to
2204b8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget the entry in CHANGELOG.
75ff993
to
8e15d01
Compare
Done. |
udata/tests/test_discussions.py
Outdated
self.assertEqual(discussion.user, user) | ||
self.assertEqual(len(discussion.discussion), 1) | ||
self.assertIsNotNone(discussion.created) | ||
self.assertIsNone(discussion.closed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it important to check that discussion.created
and discussion.closed
aren't in the discussion ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a copy/paste from the add_new_discussion test.
It could be deleted.
We need it for transport.data.gouv.fr It'll be only accessible through API for now
8e15d01
to
408bb20
Compare
What can we do for this PR to be merged? I see there's already a consensus. |
I’ll merge it. Forgot that @l-vincent-l probably does not have the permission to do so. |
We need it for transport.data.gouv.fr
It'll be only accessible through API for now
fix #1359