finish download process

This commit is contained in:
Tim Bentley 2017-06-18 07:03:42 +01:00
parent ee00a74d41
commit 5ec2f001e6
3 changed files with 3 additions and 64 deletions

View File

@ -42,16 +42,6 @@ def deploy_zipfile(app_root, zip_name):
web_zip.extractall(app_root) web_zip.extractall(app_root)
def check_for_previous_deployment(app_root, create=False):
marker_file = os.path.join(app_root, "marker.txt")
if os.path.isfile(marker_file):
return True
else:
if create:
os.mknod(marker_file)
return False
def download_sha256(): def download_sha256():
""" """
Download the config file to extract the sha256 and version number Download the config file to extract the sha256 and version number

View File

@ -104,17 +104,16 @@ class RemotesPlugin(Plugin, OpenLPMixin):
time.sleep(1) time.sleep(1)
progress.close() progress.close()
self.application.process_events() self.application.process_events()
aa = Registry().get('website_version') Settings().setValue('remotes/download version', self.version)
Settings().setValue('remotes/download version', Registry().get('website_version'))
def website_version(self): def website_version(self):
""" """
Download and save the website version and sha256 Download and save the website version and sha256
:return: None :return: None
""" """
sha256, version = download_sha256() sha256, self.version = download_sha256()
Registry().set_flag('website_sha256', sha256) Registry().set_flag('website_sha256', sha256)
Registry().set_flag('website_version', version) Registry().set_flag('website_version', self.version)
class Progress(QtWidgets.QProgressDialog): class Progress(QtWidgets.QProgressDialog):

View File

@ -51,56 +51,6 @@ class TestRemoteDeploy(TestCase):
""" """
shutil.rmtree(self.app_root) shutil.rmtree(self.app_root)
@patch('openlp.plugins.remotes.deploy.os.path.isfile')
@patch('openlp.plugins.remotes.deploy.os.mknod')
def test_check_for_previous_deployment_false(self, mocked_mknod, mocked_isfile):
"""
Remote Deploy tests - Test when the marker file is missing
"""
# GIVEN: A new setup with no marker file
# WHEN: I check for a deployment which does not create the marker file
mocked_isfile.return_value = False
processed = check_for_previous_deployment(self.app_root)
# THEN test the see if marker has not been created
self.assertFalse(processed, 'should return False as marker does not exist')
mocked_isfile.assert_called_once_with(os.path.join(self.app_root, 'marker.txt'))
mocked_mknod.assert_not_called()
@patch('openlp.plugins.remotes.deploy.os.path.isfile')
@patch('openlp.plugins.remotes.deploy.os.mknod')
def test_check_for_previous_deployment_true(self, mocked_mknod, mocked_isfile):
"""
Remote Deploy tests - Test when the marker file is missing
"""
# GIVEN: A new setup with not market file
# WHEN: I check for a deployment which does create the marker file
mocked_isfile.return_value = False
processed = check_for_previous_deployment(self.app_root, True)
# THEN test the see if marker has been created
marker_file = os.path.join(self.app_root, 'marker.txt')
self.assertFalse(processed, 'should return False as marker does not exist')
mocked_isfile.assert_called_once_with(marker_file)
mocked_mknod.assert_called_once_with(marker_file)
@patch('openlp.plugins.remotes.deploy.os.path.isfile')
@patch('openlp.plugins.remotes.deploy.os.mknod')
def test_check_for_previous_deployment_true(self, mocked_mknod, mocked_isfile):
"""
Remote Deploy tests - Test when the marker file is present
"""
# GIVEN: A new setup with not market file
# WHEN: I check for a deployment which does not create the marker file
mocked_isfile.return_value = True
processed = check_for_previous_deployment(self.app_root, True)
# THEN test the see if marker is present and has not been created
marker_file = os.path.join(self.app_root, 'marker.txt')
self.assertTrue(processed, 'should return True as marker does exist')
mocked_isfile.assert_called_once_with(marker_file)
mocked_mknod.assert_not_called()
def test_deploy_zipfile(self): def test_deploy_zipfile(self):
""" """
Remote Deploy tests - test the dummy zip file is processed correctly Remote Deploy tests - test the dummy zip file is processed correctly