Skip to content

Commit

Permalink
Fix tests (#574)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcs authored Sep 23, 2020
1 parent f499e10 commit 108a048
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: python
python:
- "3.4"
- "3.5"
- "3.8"
install:
- pip install -U setuptools && pip install tox tox-travis coveralls
script:
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
SERVER_CERT_ZO_NE = MagicMock(name='zo-ne')
SERVER_CERT_ZO_NE.server_certificate_metadata = {'Arn': 'arn:aws:123',
'ServerCertificateName': 'zo-ne',
'Expiration': datetime(2020, 4, 1, 12, 14, 14,
'Expiration': datetime(2025, 4, 1, 12, 14, 14,
tzinfo=timezone(timedelta(hours=2))),
'Path': '/',
'ServerCertificateId': '000',
Expand Down
9 changes: 4 additions & 5 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_invalid_definition():

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

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


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

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


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

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

Expand Down
2 changes: 1 addition & 1 deletion tests/test_elastigroup_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,5 @@ def test_get_spotinst_account_data_failure():

with mock.patch('boto3.client') as MockHelper:
MockHelper.return_value.get_template.return_value = template
with raises(click.Abort, message="Expecting click.Abort error"):
with raises(click.Abort):
get_spotinst_account_data('fake-region', 'fake-stack-name')
2 changes: 1 addition & 1 deletion tests/test_error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def test_unknown_error_show_stacktrace(mock_tempfile, mock_raven):
senza.error_handling.sentry = senza.error_handling.setup_sentry("test")
senza.error_handling.HandleExceptions.stacktrace_visible = True
func = MagicMock(side_effect=Exception("something"))
with raises(Exception, message="something"):
with raises(Exception):
senza.error_handling.HandleExceptions(func)()

mock_tempfile.assert_not_called()
Expand Down

0 comments on commit 108a048

Please sign in to comment.