Example #1
0
	def test_update_scan_paths_with_same_path(self):
		initial_scan_paths = ['.']
		Config.paths.scan = initial_scan_paths
		initial_nsp_files = ["1.nsp", "2.nsp"]
		Nsps.files = initial_nsp_files
		Config.update_scan_paths(initial_scan_paths, Nsps.files)
		self.assertEqual(Config.paths.scan, initial_scan_paths)
Example #2
0
	def test_update_scan_paths_for_default_config_and_empty_Nsps(self):
		_create_empty_config_file(self.fs)

		self.assertEqual(Config.paths.scan, ['.'])
		new_paths = ['/Users/user1/path1', '/Users/user1/path2']
		Config.update_scan_paths(new_paths, Nsps.files)
		self.assertEqual(Config.paths.scan, new_paths)
Example #3
0
    def saveScanPaths(self, control):
        result = []
        i = 0
        while i < control.count():
            value = control.getValue(i)

            if value:
                result.append(value)
            i += 1

        Config.update_scan_paths(result, Nsps.files)
Example #4
0
	def test_update_main_path_clears_out_Nsps(self):
		_create_empty_config_file(self.fs)

		new_paths = ["folder2"]
		folder1 = {"path": Config.paths.scan[0],
				   "files": ["title1 [abcdefa112345678].nsp", "title2 [abcdefa212345678].nsp"]}

		Nsps.files = {"files": folder1["files"]}

		Config.update_scan_paths(new_paths, Nsps.files)
		self.assertEqual(Nsps.files, {})
Example #5
0
 def test_update_scan_paths_with_single_path(self):
     initial_scan_paths = ['.']
     Config.paths.scan = initial_scan_paths
     new_scan_path = "titles"
     Config.update_scan_paths(new_scan_path, Nsps.files)
     self.assertEqual(Config.paths.scan, [new_scan_path])