| Total Complexity | 2 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import os |
||
| 2 | from sources.common.FileOperations import FileOperations |
||
| 3 | # package to facilitate multiple operation system operations |
||
| 4 | import platform |
||
| 5 | import unittest |
||
| 6 | |||
| 7 | |||
| 8 | class TestFileOperations(unittest.TestCase): |
||
| 9 | |||
| 10 | def test_file_statistics(self): |
||
| 11 | parent_folder = os.path.abspath(os.pardir) + '/' + '/'.join([ |
||
| 12 | 'virtual_environment', |
||
| 13 | 'Scripts' |
||
| 14 | ]) |
||
| 15 | relevant_file = 'pip' |
||
| 16 | if platform.system() == 'Windows': |
||
| 17 | relevant_file += '.exe' |
||
| 18 | file_to_evaluate = os.path.join(parent_folder, relevant_file) |
||
| 19 | fo = FileOperations() |
||
| 20 | value_to_assert = fo.fn_get_file_statistics(file_to_evaluate)['size [bytes]'] |
||
| 21 | value_to_compare_with = os.path.getsize(file_to_evaluate) |
||
| 22 | self.assertEqual(value_to_assert, value_to_compare_with) |
||
| 23 |