Skip to content

Commit 108a048

Browse files
authored
Fix tests (#574)
1 parent f499e10 commit 108a048

5 files changed

+8
-10
lines changed

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: python
22
python:
3-
- "3.4"
4-
- "3.5"
3+
- "3.8"
54
install:
65
- pip install -U setuptools && pip install tox tox-travis coveralls
76
script:

tests/fixtures.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
SERVER_CERT_ZO_NE = MagicMock(name='zo-ne')
8787
SERVER_CERT_ZO_NE.server_certificate_metadata = {'Arn': 'arn:aws:123',
8888
'ServerCertificateName': 'zo-ne',
89-
'Expiration': datetime(2020, 4, 1, 12, 14, 14,
89+
'Expiration': datetime(2025, 4, 1, 12, 14, 14,
9090
tzinfo=timezone(timedelta(hours=2))),
9191
'Path': '/',
9292
'ServerCertificateId': '000',

tests/test_cli.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_invalid_definition():
4343

4444
result = runner.invoke(cli, ['print', 'myapp.yaml', '--region=aa-fakeregion-1', '123'], catch_exceptions=False)
4545

46-
assert 'error: invalid value for "definition"' in result.output.lower()
46+
assert 'error: invalid value for' in result.output.lower()
4747

4848

4949
def test_file_not_found():
@@ -193,8 +193,7 @@ def test_region_validation(monkeypatch):
193193
result = runner.invoke(cli, ['print', 'myapp.yaml', '--region=invalid-region', '123'],
194194
catch_exceptions=False)
195195

196-
assert ('Error: Invalid value for "--region": \'invalid-region\'. '
197-
'Region must be one of the following AWS regions:' in result.output)
196+
assert ('Region must be one of the following AWS regions:' in result.output)
198197

199198

200199
def test_print_replace_mustache(monkeypatch):
@@ -1800,7 +1799,7 @@ def test_scale_with_overwriting_zero_minsize(monkeypatch):
18001799
boto3.describe_auto_scaling_groups.return_value = {'AutoScalingGroups': [group]}
18011800
monkeypatch.setattr('boto3.client', MagicMock(return_value=boto3))
18021801
runner = CliRunner()
1803-
result = runner.invoke(cli, ['scale', 'myapp', '1', '2', '--region=aa-fakeregion-1', '--min_size', '1'],
1802+
result = runner.invoke(cli, ['scale', 'myapp', '1', '2', '--region=aa-fakeregion-1', '--min-size', '1'],
18041803
catch_exceptions=False)
18051804
assert 'Scaling myasg from 0 to 2 instances' in result.output
18061805

@@ -1816,7 +1815,7 @@ def test_scale_desired_capacity_smaller_than_min_size(monkeypatch):
18161815
boto3.describe_auto_scaling_groups.return_value = {'AutoScalingGroups': [group]}
18171816
monkeypatch.setattr('boto3.client', MagicMock(return_value=boto3))
18181817
runner = CliRunner()
1819-
result = runner.invoke(cli, ['scale', 'myapp', '1', '2', '--region=aa-fakeregion-1', '--min_size', '4'],
1818+
result = runner.invoke(cli, ['scale', 'myapp', '1', '2', '--region=aa-fakeregion-1', '--min-size', '4'],
18201819
catch_exceptions=False)
18211820
assert 'Desired capacity must be bigger than specified min_size value' in result.output
18221821

tests/test_elastigroup_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,5 +213,5 @@ def test_get_spotinst_account_data_failure():
213213

214214
with mock.patch('boto3.client') as MockHelper:
215215
MockHelper.return_value.get_template.return_value = template
216-
with raises(click.Abort, message="Expecting click.Abort error"):
216+
with raises(click.Abort):
217217
get_spotinst_account_data('fake-region', 'fake-stack-name')

tests/test_error_handling.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def test_unknown_error_show_stacktrace(mock_tempfile, mock_raven):
266266
senza.error_handling.sentry = senza.error_handling.setup_sentry("test")
267267
senza.error_handling.HandleExceptions.stacktrace_visible = True
268268
func = MagicMock(side_effect=Exception("something"))
269-
with raises(Exception, message="something"):
269+
with raises(Exception):
270270
senza.error_handling.HandleExceptions(func)()
271271

272272
mock_tempfile.assert_not_called()

0 commit comments

Comments
 (0)