def setUp(self):
     self.msu = ManageSfUtils(config.GATEWAY_URL)
     self.un = config.ADMIN_USER
     self.gu = GerritUtils(config.GATEWAY_URL,
                           auth_cookie=config.USERS[self.un]['auth_cookie'])
     self.gu2 = GerritUtils(
         config.GATEWAY_URL,
         auth_cookie=config.USERS[config.USER_2]['auth_cookie'])
     self.k_idx = self.gu2.add_pubkey(config.USERS[config.USER_2]["pubkey"])
     priv_key_path = set_private_key(config.USERS[self.un]["privkey"])
     self.gitu_admin = GerritGitUtils(self.un, priv_key_path,
                                      config.USERS[self.un]['email'])
     # Configuration to access mirror repo present in managesf
     self.managesf_repo_path = "ssh://%s@%s/home/gerrit/git/" % (
         config.GERRIT_USER, config.GATEWAY_HOST)
     # prepare environment for git clone on mirror repo
     self.mt = Tool()
     self.mt_tempdir = tempfile.mkdtemp()
     priv_key = file(config.GERRIT_SERVICE_PRIV_KEY_PATH, 'r').read()
     priv_key_path = os.path.join(self.mt_tempdir, 'user.priv')
     file(priv_key_path, 'w').write(priv_key)
     os.chmod(priv_key_path, stat.S_IREAD | stat.S_IWRITE)
     ssh_wrapper = "ssh -o StrictHostKeyChecking=no -i %s \"$@\"" % (
         priv_key_path)
     wrapper_path = os.path.join(self.mt_tempdir, 'ssh_wrapper.sh')
     file(wrapper_path, 'w').write(ssh_wrapper)
     os.chmod(wrapper_path, stat.S_IRWXU)
     self.mt.env['GIT_SSH'] = wrapper_path
     self.pname = 'test-replication'
Beispiel #2
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'])
Beispiel #3
0
 def setUp(self):
     super(TestManageSF, self).setUp()
     self.projects = []
     self.dirs_to_delete = []
     self.ru = ResourcesUtils()
     self.msu = ManageSfUtils(config.GATEWAY_URL)
     self.gu = GerritUtils(
         config.GATEWAY_URL,
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
Beispiel #4
0
 def __init__(self):
     with open("%s/resources.yaml" % pwd, 'r') as rsc:
         self.resources = yaml.load(rsc)
     config.USERS[config.ADMIN_USER]['auth_cookie'] = get_cookie(
         config.ADMIN_USER, config.USERS[config.ADMIN_USER]['password'])
     self.msu = ManageSfUtils(config.GATEWAY_URL)
     self.ru = ResourcesUtils()
     self.ggu = GerritGitUtils(config.ADMIN_USER,
                               config.ADMIN_PRIV_KEY_PATH,
                               config.USERS[config.ADMIN_USER]['email'])
     self.stb_client = SFStoryboard(
         config.GATEWAY_URL + "/storyboard_api",
         config.USERS[config.ADMIN_USER]['auth_cookie'])
Beispiel #5
0
 def __init__(self):
     with open("%s/resources.yaml" % pwd, 'r') as rsc:
         self.resources = yaml.load(rsc)
     config.USERS[config.ADMIN_USER]['auth_cookie'] = get_cookie(
         config.ADMIN_USER, config.USERS[config.ADMIN_USER]['password'])
     self.msu = ManageSfUtils(config.GATEWAY_URL)
     self.ggu = GerritGitUtils(config.ADMIN_USER,
                               config.ADMIN_PRIV_KEY_PATH,
                               config.USERS[config.ADMIN_USER]['email'])
     self.ju = JenkinsUtils()
     self.rm = RedmineUtils(
         config.GATEWAY_URL + "/redmine/",
         auth_cookie=config.USERS[config.ADMIN_USER]['auth_cookie'])
Beispiel #6
0
    def test_gerrit_api_accessible(self):
        """ Test if Gerrit API is accessible on gateway hosts
        """
        m = ManageSfUtils(config.GATEWAY_URL)
        url = config.GATEWAY_URL + "/api/"

        a = GerritUtils(url)
        a.g.url = "%s/" % a.g.url.rstrip('a/')
        self.assertRaises(HTTPError, a.get_account, config.USER_1)

        api_passwd = m.create_gerrit_api_password(config.USER_1)
        auth = HTTPBasicAuth(config.USER_1, api_passwd)
        a = GerritUtils(url, auth=auth)
        self.assertTrue(a.get_account(config.USER_1))

        m.delete_gerrit_api_password(config.USER_1)
        a = GerritUtils(url, auth=auth)
        self.assertRaises(HTTPError, a.get_account, config.USER_1)

        a = GerritUtils(url)
        a.g.url = "%s/" % a.g.url.rstrip('a/')
        self.assertRaises(HTTPError, a.get_account, 'john')
Beispiel #7
0
 def setUpClass(cls):
     cls.projects = []
     cls.clone_dirs = []
     cls.dirs_to_delete = []
     cls.msu = ManageSfUtils(config.GATEWAY_URL)
Beispiel #8
0
 def setUpClass(cls):
     cls.msu = ManageSfUtils(config.GATEWAY_URL)
 def setUpClass(cls):
     cls.msu = ManageSfUtils(config.GATEWAY_URL)
     cls.sample_project_dir = \
         os.path.join(config.SF_TESTS_DIR, "sample_project/")
Beispiel #10
0
 def setUp(self):
     self.projects = []
     self.clone_dirs = []
     self.dirs_to_delete = []
     self.msu = ManageSfUtils(config.GATEWAY_URL)
Beispiel #11
0
 def setUp(self):
     super(TestGerritGitWeb, self).setUp()
     self.projects = []
     self.clone_dirs = []
     self.dirs_to_delete = []
     self.msu = ManageSfUtils(config.GATEWAY_URL)