Example #1
0
    def test_file_parsing(self, mock_gur, mockdocker, mockioctl, mockpath,
                          mock_images_match, mock_is_insecure):

        manager = image_uploader.ImageUploadManager(self.filelist, debug=True)
        parsed_data = manager.upload()
        mockpath(self.filelist[0])

        expected_data = fakes.create_parsed_upload_images()
        sorted_expected_data = sorted(expected_data,
                                      key=operator.itemgetter('imagename'))
        sorted_parsed_data = sorted(parsed_data,
                                    key=operator.itemgetter('imagename'))
        self.assertEqual(sorted_expected_data, sorted_parsed_data)

        dockerc = mockdocker.return_value
        dockerc.remove_image.assert_has_calls([
            mock.call('192.0.2.0:8787/tripleomaster'
                      '/centos-binary-nova-libvirt:liberty'),
            mock.call('docker.io/tripleomaster'
                      '/centos-binary-nova-compute:liberty'),
            mock.call('docker.io/tripleomaster'
                      '/centos-binary-nova-libvirt:liberty'),
            mock.call('docker.io/tripleomaster'
                      '/heat-docker-agents-centos:latest'),
            mock.call('docker.io/tripleomaster'
                      '/image-with-missing-tag:latest'),
            mock.call('localhost:8787/tripleomaster'
                      '/centos-binary-nova-compute:liberty'),
            mock.call('localhost:8787/tripleomaster'
                      '/heat-docker-agents-centos:latest'),
            mock.call('localhost:8787/tripleomaster/'
                      'image-with-missing-tag:latest'),
        ])
    def test_legacy_file_parsing(self, mockpath, mockioctl, mockdocker):
        manager = ImageUploadManager(self.filelist, debug=True)
        parsed_data = manager.upload()
        mockpath(self.filelist[0])

        expected_data = fakes.create_parsed_upload_images()
        sorted_expected_data = sorted(expected_data,
                                      key=operator.itemgetter('imagename'))
        sorted_parsed_data = sorted(parsed_data,
                                    key=operator.itemgetter('imagename'))
        self.assertEqual(sorted_expected_data, sorted_parsed_data)
    def test_legacy_file_parsing(self, mockpath, mockioctl, mockdocker):
        manager = ImageUploadManager(self.filelist, debug=True)
        parsed_data = manager.upload()
        mockpath(self.filelist[0])

        expected_data = fakes.create_parsed_upload_images()
        sorted_expected_data = sorted(expected_data,
                                      key=operator.itemgetter('imagename'))
        sorted_parsed_data = sorted(parsed_data,
                                    key=operator.itemgetter('imagename'))
        self.assertEqual(sorted_expected_data, sorted_parsed_data)