Skip to content

Commit

Permalink
tests: remove raise tests
Browse files Browse the repository at this point in the history
  • Loading branch information
etienne-napoleone committed Dec 20, 2018
1 parent 1ed8756 commit 961c5ef
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 38 deletions.
5 changes: 1 addition & 4 deletions tests/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@ def __init__(self, name=None, snapshots=None, throw=None):
self.throw = throw

def get_snapshots(self):
if self.throw:
raise self.throw
return self.snapshots

def snapshot(self, name):
if self.throw:
raise self.throw
pass


class Droplet:
Expand Down
34 changes: 0 additions & 34 deletions tests/test_goutte.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,6 @@ def test_snapshot_volume(caplog):
assert 'testvol' in caplog.records[0].message


def test_snapshot_volume_raise(caplog):
exceptions = [
digitalocean.baseapi.TokenError,
digitalocean.baseapi.DataReadError,
digitalocean.baseapi.JSONReadError,
digitalocean.baseapi.NotFoundError,
Exception,
]
for exception in exceptions:
volume = mock.Volume(name='testvol', throw=exception)
with caplog.at_level('INFO'):
main._snapshot_volume(volume)
assert len(caplog.records) == 1
assert caplog.records[0].levelname == 'ERROR'
caplog.clear()


def test_prune_volume_snapshots(caplog):
volume = mock.Volume('testvol', [
mock.Snapshot(name='goutte-snapshot1', created_at='2018'),
Expand All @@ -87,23 +70,6 @@ def test_prune_volume_snapshots_goutte_prefix_only(caplog):
assert len(caplog.records) == 0


def test_prune_volume_snapshots_raise(caplog):
exceptions = [
digitalocean.baseapi.TokenError,
digitalocean.baseapi.DataReadError,
digitalocean.baseapi.JSONReadError,
digitalocean.baseapi.NotFoundError,
Exception,
]
for exception in exceptions:
volume = mock.Volume(name='testvol', throw=exception)
with caplog.at_level('INFO'):
main._prune_volume_snapshots(volume, 1)
assert len(caplog.records) == 1
assert caplog.records[0].levelname == 'ERROR'
caplog.clear()


def test_order_snapshots():
snapshots = [
mock.Snapshot(created_at='2014-01-26T11:20:14Z'),
Expand Down

0 comments on commit 961c5ef

Please sign in to comment.