Esempio n. 1
0
    def test_backend_params(self):
        """Test whether the backend parameters are initializated"""

        config = Config(CONF_FILE)
        backend_section = GITHUB_BACKEND_SECTION
        task = TaskRawDataCollection(config, backend_section=backend_section)
        params = task._compose_perceval_params(GITHUB_BACKEND_SECTION, GITHUB_REPO)

        expected_params = [
            'grimoirelab',
            'perceval',
            '--api-token',
            'XXXXX',
            '--sleep-time',
            '300',
            '--sleep-for-rate',
            '--category',
            'issue',
            '--archive-path',
            '/tmp/test_github_archive'
        ]

        self.assertEqual(len(params), len(expected_params))

        for p in params:
            self.assertTrue(p in expected_params)
Esempio n. 2
0
 def test_run(self):
     """Test whether the Task could be run"""
     config = Config(CONF_FILE)
     backend_section = GIT_BACKEND_SECTION
     task = TaskRawDataCollection(config, backend_section=backend_section)
     # We need to load the projects
     TaskProjects(config).execute()
     self.assertEqual(task.execute(), None)
Esempio n. 3
0
    def test_execute(self):
        """Test whether the Task could be run"""

        config = Config(CONF_FILE)
        backend_section = GIT_BACKEND_SECTION
        task = TaskRawDataCollection(config, backend_section=backend_section)
        # We need to load the projects
        TaskProjects(config).execute()
        self.assertEqual(task.execute(), None)
Esempio n. 4
0
    def test_initialization(self):
        """Test whether attributes are initializated"""
        config = Config(CONF_FILE)
        backend_section = GIT_BACKEND_SECTION
        task = TaskRawDataCollection(config, backend_section=backend_section)

        self.assertEqual(task.config, config)
        self.assertEqual(task.backend_section, backend_section)
Esempio n. 5
0
    def test_execute_from_archive(self):
        """Test fetching data from archives"""

        # proj_file -> 'test-projects-archive.json' stored within the conf file
        conf_file = 'archives-test.cfg'
        config = Config(conf_file)

        backend_sections = ['askbot', 'bugzilla', 'bugzillarest', 'confluence',
                            'discourse', 'dockerhub', 'gerrit', 'github', 'jenkins',
                            'jira', 'mediawiki', 'meetup', 'mozillaclub', 'nntp', 'phabricator',
                            'redmine', 'remo', 'rss', 'stackexchange', 'slack', 'telegram']

        for backend_section in backend_sections:
            task = TaskRawDataCollection(config, backend_section=backend_section)
            # We need to load the projects
            TaskProjects(config).execute()
            self.assertEqual(task.execute(), None)
Esempio n. 6
0
    def test_backend_params(self):
        """Test whether the backend parameters are initializated"""

        config = Config(CONF_FILE)
        backend_section = GITHUB_BACKEND_SECTION
        task = TaskRawDataCollection(config, backend_section=backend_section)
        params = task._compose_perceval_params(GITHUB_BACKEND_SECTION,
                                               GITHUB_REPO)

        expected_params = [
            'grimoirelab', 'perceval', '--api-token', 'XXXXX', '--sleep-time',
            '300', '--sleep-for-rate', '--category', 'issue', '--archive-path',
            '/tmp/test_github_archive'
        ]

        self.assertEqual(len(params), len(expected_params))

        for p in params:
            self.assertTrue(p in expected_params)
Esempio n. 7
0
    def test_execute_from_archive(self):
        """Test fetching data from archives"""

        # proj_file -> 'test-projects-archive.json' stored within the conf file
        conf_file = 'archive-test.cfg'
        config = Config(conf_file)

        backend_sections = [
            'askbot', 'bugzilla', 'bugzillarest', 'confluence', 'discourse',
            'dockerhub', 'gerrit', 'github', 'jenkins', 'jira', 'mediawiki',
            'meetup', 'nntp', 'phabricator', 'redmine', 'rss', 'stackexchange',
            'slack', 'telegram'
        ]

        for backend_section in backend_sections:
            task = TaskRawDataCollection(config,
                                         backend_section=backend_section)
            # We need to load the projects
            TaskProjects(config).execute()
            self.assertEqual(task.execute(), None)