-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1518585
commit 7179105
Showing
1 changed file
with
29 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,52 @@ | ||
import unittest | ||
from uuid import uuid4 | ||
from acacore.models.file import Action, File | ||
|
||
from acacore.models.file import Action | ||
from acacore.models.file import File | ||
|
||
|
||
class TestFileActionEnum(unittest.TestCase): | ||
def setUp(self): | ||
self.file = File(id=1, uuid=uuid4(), checksum='abc123', puid='fmt/18', relative_path='test.txt', is_binary=False, file_size_in_bytes=1024, signature='test') | ||
self.file = File( | ||
id=1, | ||
uuid=uuid4(), | ||
checksum="abc123", | ||
puid="fmt/18", | ||
relative_path="test.txt", | ||
is_binary=False, | ||
file_size_in_bytes=1024, | ||
signature="test", | ||
) | ||
|
||
def test_action_enum_values(self): | ||
self.assertEqual(Action.CONVERT.value, 'Convertool: To convert.') | ||
self.assertEqual(Action.REPLACE.value, 'Convertool: Replace with template. File is not preservable.') | ||
self.assertEqual(Action.MANUAL.value, 'Manual: File should be converted manually. [info about the manual conversion from reference_files].') | ||
self.assertEqual(Action.RENAME.value, 'Renamer: File has extension mismatch. Should be renamed') | ||
self.assertEqual(Action.CONVERT.value, "Convertool: To convert.") | ||
self.assertEqual(Action.REPLACE.value, "Convertool: Replace with template. File is not preservable.") | ||
self.assertEqual( | ||
Action.MANUAL.value, | ||
"Manual: File should be converted manually. [info about the manual conversion from reference_files].", | ||
) | ||
self.assertEqual(Action.RENAME.value, "Renamer: File has extension mismatch. Should be renamed") | ||
|
||
def test_file_action(self): | ||
self.file.action = Action.CONVERT | ||
self.assertEqual(self.file.action, Action.CONVERT) | ||
self.assertEqual(self.file.action.value, 'Convertool: To convert.') | ||
self.assertEqual(self.file.action.value, "Convertool: To convert.") | ||
|
||
self.file.action = Action.REPLACE | ||
self.assertEqual(self.file.action, Action.REPLACE) | ||
self.assertEqual(self.file.action.value, 'Convertool: Replace with template. File is not preservable.') | ||
self.assertEqual(self.file.action.value, "Convertool: Replace with template. File is not preservable.") | ||
|
||
self.file.action = Action.MANUAL | ||
self.assertEqual(self.file.action, Action.MANUAL) | ||
self.assertEqual(self.file.action.value, 'Manual: File should be converted manually. [info about the manual conversion from reference_files].') | ||
self.assertEqual( | ||
self.file.action.value, | ||
"Manual: File should be converted manually. [info about the manual conversion from reference_files].", | ||
) | ||
|
||
self.file.action = Action.RENAME | ||
self.assertEqual(self.file.action, Action.RENAME) | ||
self.assertEqual(self.file.action.value, 'Renamer: File has extension mismatch. Should be renamed') | ||
self.assertEqual(self.file.action.value, "Renamer: File has extension mismatch. Should be renamed") | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
if __name__ == "__main__": | ||
unittest.main() |