Ejemplo n.º 1
0
    def add_task_comment(self, task_id, comment_body, user=None):
        try:
            task = ProductionTask.objects.get(id=task_id)
        except ProductionTask.DoesNotExist:
            logger.info("The task %d is not found" % task_id)
            return
        self._task_action_log(comment_body, user)
        try:
            if task.reference:
                its = ITS()
                its.authorize()
                its.add_issue_comment(task.reference, comment_body)
        except Exception:
            from deftcore.log import get_exception_string

            logger.info("Exception occurred: %s" % get_exception_string())
Ejemplo n.º 2
0
class ITSTest(TestCase):
    def setUp(self):
        self.its = ITS()

    def test_its(self):
        try:
            sso_cookies = self.its.authorize()
        except Exception as ex:
            print "test_its, exception occurred (1): %s" % str(ex)
            sso_cookies = None

        self.assertNotEqual(sso_cookies, None)

        try:
            issue_key = self.its.create_issue("test issue", "[%s] deftcore.api.tests.test_its" % str(timezone.now()))
        except Exception as ex:
            print "test_its, exception occurred (2): %s" % str(ex)
            issue_key = None

        self.assertNotEqual(issue_key, None)

        logger.debug("test issue key = \"%s\"" % issue_key)

        try:
            result = self.its.add_issue_comment(issue_key, "test comment")
        except Exception as ex:
            print "test_its, exception occurred (3): %s" % str(ex)
            result = False

        self.assertTrue(result)

        try:
            result = self.its.delete_issue(issue_key)
        except Exception as ex:
            print "test_its, exception occurred (4): %s" % str(ex)
            result = False

        self.assertTrue(result)