Opened 15 years ago
Closed 13 years ago
#146 closed enhancement (fixed)
Make messaging system testable
| Reported by: | Christopher Allan Webber | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | programming | Keywords: | bitesized |
| Cc: | Parent Tickets: |
Description (last modified by )
We should make it possible to test the messaging system.
If you look at mediagoblin/utils.py you can see what happens when we _activate_testing() for some other things... ie, we insert template context info like so:
if TESTS_ENABLED:
TEMPLATE_TEST_CONTEXT[template_path] = context
Maybe we should do something similar with messaging? Either we should store in a dictionary like TEMPLATE_TEST_CONTEXT, maybe TEST_MESSAGES (which gets wiped by clear_test_buckets()) or we should store in the session like request.session['test_messages'] (should also get wiped by clear_test_buckets())
I'm assigning this to Caleb Davis who I think is a good fit for it.
Change History (24)
comment:1 by , 15 years ago
| Owner: | changed from to |
|---|
comment:3 by , 15 years ago
| Milestone: | 0.0.4 → 0.0.5 |
|---|
We release 0.0.4, so I'm bumping this to 0.0.5.
comment:4 by , 15 years ago
Seems like the best way to do this is to move the messaging functions into util.py.
comment:5 by , 15 years ago
Indeed, though I think Aaron is facing some of this stuff in http://bugs.foocorp.net/issues/444, so adding him to this bug.
comment:7 by , 15 years ago
I thought about moving messaging into util.py, but you're right - it's a junk drawer of functionality. So instead I imported util.py into messages.py to get access to the globals TESTS_ENABLED and TEMPLATE_TEST_CONTEXT. However, messages.py is already being imported in util.py, so I'm not sure if there will be any circular reference problems. I think the best solution would be to move the test globals into their own file which can be imported wherever.
comment:8 by , 15 years ago
| Milestone: | 0.0.5 → 0.1.0 |
|---|
comment:9 by , 15 years ago
So should this wait until 444 is resolved? I don't want to move messaging into util.py if that's just going to create a headache when it comes time to refactor it.
comment:10 by , 15 years ago
| Milestone: | 0.1.0 → 0.2.0 |
|---|
comment:11 by , 15 years ago
| Milestone: | 0.2.0 → 0.2.1 |
|---|
comment:11 by , 14 years ago
Yes it should be possible to move forward with this now. Chris Moylan, if you're still interested, feel free to ping me on IRC!
comment:12 by , 14 years ago
The original url for this bug was http://bugs.foocorp.net/issues/436 .
Relations:
#154: related
comment:13 by , 14 years ago
No response recently from Chris Moylan on this. I'll send him an email. But if someone wants to just pick this up in the meanwhile they're welcome to. Should be reasonably simple.
comment:14 by , 14 years ago
| Milestone: | 0.2.1 |
|---|---|
| Type: | defect → enhancement |
comment:15 by , 13 years ago
| Description: | modified (diff) |
|---|---|
| Keywords: | bitesized added |
comment:16 by , 13 years ago
| Owner: | removed |
|---|---|
| Status: | accepted → assigned |
Removing assignment. Again, another good bug for someone wanting something small, esp for OPW/GSoC prep.
comment:17 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Wait, we have tests on messages! I'm removing this :)
comment:18 by , 13 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
Wait, no, I'm misreading.
We have tests on test_messages, but this isn't what this bug is about. The suggestion here is that in unit testing mode the tests should be appended to some debug information that we can query. Reopening!
comment:19 by , 13 years ago
I believe I implemented this ticket in branch 146_debug_message at my fork: https://gitorious.org/~gabithume/mediagoblin/gabithume-mediagoblin/commits/146_debug_message
In summary, I changed mediagoblin/tests/test_messages.py and mediagoblin/messages.py to test messages.add_message() function. This is done appending messages in messages.ADD_MESSAGE_TEST and verifying its presence after adding a new message.
I already tested (running runtests.sh) and verified the modified files with PEP-8.
Please, let me know if there is anything I have to change.
Thanks a lot!
comment:20 by , 13 years ago
| Status: | reopened → review |
|---|

Assigning to cmoylan!