def test_parse_config_multi_path(self):
        config_access.parse_config()

        config_path = config_access.get_config_path()
        f = open(config_path, 'a')
        f.write("repo1\tpath1\n")
        f.write("repo2\tpath2\n")
        f.close()

        projects = config_access.parse_config()
        self.assertEqual(projects, [('repo1', 'path1'), ('repo2', 'path2')])
Esempio n. 2
0
 def populate_project_menu(self):
     # Clear existing projects
     self.project_menu.clear() 
     
     # call config_access to get a list if we don't have one yet. after that we
     # should maintain our own project_list.
     if self.project_list is None:
         self.project_list = config_access.parse_config()
     
     # add a function to each item in the drop down that will call a function, passing it 
     # that item, the tuple of (name, file_path)    
     for item in self.project_list:
         self.project_menu.addAction(item[0], lambda t=item: self.project_menu_item_clicked(t))
         
     self.project_menu.addAction("Create new project...", self.create_new_project)
     self.project_button.setMenu(self.project_menu)
     
     # by default, we don't select any project    
     self.project_button.setText("No Project Selected")
    def test_add_config_single_project(self):
        config_access.add_config("repo1", "path1")

        projects = config_access.parse_config()
        self.assertEqual(projects, [('repo1', 'path1')])
 def test_parse_config_no_config_no_paths(self):
     projects = config_access.parse_config()
     self.assertEqual(len(projects), 0)
 def test_parse_config_no_config_create_file(self):
     config_access.parse_config()
     self.assertTrue(os.path.exists(self.config_path))