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

Create unit test for FileCreator #591

Merged
merged 4 commits into from Dec 6, 2019
Merged

Create unit test for FileCreator #591

merged 4 commits into from Dec 6, 2019

Conversation

homebysix
Copy link
Member

No description provided.

@homebysix homebysix changed the title Create unit test for FileCreator WIP: Create unit test for FileCreator Dec 3, 2019
@nmcspadden
Copy link
Contributor

Are you still intending to add to this, or is it ready for review now? Your skeleton is fine, but the unit test itself doesn't do much.

@homebysix
Copy link
Member Author

Let me take a shot at the mock_open, and if I can get that sorted I’ll remove the WIP.

@homebysix homebysix changed the title WIP: Create unit test for FileCreator Create unit test for FileCreator Dec 3, 2019
@homebysix
Copy link
Member Author

OK, I think I got it. Whether it's a useful test is debatable.

% python3 -m unittest tests.test_filecreator -v
test_file_content (tests.test_filecreator.TestFileCreator)
The file created by the processor should have the expected contents. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.008s

OK

@nmcspadden
Copy link
Contributor

This is good!

In a future PR, I think we should add a few more tests:

  • Opening a bad file path should trigger a ProcessorError
  • Opening a good file path should not trigger any error
  • Test the file mode is created as expected
  • Failing to set the file mode, if defined, should trigger a ProcessorError

@nmcspadden nmcspadden merged commit aa9bd14 into autopkg:py2-to-3 Dec 6, 2019
@nmcspadden
Copy link
Contributor

Additionally, we should ensure we have the correct copyright headers on all files in the repo.

@homebysix homebysix deleted the filecreator-test branch December 7, 2019 03:17
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

2 participants