Skip to content

Commit

Permalink
get_metadata refactor, tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
jgerardsimcock committed Jan 4, 2017
1 parent 3802c39 commit 487e3bd
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions datafs/core/data_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def authority(self):
def archive_path(self):
return self._archive_path

@property
def metadata(self):

def get_metadata(self):
return self.api.manager.get_metadata(self.archive_name)


Expand Down
2 changes: 1 addition & 1 deletion datafs/datafs.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def download(ctx, archive_name, filepath, version):
@click.pass_context
def metadata(ctx, archive_name):
var = ctx.obj.api.get_archive(archive_name)
click.echo(pprint.pformat(var.metadata))
click.echo(pprint.pformat(var.get_metadata()))


@cli.command()
Expand Down
2 changes: 1 addition & 1 deletion examples/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
.. code-block:: python
>>> print(var.metadata['description'])
>>> print(var.get_metadata()['description'])
My test data archive
Add a file to the archive
Expand Down
2 changes: 1 addition & 1 deletion examples/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
.. code-block:: python
>>> print(var.metadata['description'])
>>> print(var.get_metadata()['description'])
My test data archive
Add a file to the archive
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_cli_local(test_config):
assert result.exit_code == 0
assert "'description': 'My test data archive'" in result.output or "u'description': u'My test data archive'" in result.output
#test the api side of the operation
assert u'My test data archive' in api2.archives[0].metadata.values()
assert u'My test data archive' in api2.archives[0].get_metadata().values()



Expand Down Expand Up @@ -176,7 +176,7 @@ def test_cli_local(test_config):
assert data == 'Hoo Yah! Stay Stoked!'

#lets check to make sure our metadata update also passed through
assert 'Surfers Journal' == api2.archives[0].metadata['source']
assert 'Surfers Journal' == api2.archives[0].get_metadata()['source']


#test to assert metadata update
Expand Down
6 changes: 3 additions & 3 deletions tests/test_datafs.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def test_create_archive(self, api):
api.create_archive(archive_name, metadata={'testval': 'my test value'})
var = api.get_archive(archive_name)

testval = var.metadata['testval']
testval = var.get_metadata()['testval']

with pytest.raises(KeyError) as excinfo:
api.create_archive(archive_name)
Expand All @@ -180,12 +180,12 @@ def test_create_archive(self, api):
raise_on_err=False)
var = api.get_archive(archive_name)

assert testval == var.metadata[
assert testval == var.get_metadata()[
'testval'], "Test archive was incorrectly updated!"

var.update_metadata({'testval': 'a different test value'})

assert var.metadata[
assert var.get_metadata()[
'testval'] == 'a different test value', "Test archive was not updated!"

# Test archive deletion
Expand Down

0 comments on commit 487e3bd

Please sign in to comment.