Пример #1
0
    def test_failed_init_return(self, mock_popen):
        mock_popen.return_value.communicate.return_value = (None, None)
        mock_popen.return_value.returncode = 1

        emp_dep = EmpiarDepositor("ABC123",
                                  self.json_path,
                                  "globus_obj",
                                  "",
                                  "globusid", {
                                      "is_dir": False,
                                      "obj_name": "globus_obj"
                                  },
                                  entry_id=1,
                                  entry_directory="entry_dir")

        c = emp_dep.globus_upload()
        self.assertEqual(c, 1)
Пример #2
0
    def test_invalid_json_stdout(self, mock_popen):
        mock_popen.return_value.communicate.return_value = (
            b'The transfer has been accepted and a task has been '
            b'created and queued for execution. Task ID: 123', None)
        mock_popen.return_value.returncode = 0

        emp_dep = EmpiarDepositor("ABC123",
                                  self.json_path,
                                  "globus_obj",
                                  "",
                                  "globusid", {
                                      "is_dir": False,
                                      "obj_name": "globus_obj"
                                  },
                                  entry_id=1,
                                  entry_directory="entry_dir")

        c = emp_dep.globus_upload()
        self.assertEqual(c, 1)