Skip to content

Commit

Permalink
Renamed record() to log() since record() in the future will refer to …
Browse files Browse the repository at this point in the history
…logging while executing a transformation
  • Loading branch information
JasperVanDenBosch committed Jan 18, 2015
1 parent b140d99 commit 9e89e23
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion executables/record → executables/log
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ parser.add_argument('ancestor', help='Image that was the basis of the transforma
parser.add_argument('new', help='Where the resulting image was stored.')

args = parser.parse_args()
niprov.record(args.transformation, args.ancestor, args.new)
niprov.log(args.transformation, args.ancestor, args.new)
2 changes: 1 addition & 1 deletion niprov/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from niprov.discovery import discover
from niprov.inspection import inspect
from niprov.reporting import report
from niprov.recording import record
from niprov.logging import log
2 changes: 1 addition & 1 deletion niprov/recording.py → niprov/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from niprov.jsonfile import JsonFile


def record(transformation, ancestor, new, repository=JsonFile()):
def log(transformation, ancestor, new, repository=JsonFile()):
"""
Record an transformation that creates a new image.
"""
Expand Down
14 changes: 7 additions & 7 deletions tests/recording.py → tests/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@
from datetime import datetime as dt


class RecordingTests(unittest.TestCase):
class loggingTests(unittest.TestCase):

def test_Returns_provenance(self):
from niprov.recording import record
from niprov.logging import log
repo = Mock()
repo.knowsByPath.return_value = False
ancestor = '/p/f1'
new = '/p/f2'
trans = 'Something cool'
provenance = record(trans, ancestor, new, repository=repo)
provenance = log(trans, ancestor, new, repository=repo)
self.assertEqual(provenance['ancestor'], ancestor)
self.assertEqual(provenance['path'], new)
self.assertEqual(provenance['transformation'], trans)

def test_Stores_provenance(self):
from niprov.recording import record
from niprov.logging import log
repo = Mock()
repo.knowsByPath.return_value = False
provenance = record('trans', 'old', 'new', repository=repo)
provenance = log('trans', 'old', 'new', repository=repo)
repo.add.assert_any_call(provenance)

def test_Copies_fields_from_known_ancestor(self):
from niprov.recording import record
from niprov.logging import log
ancestor = '/p/f1'
ancestorProv = {'acquired':dt.now(),'subject':'JB','protocol':'T3'}
repo = Mock()
repo.byPath.side_effect = lambda x: {ancestor:ancestorProv}[x]
provenance = record('trans', ancestor, 'new', repository=repo)
provenance = log('trans', ancestor, 'new', repository=repo)
self.assertEqual(provenance['acquired'], ancestorProv['acquired'])
self.assertEqual(provenance['subject'], ancestorProv['subject'])
self.assertEqual(provenance['protocol'], ancestorProv['protocol'])
Expand Down

0 comments on commit 9e89e23

Please sign in to comment.