Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit.states.test_reg test failure #47985

Merged
merged 2 commits into from Jun 6, 2018

Conversation

twangboy
Copy link
Contributor

@twangboy twangboy commented Jun 5, 2018

What does this PR do?

Fixes failing test by mocking reg.cast_vdata

What issues does this PR fix or reference?

Found by Jenkins

Tests written?

Yes

Commits signed with GPG?

Yes

@ghost ghost self-requested a review June 5, 2018 21:59
@@ -48,8 +49,12 @@ def test_present(self):
{'vdata': 'a', 'success': True},
{'vdata': 'a', 'success': True}])
mock_t = MagicMock(return_value=True)
mock_cast = MagicMock(
return_value=salt.utils.stringutils.to_unicode(vdata)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this simply be:

mock_cast = MagicMock(return_value=vdata)

Because vdata is already unicode (on PY2) due to from __future__ import unicode_literals?

Or am I missing something that requires the explicit cast?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's my own idiocy. I saw that that's what cast_vdata was returning, so I thought I should make the mock the same. The tests pass without the to_unicode. I'll remove it.

@twangboy twangboy requested review from aaronfrost, a team and skizunov and removed request for aaronfrost June 5, 2018 22:25
@rallytime rallytime merged commit 1b4c723 into saltstack:2018.3 Jun 6, 2018
@twangboy twangboy deleted the fix_test_reg branch June 8, 2018 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants