Esempio n. 1
0
    def test_lock_workspace(self):
        """Test lock_workspace()"""
        r = fapi.lock_workspace(self.project, self.workspace)
        print(r.status_code, r.content)
        self.assertEqual(r.status_code, 204)

        # Unlock, for other tests
        fapi.unlock_workspace(self.project, self.workspace)
Esempio n. 2
0
    def setUpClass(cls):
        '''Set up FireCloud etc to run tests'''

        print("\nStarting high-level CLI tests ...\n", file=sys.stderr)

        fiss_verbosity = os.environ.get("FISS_TEST_VERBOSITY", None)
        if fiss_verbosity == None:
            fiss_verbosity = 0

        fcconfig = fccore.config_get_all()
        fcconfig.set_verbosity(fiss_verbosity)
        cls.project = fcconfig.project
        if not cls.project:
            raise ValueError("Your configuration must define a FireCloud project")

        # Set up a temp workspace for duration of tests. And in case a previous
        # test failed, we attempt to unlock & delete before creating anew
        cls.workspace = getuser() + '_FISS_TEST'

        ret = call_func("space_exists", "-p", cls.project, "-w", cls.workspace)
        if ret == True and os.environ.get("REUSE_SPACE", None):
            return

        print("\tCreating test workspace ...\n", file=sys.stderr)
        r = fapi.unlock_workspace(cls.project, cls.workspace)
        r = fapi.delete_workspace(cls.project, cls.workspace)
        r = fapi.create_workspace(cls.project, cls.workspace)
        fapi._check_response_code(r, 201)
Esempio n. 3
0
    def test_clone_workspace(self):
        """Test clone_workspace()."""
        temp_space = getuser() + '_FISS_TEST_CLONE'
        r = fapi.unlock_workspace(self.project, temp_space)
        r = fapi.delete_workspace(self.project, temp_space)
        r = fapi.clone_workspace(self.project, self.workspace, self.project,
                                 temp_space)
        print(r.status_code, r.content)
        self.assertEqual(r.status_code, 201)

        # Compare new workspace and old workspace
        # Cleanup, Delete workspace
        r = fapi.delete_workspace(self.project, temp_space)
        print(r.status_code, r.content)
        self.assertIn(r.status_code, [200, 202])
Esempio n. 4
0
    def setUpClass(cls, msg=""):
        '''Set up FireCloud etc to run tests'''

        print("\nStarting low-level api tests ...\n", file=sys.stderr)

        fiss_verbosity = os.environ.get("FISS_TEST_VERBOSITY", None)
        if fiss_verbosity == None:
            fiss_verbosity = 0

        fcconfig = fccore.config_parse()
        cls.project = fcconfig.project
        if not cls.project:
            raise ValueError("Your configuration must define a FireCloud project")
        fcconfig.set_verbosity(fiss_verbosity)

        # Set up a temp workspace for duration of tests; and in case a previous
        # test failed, attempt to unlock & delete before creating anew.  Note
        # that bc we execute space create/delete here, their tests are NO-OPs
        cls.workspace = getuser() + '_FISS_TEST'
        r = fapi.unlock_workspace(cls.project, cls.workspace)
        r = fapi.delete_workspace(cls.project, cls.workspace)
        r = fapi.create_workspace(cls.project, cls.workspace)
        fapi._check_response_code(r, 201)
Esempio n. 5
0
 def test_unlock_workspace(self):
     """Test unlock_workspace()."""
     r = fapi.unlock_workspace(self.project, self.workspace)
     print(r.status_code, r.content)
     self.assertEqual(r.status_code, 204)
Esempio n. 6
0
 def unlock(self):
     """Unlock this Workspace."""
     r = fapi.unlock_workspace(self.namespace, self.name, self.api_url)
     fapi._check_response_code(r, 204)
     self.data['workspace']['isLocked'] = False
     return self