USGS-CIDA/PubsWarehouse_UI — pull request #116 by wblondeau-usgs (2014-12-09 23:09:44+00:00)
Title: utils and tests for supersede

These are the changes:

- in PubsFlask.py, modified the @app.route('/publication/') to include a call to utils.py.add_supersede_pubs. also modified import statement.

- in utils.py, added:
- add_supersede_pubs (a wrapper function)
- apply_preceding_and_superseding, which inserts supersede data into pubdata
- preceding_and_superseding, which invokes the legacy service
- make_relationship_graph, a utility which creates Python graphs of relationship
and removed supersedes, which is no longer needed.

- in test_utils.feature, added Scenario: supersedes and precedes functions behave correctly

- in test_utils.py, added corresponding functions:
- @step(u'Given I have a static Python representation of JSON data for a publication known to have related superseding or preceding publications')
- @step(u'When I pass it to add_supersede_pubs')
- @step(u'Then I receive a copy that is identical except for the addition of the link information')

NOTES

The functions in utils.py seem verbose and excessive, although a lot of that is the documentation. I factored the work out into separate functions to make it easier to exercise pieces of functionality separately.

The tests are integration tests, because they invoke the live legacy service to obtain content. Other than that, though, I did not test preexisting functionality.