Пример #1
0
    def test_create_checksums_file(self, calculate_mock):
        calculate_mock.return_value = [
            {'checksum': 'checksum2', 'file_path': 'file2.txt'},
            {'checksum': 'checksum', 'file_path': 'file1.txt'}]

        fileobj = FakeFile('')
        open_mock = mock.MagicMock(return_value=fileobj)

        with mock.patch('__builtin__.open', open_mock):
            utils.create_checksums_file('/tmp/dir', '/tmp/checksums')

        self.assertEqual(
            fileobj.getvalue(),
            'checksum file1.txt\nchecksum2 file2.txt\n')
Пример #2
0
    def test_create_checksums_file(self, calculate_mock):
        calculate_mock.return_value = [{
            'checksum': 'checksum2',
            'file_path': 'file2.txt'
        }, {
            'checksum': 'checksum',
            'file_path': 'file1.txt'
        }]

        fileobj = FakeFile('')
        open_mock = mock.MagicMock(return_value=fileobj)

        with mock.patch('__builtin__.open', open_mock):
            utils.create_checksums_file('/tmp/dir', '/tmp/checksums')

        self.assertEqual(fileobj.getvalue(),
                         'checksum file1.txt\nchecksum2 file2.txt\n')
Пример #3
0
 def add_checksums_file(self):
     utils.create_checksums_file(self.build_src_dir, self.checksums_path)
Пример #4
0
 def add_checksums_file(self):
     utils.create_checksums_file(self.build_src_dir, self.checksums_path)