Skip to content
Permalink
Browse files

tests: remove raise tests

  • Loading branch information...
etienne-napoleone committed Dec 20, 2018
1 parent 1ed8756 commit 961c5efdf3597aab0830759119df67bd2c1dbf22
Showing with 1 addition and 38 deletions.
  1. +1 −4 tests/mock.py
  2. +0 −34 tests/test_goutte.py
@@ -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:
@@ -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'),
@@ -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'),

0 comments on commit 961c5ef

Please sign in to comment.
You can’t perform that action at this time.