コード例 #1
0
ファイル: workflow_test.py プロジェクト: afsartori/spreads
 def test_download_with_error(self, exists, mkdir):
     spreads.config['keep'] = False
     exists.return_value = False
     flow.os.mkdir = mkdir
     flow.os.path.exists = exists
     self.cams[0].download_files.side_effect = Exception
     flow.download(devices=self.cams, path='/tmp/foo')
コード例 #2
0
ファイル: workflow_test.py プロジェクト: Josuex09/spreads
 def test_download_with_error(self, exists, mkdir):
     spreads.config['keep'] = False
     exists.return_value = False
     flow.os.mkdir = mkdir
     flow.os.path.exists = exists
     self.cams[0].download_files.side_effect = Exception
     flow.download(devices=self.cams, path='/tmp/foo')
コード例 #3
0
ファイル: cli.py プロジェクト: markvdb/spreads
def download(args=None, path=None, devices=None):
    if args and args.path:
        path = args.path
    if not devices:
        devices = get_devices()
    status_str = "Downloading {0} images from devices"
    if config['download']['keep'].get(bool) or config['keep'].get(bool):
        status_str = status_str.format("and deleting ")
    else:
        status_str = status_str.format("")
    print(colorama.Fore.GREEN + status_str)
    workflow.download(devices, path)
コード例 #4
0
ファイル: cli.py プロジェクト: Josuex09/spreads
def download(args=None, path=None, devices=None):
    if args and args.path:
        path = args.path
    if not devices:
        devices = get_devices()
    status_str = "Downloading {0} images from devices"
    if config['download']['keep'].get(bool) or config['keep'].get(bool):
        status_str = status_str.format("and deleting ")
    else:
        status_str = status_str.format("")
    print(colorama.Fore.GREEN + status_str)
    workflow.download(devices, path)
コード例 #5
0
ファイル: workflow_test.py プロジェクト: Josuex09/spreads
 def test_download_noparallel(self, exists, mkdir):
     spreads.config['keep'] = False
     spreads.config['parallel_download'] = False
     exists.return_value = False
     flow.os.mkdir = mkdir
     flow.os.path.exists = exists
     flow.download(devices=self.cams, path='/tmp/foo')
     # TODO: Find a way to verify that the cameras were indeed called
     #       in sequence and not in parallel
     for cam in self.cams:
         assert cam.download_files.call_count == 1
         assert cam.download_files.call_args_list == [call('/tmp/foo/{0}'
             .format(cam.orientation.lower()))]
         assert cam.delete_files.call_count == 1
コード例 #6
0
ファイル: workflow_test.py プロジェクト: afsartori/spreads
 def test_download_noparallel(self, exists, mkdir):
     spreads.config['keep'] = False
     spreads.config['parallel_download'] = False
     exists.return_value = False
     flow.os.mkdir = mkdir
     flow.os.path.exists = exists
     flow.download(devices=self.cams, path='/tmp/foo')
     # TODO: Find a way to verify that the cameras were indeed called
     #       in sequence and not in parallel
     for cam in self.cams:
         assert cam.download_files.call_count == 1
         assert cam.download_files.call_args_list == [
             call('/tmp/foo/{0}'.format(cam.orientation.lower()))
         ]
         assert cam.delete_files.call_count == 1
コード例 #7
0
ファイル: workflow_test.py プロジェクト: Josuex09/spreads
 def test_download(self, exists, mkdir):
     spreads.config['keep'] = False
     exists.return_value = False
     flow.os.mkdir = mkdir
     flow.os.path.exists = exists
     flow.download(devices=self.cams, path='/tmp/foo')
     assert flow.os.mkdir.call_count == 3
     assert call('/tmp/foo') in flow.os.mkdir.call_args_list
     assert call('/tmp/foo/right') in flow.os.mkdir.call_args_list
     assert call('/tmp/foo/left') in flow.os.mkdir.call_args_list
     for cam in self.cams:
         assert cam.download_files.call_count == 1
         assert cam.download_files.call_args_list == [call('/tmp/foo/{0}'
             .format(cam.orientation.lower()))]
         assert cam.delete_files.call_count == 1
     for plug in self.plugins:
         assert plug.obj.download.call_count == 1
         assert plug.obj.download.call_args_list == [call(
             self.cams, '/tmp/foo')]
         assert plug.obj.delete.call_count == 1
         assert plug.obj.delete.call_args_list == [call(self.cams)]
コード例 #8
0
ファイル: workflow_test.py プロジェクト: afsartori/spreads
 def test_download(self, exists, mkdir):
     spreads.config['keep'] = False
     exists.return_value = False
     flow.os.mkdir = mkdir
     flow.os.path.exists = exists
     flow.download(devices=self.cams, path='/tmp/foo')
     assert flow.os.mkdir.call_count == 3
     assert call('/tmp/foo') in flow.os.mkdir.call_args_list
     assert call('/tmp/foo/right') in flow.os.mkdir.call_args_list
     assert call('/tmp/foo/left') in flow.os.mkdir.call_args_list
     for cam in self.cams:
         assert cam.download_files.call_count == 1
         assert cam.download_files.call_args_list == [
             call('/tmp/foo/{0}'.format(cam.orientation.lower()))
         ]
         assert cam.delete_files.call_count == 1
     for plug in self.plugins:
         assert plug.obj.download.call_count == 1
         assert plug.obj.download.call_args_list == [
             call(self.cams, '/tmp/foo')
         ]
         assert plug.obj.delete.call_count == 1
         assert plug.obj.delete.call_args_list == [call(self.cams)]