Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasThelen committed Sep 19, 2020
1 parent 375ddb7 commit 3ca5879
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gwvolman/tests/lib/dataone/test_dataone_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ def test_generate_system_metadata():
assert sys_meta.rightsHolder.value() == rights_holder
assert sys_meta.checksum.value() == dataoneTypes.checksum(md5).value()
assert sys_meta.checksum.algorithm == 'MD5'
assert sys_meta.fileName.value() == name
assert sys_meta.fileName == name
32 changes: 31 additions & 1 deletion gwvolman/tests/lib/test_publish_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,34 @@ def test_publication_info():
mock_gc.sendRestRequest.return_value = mock_req

provider = PublishProvider(mock_gc, PUBLISHED_TALE['_id'], TOKEN)
assert provider.publication_info is True
assert provider.publication_info is True


def test_access_token():
mock_gc = mock.MagicMock(spec=GirderClient)
mock_req = mock.MagicMock()
mock_gc.get = mock_gc_get
mock_gc.sendRestRequest.return_value = mock_req

provider = PublishProvider(mock_gc, PUBLISHED_TALE['_id'], TOKEN)
assert provider.access_token == TOKEN['access_token']


def test_resource_server_token():
mock_gc = mock.MagicMock(spec=GirderClient)
mock_req = mock.MagicMock()
mock_gc.get = mock_gc_get
mock_gc.sendRestRequest.return_value = mock_req

provider = PublishProvider(mock_gc, PUBLISHED_TALE['_id'], TOKEN)
assert provider.access_token == TOKEN['resource_server']


def test_publish():
with pytest.raises(NotImplementedError):
mock_gc = mock.MagicMock(spec=GirderClient)
mock_req = mock.MagicMock()
mock_gc.get = mock_gc_get
mock_gc.sendRestRequest.return_value = mock_req
provider = PublishProvider(mock_gc, PUBLISHED_TALE['_id'], TOKEN)
provider.publish()

0 comments on commit 3ca5879

Please # to comment.