def test_run_eclipse(self): """Test whether the Task could be run getting projects from Eclipse""" setup_http_server() # Create a empty projects file for testing projects_file = 'test-projects-eclipse.json' config = Config(CONF_FILE) config.set_param('projects', 'load_eclipse', True) config.set_param('projects', 'projects_file', projects_file) task = TaskProjects(config) self.assertEqual(task.execute(), None) self.assertEqual(len(task.get_projects().keys()), 302) # Let's remove some projects to track changes with open(ECLIPSE_PROJECTS_FILE) as eproj: remove_project = 'birt' add_project = 'new_project' new_projects = task.convert_from_eclipse(json.load(eproj)['projects']) new_projects.pop(remove_project) new_projects.update({add_project: {}}) task.set_projects(new_projects) self.assertEqual(task.get_projects_last_diff().sort(), [add_project, remove_project].sort()) remove(projects_file)
def setUp(self): self.config = Config(CONF_FILE) mordred = Mordred(self.config) task = TaskProjects(self.config) self.assertEqual(task.execute(), None) self.backends = mordred._get_repos_by_backend() self.backend_tasks = [TaskRawDataCollection, TaskEnrich] self.stopper = threading.Event()
def test__get_projects_from_url(self): """Test downloading projects from an URL """ setup_http_server() projects_url = 'http://localhost/projects.json' config = Config(CONF_FILE) config.set_param('projects', 'projects_url', projects_url) task = TaskProjects(config) self.assertEqual(task.execute(), None) projects = task.get_projects() self.assertTrue(URL_PROJECTS_MAIN in projects)
def test_convert_from_eclipse(self): """Test the conversion from eclipse projects to grimoire projects""" setup_http_server() projects_file = 'test-projects-eclipse.json' config = Config(CONF_FILE) config.set_param('projects', 'load_eclipse', True) config.set_param('projects', 'projects_file', projects_file) task = TaskProjects(config) self.assertEqual(task.execute(), None) projects = task.get_projects() self.assertTrue(TaskProjects.GLOBAL_PROJECT in projects) remove(projects_file)
def test_convert_from_eclipse(self): """Test the conversion from eclipse projects to grimoire projects""" setup_http_server() projects_file = 'test-projects-eclipse.json' config = Config(CONF_FILE) config.set_param('projects', 'load_eclipse', True) config.set_param('projects', 'projects_file', projects_file) task = TaskProjects(config) self.assertEqual(task.execute(), None) projects = task.get_projects() self.assertTrue(TaskProjects.GLOBAL_PROJECT in projects) self.assertEqual(projects['birt']['github'][0], 'https://github.com/eclipse/birt') remove(projects_file)
def test_run(self): """Test whether the Task could be run""" config = Config(CONF_FILE) task = TaskProjects(config) self.assertEqual(task.execute(), None) self.assertEqual(len(task.get_projects().keys()), 1)