Example #1
0
    def test_tracker_accessible(self):
        """ Test if Issue Tracker is accessible on gateway host
        """
        tracker = get_issue_tracker_utils(
            auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
        url = tracker.get_root_url()

        # Without SSO cookie. Note that auth is no longer enforced
        resp = requests.get(url)
        self.assertEqual(resp.status_code, 200,
                         "%s returned status %s" % (url, resp.status_code))

        # With SSO cookie
        resp = requests.get(
            url,
            cookies=dict(
                auth_pubtkt=config.USERS[config.USER_1]['auth_cookie']))
        self.assertEqual(resp.status_code, 200)

        # User should be known in tracker if logged in with SSO
        self.assertTrue(config.USER_1 in resp.text)

        # Check one of the static files is accessible
        url = tracker.test_static_file()
        resp = requests.get(
            url,
            cookies=dict(
                auth_pubtkt=config.USERS[config.USER_1]['auth_cookie']))
        self.assertEqual(resp.status_code, 200,
                         "%s returned status %s" % (url, resp.status_code))
 def setUp(self):
     self.projects = []
     self.rm = get_issue_tracker_utils(
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
     self.gu = GerritUtils(
         config.GATEWAY_URL,
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
    def test_redmine_versions_edit(self):
        tracker = get_issue_tracker_utils()
        cookies = dict(auth_pubtkt=config.USERS[config.USER_1]['auth_cookie'])

        # We need a session, because we execute two requests and the
        # authenticity_token is assigned to a session
        s = requests.Session()

        url = "%s/projects/config/versions/new" % tracker.get_root_url()
        resp = s.get(url, cookies=cookies)

        # Find the authenticity_token in the response
        m = re.search('authenticity_token.*value="(.*)"', resp.text)
        authenticity_token = m.group(1)

        # Create a new version
        url = "%s/projects/config/versions" % tracker.get_root_url()
        data = {'version[name]': 'sample6',
                'authenticity_token': authenticity_token}
        resp = s.post(url, data, cookies=cookies)
        self.assertEqual(resp.status_code, 200)

        # Edit the version
        url = "%s/versions/1" % tracker.get_root_url()
        data = {'version[name]': 'sample20',
                'authenticity_token': authenticity_token,
                '_method': 'put'}
        resp = s.post(url, data, cookies=cookies, allow_redirects=False)
        self.assertEqual(resp.status_code, 302)
        location = resp.headers.get('Location')
        self.assertEqual(
            location,
            '%s/projects/config/settings/versions' % tracker.get_root_url())
    def test_tracker_accessible(self):
        """ Test if Issue Tracker is accessible on gateway host
        """
        tracker = get_issue_tracker_utils(
            auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
        url = tracker.get_root_url()

        # Without SSO cookie. Note that auth is no longer enforced
        resp = requests.get(url)
        self.assertEqual(resp.status_code, 200,
                         "%s returned status %s" % (url, resp.status_code))

        # With SSO cookie
        resp = requests.get(
            url,
            cookies=dict(
                auth_pubtkt=config.USERS[config.USER_1]['auth_cookie']))
        self.assertEqual(resp.status_code, 200)

        # User should be known in tracker if logged in with SSO
        self.assertTrue(config.USER_1 in resp.text)

        # Check one of the static files is accessible
        url = tracker.test_static_file()
        resp = requests.get(
            url,
            cookies=dict(
                auth_pubtkt=config.USERS[config.USER_1]['auth_cookie']))
        self.assertEqual(resp.status_code, 200,
                         "%s returned status %s" % (url, resp.status_code))
Example #5
0
 def setUpClass(cls):
     cls.msu = ManageSfUtils(config.GATEWAY_URL)
     cls.rm = get_issue_tracker_utils(
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
     cls.gu = GerritUtils(
         config.GATEWAY_URL,
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
Example #6
0
 def setUp(self):
     super(TestProjectMembership, self).setUp()
     self.projects = []
     self.rm = get_issue_tracker_utils(
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
     self.gu = GerritUtils(
         config.GATEWAY_URL,
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
 def project_exists_ex(self, name, user):
     # Test here the project is "public"
     # ( Redmine API project detail does not return the private/public flag)
     rm = get_issue_tracker_utils(
         auth_cookie=config.USERS[user]['auth_cookie'])
     try:
         return rm.project_exists(name)
     except Exception:
         return False
Example #8
0
 def project_exists_ex(self, name, user):
     # Test here the project is "public"
     # ( Redmine API project detail does not return the private/public flag)
     rm = get_issue_tracker_utils(
         auth_cookie=config.USERS[user]['auth_cookie'])
     try:
         return rm.project_exists(name)
     except Exception:
         return False
Example #9
0
 def setUp(self):
     super(TestManageSF, self).setUp()
     self.projects = []
     self.dirs_to_delete = []
     self.rm = get_issue_tracker_utils(
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
     self.gu = GerritUtils(
         config.GATEWAY_URL,
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
 def test_tracker_root_url_for_404(self):
     """ Test if tracker yield RoutingError
     """
     tracker = get_issue_tracker_utils(
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
     url = tracker.get_root_url()
     for i in xrange(11):
         resp = requests.get(url)
         self.assertNotEquals(resp.status_code, 404,
                              "%s returned status %s" % (url,
                                                         resp.status_code))
Example #11
0
 def test_tracker_root_url_for_404(self):
     """ Test if tracker yield RoutingError
     """
     tracker = get_issue_tracker_utils(
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
     url = tracker.get_root_url()
     for i in xrange(11):
         resp = requests.get(url)
         self.assertNotEquals(
             resp.status_code, 404,
             "%s returned status %s" % (url, resp.status_code))
Example #12
0
 def setUp(self):
     super(TestGerritHooks, self).setUp()
     self.projects = []
     self.dirs_to_delete = []
     self.issues = []
     self.u = config.ADMIN_USER
     self.rm = get_issue_tracker_utils(
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
     self.gu = GerritUtils(config.GATEWAY_URL,
                           auth_cookie=config.USERS[self.u]['auth_cookie'])
     self.gu.add_pubkey(config.USERS[self.u]["pubkey"])
     priv_key_path = set_private_key(config.USERS[self.u]["privkey"])
     self.gitu = GerritGitUtils(self.u, priv_key_path,
                                config.USERS[self.u]['email'])
 def test_topmenu_links_shown(self):
     """ Test if all service links are shown in topmenu
     """
     subpaths = ["/r/", "/jenkins/",
                 "/zuul/", "/etherpad/", "/paste/", "/docs/"]
     if has_issue_tracker():
         tracker = get_issue_tracker_utils(
             auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
         if 'redmine' in tracker.get_root_url():
             subpaths.append('/%s/' % 'redmine')
     url = config.GATEWAY_URL + "/topmenu.html"
     resp = requests.get(url)
     self.assertEqual(resp.status_code, 200)
     for subpath in subpaths:
         self.assertTrue(('href="%s"' % subpath) in resp.text,
                         '%s not present as a link' % subpath)
Example #14
0
 def test_topmenu_links_shown(self):
     """ Test if all service links are shown in topmenu
     """
     subpaths = [
         "/r/", "/jenkins/", "/zuul/", "/etherpad/", "/paste/", "/docs/",
         "/app/kibana"
     ]
     if has_issue_tracker():
         tracker = get_issue_tracker_utils(
             auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
         if 'redmine' in tracker.get_root_url():
             subpaths.append('/%s/' % 'redmine')
     url = config.GATEWAY_URL + "/topmenu.html"
     resp = requests.get(url)
     self.assertEqual(resp.status_code, 200)
     for subpath in subpaths:
         self.assertTrue(('href="%s"' % subpath) in resp.text,
                         '%s not present as a link' % subpath)
 def setUp(self):
     self.projects = []
     self.dirs_to_delete = []
     self.issues = []
     self.u = config.ADMIN_USER
     self.u2 = config.USER_2
     self.rm = get_issue_tracker_utils(
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
     self.gu = GerritUtils(
         config.GATEWAY_URL,
         auth_cookie=config.USERS[self.u]['auth_cookie'])
     self.gu2 = GerritUtils(
         config.GATEWAY_URL,
         auth_cookie=config.USERS[self.u2]['auth_cookie'])
     self.gu.add_pubkey(config.USERS[self.u]["pubkey"])
     priv_key_path = set_private_key(config.USERS[self.u]["privkey"])
     self.gitu = GerritGitUtils(self.u,
                                priv_key_path,
                                config.USERS[self.u]['email'])