okfn/ckan — pull request #183 by seanh (2012-11-22 17:05:09+00:00)
Title: Refactor dashboard tests

@tobes Could you review this? The test refactoring and activity stream fixing is not so controversial but there is also some refactoring that we discussed on IRC around getting a group's packages.

- Refactoring of test_activity.py, test_follow.py and test_dashboard.py, add clearer tests in test_dashboard.py for the contents of your dashboard activity stream (previously it was not testing that activities from your followed groups appear in your activity stream, but it wasn't obvious from test_activity.py that this was missing)

- Refactor `group.members_of_type()`, `group.active_packages()` and `action.group_package_show()` to have just one method for getting a group's package not three. This new `group.packages()` method is in the model, so it can be called from the logic but also the activity streams model can call it as well (and SQLAlchemy is encapsulated in the model)

- Refactor `action.group_activity_list()`, move the SQLAlchemy into the model, now other activity streams functions in the model can use it as well

- Add activities from followed groups and their datasets into user's dashboard activity stream