当前位置: 首页>>代码示例>>Python>>正文


Python SHARE_JOBS.set_for_testing方法代码示例

本文整理汇总了Python中oozie.conf.SHARE_JOBS.set_for_testing方法的典型用法代码示例。如果您正苦于以下问题:Python SHARE_JOBS.set_for_testing方法的具体用法?Python SHARE_JOBS.set_for_testing怎么用?Python SHARE_JOBS.set_for_testing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oozie.conf.SHARE_JOBS的用法示例。


在下文中一共展示了SHARE_JOBS.set_for_testing方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_coordinator_workflow_access_permissions

# 需要导入模块: from oozie.conf import SHARE_JOBS [as 别名]
# 或者: from oozie.conf.SHARE_JOBS import set_for_testing [as 别名]
  def test_coordinator_workflow_access_permissions(self):
    oozie_api.OozieApi = MockOozieCoordinatorApi
    oozie_api._api_cache = None

    self.wf.is_shared = True
    self.wf.save()

    # Login as someone else not superuser
    client_another_me = make_logged_in_client(username='another_me', is_superuser=False, groupname='test')
    grant_access("another_me", "test", "oozie")
    coord = create_coordinator(self.wf, client_another_me)

    response = client_another_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
    assert_true('Editor' in response.content, response.content)
    assert_true('value="Save"' in response.content, response.content)

    # Check can schedule a non personal/shared workflow
    workflow_select = '%s</option>' % self.wf
    response = client_another_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
    assert_true(workflow_select in response.content, response.content)

    self.wf.is_shared = False
    self.wf.save()

    response = client_another_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
    assert_false(workflow_select in response.content, response.content)

    self.wf.is_shared = True
    self.wf.save()

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_another_me.post(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_true(workflow_select in response.content, response.content)
      assert_true('value="Save"' in response.content, response.content)
    finally:
      finish()

    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_another_me.post(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_true('This field is required' in response.content, response.content)
      assert_false(workflow_select in response.content, response.content)
      assert_true('value="Save"' in response.content, response.content)
    finally:
      finish()
开发者ID:kthguru,项目名称:hue,代码行数:49,代码来源:tests.py

示例2: test_edit_workflow

# 需要导入模块: from oozie.conf import SHARE_JOBS [as 别名]
# 或者: from oozie.conf.SHARE_JOBS import set_for_testing [as 别名]
  def test_edit_workflow(self):
    response = self.c.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
    assert_true('Editor' in response.content, response.content)
    assert_true('Workflow wf-name-1' in response.content, response.content)

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = self.c.post(reverse('oozie:edit_workflow', args=[self.wf.id]), {})
      assert_true('jHueNotify.error' in response.content, response.content)
    finally:
      finish()

    # Build POST dict from the forms and test this
    raise SkipTest

    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = self.c.post(reverse('oozie:edit_workflow', args=[self.wf.id]), WORKFLOW_DICT)
      assert_false('jHueNotify.error' in response.content, response.content)
    finally:
      finish()
开发者ID:kthguru,项目名称:hue,代码行数:24,代码来源:tests.py

示例3: test_workflow_action_permissions

# 需要导入模块: from oozie.conf import SHARE_JOBS [as 别名]
# 或者: from oozie.conf.SHARE_JOBS import set_for_testing [as 别名]
  def test_workflow_action_permissions(self):
    # Login as someone else
    client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test')
    grant_access("not_me", "test", "oozie")

    action1 = Node.objects.get(name='action-name-1')

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:edit_action', args=[action1.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.post(reverse('oozie:edit_action', args=[action1.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()

    # Delete
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.post(reverse('oozie:delete_action', args=[action1.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()

    action1.workflow.is_shared = True
    action1.workflow.save()

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:edit_action', args=[action1.id]))
      assert_false('Permission denied' in response.content, response.content)
    finally:
      finish()

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.post(reverse('oozie:edit_action', args=[action1.id]))
      assert_true('Not allowed' in response.content, response.content)
    finally:
      finish()

    # Delete
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.post(reverse('oozie:delete_action', args=[action1.id]))
      assert_true('Not allowed' in response.content, response.content)
    finally:
      finish()
开发者ID:kthguru,项目名称:hue,代码行数:59,代码来源:tests.py

示例4: test_coordinator_permissions

# 需要导入模块: from oozie.conf import SHARE_JOBS [as 别名]
# 或者: from oozie.conf.SHARE_JOBS import set_for_testing [as 别名]
  def test_coordinator_permissions(self):
    coord = create_coordinator(self.wf)

    response = self.c.get(reverse('oozie:edit_coordinator', args=[coord.id]))
    assert_true('Editor' in response.content, response.content)
    assert_true('value="Save"' in response.content, response.content)

    # Login as someone else
    client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test')
    grant_access("not_me", "test", "oozie")

    # List
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:list_coordinators'))
      assert_false('MyCoord' in response.content, response.content)
    finally:
      finish()
    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_not_me.get(reverse('oozie:list_coordinators'))
      assert_false('MyCoord' in response.content, response.content)
    finally:
      finish()

    # View
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()
    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_not_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_false('MyCoord' in response.content, response.content)
    finally:
      finish()

    # Share it !
    coord.is_shared = True
    coord.save()
    coord.workflow.is_shared = True
    coord.workflow.save()

    # List
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:list_coordinators'))
      assert_equal(200, response.status_code)
      assert_true('MyCoord' in response.content, response.content)
    finally:
      finish()

    # View
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_false('Permission denied' in response.content, response.content)
      assert_false('value="Save"' in response.content, response.content)
    finally:
      finish()
    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_not_me.get(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.post(reverse('oozie:edit_coordinator', args=[coord.id]))
      assert_false('MyCoord' in response.content, response.content)
      assert_true('Not allowed' in response.content, response.content)
    finally:
      finish()

    # Submit
#    finish = SHARE_JOBS.set_for_testing(False)
#    finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
#    try:
#      response = client_not_me.post(reverse('oozie:submit_coordinator', args=[coord.id]))
#      assert_true('Permission denied' in response.content, response.content)
#    finally:
#      finish()
#      finish_deployement()
#    finish = SHARE_JOBS.set_for_testing(True)
#    finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
#    try:
#      response = client_not_me.post(reverse('oozie:submit_coordinator', args=[coord.id]))
#      assert_false('Permission denied' in response.content, response.content)
#    finally:
#      finish()
#      finish_deployement()
#
#    # Resubmit
#    # Monkey patch Lib Oozie with Mock API
#    finish = SHARE_JOBS.set_for_testing(False)
#    finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
#.........这里部分代码省略.........
开发者ID:kthguru,项目名称:hue,代码行数:103,代码来源:tests.py

示例5: test_workflow_permissions

# 需要导入模块: from oozie.conf import SHARE_JOBS [as 别名]
# 或者: from oozie.conf.SHARE_JOBS import set_for_testing [as 别名]
  def test_workflow_permissions(self):
    # Monkey patch Lib Oozie with Mock API
    oozie_api.OozieApi = MockOozieApi
    oozie_api._api_cache = None

    response = self.c.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
    assert_true('Editor' in response.content, response.content)
    assert_true('Workflow wf-name-1' in response.content, response.content)
    assert_false(self.wf.is_shared)

    # Login as someone else
    client_not_me = make_logged_in_client(username='not_me', is_superuser=False, groupname='test')
    grant_access("not_me", "test", "oozie")

    # List
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:list_workflows'))
      assert_false('wf-name-1' in response.content, response.content)
    finally:
      finish()
    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_not_me.get(reverse('oozie:list_workflows'))
      assert_false('wf-name-1' in response.content, response.content)
    finally:
      finish()

    # View
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()
    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_not_me.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()

    # Share it !
    self.wf.is_shared = True
    self.wf.save()

    # List
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:list_workflows'))
      assert_equal(200, response.status_code)
      assert_true('wf-name-1' in response.content, response.content)
    finally:
      finish()

    # View
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
      assert_false('Permission denied' in response.content, response.content)
      assert_false('Save' in response.content, response.content)
    finally:
      finish()
    finish = SHARE_JOBS.set_for_testing(False)
    try:
      response = client_not_me.get(reverse('oozie:edit_workflow', args=[self.wf.id]))
      assert_true('Permission denied' in response.content, response.content)
    finally:
      finish()

    # Edit
    finish = SHARE_JOBS.set_for_testing(True)
    try:
      response = client_not_me.post(reverse('oozie:edit_workflow', args=[self.wf.id]))
      assert_true('Not allowed' in response.content, response.content)
    finally:
      finish()

    # Submit
#    finish = SHARE_JOBS.set_for_testing(False)
#    finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
#    try:
#      response = client_not_me.post(reverse('oozie:submit_workflow', args=[self.wf.id]))
#      assert_true('Permission denied' in response.content, response.content)
#    finally:
#      finish()
#      finish_deployement()
#    finish = SHARE_JOBS.set_for_testing(True)
#    finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
#    try:
#      response = client_not_me.post(reverse('oozie:submit_workflow', args=[self.wf.id]))
#      assert_false('Permission denied' in response.content, response.content)
#    finally:
#      finish()
#      finish_deployement()
#
#    # Resubmit
#    finish = SHARE_JOBS.set_for_testing(False)
#    finish_deployement = REMOTE_DEPLOYMENT_DIR.set_for_testing('/tmp')
#    try:
#.........这里部分代码省略.........
开发者ID:kthguru,项目名称:hue,代码行数:103,代码来源:tests.py


注:本文中的oozie.conf.SHARE_JOBS.set_for_testing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。