コード例 #1
0
  def test_chmod_sticky(self):
    prefix = self.cluster.fs_prefix + '/test_chmod_sticky'

    PATH = "%s/chmod_test" % prefix
    self.cluster.fs.mkdir(PATH)

    # Get current mode and make sure sticky bit is off
    mode = expand_mode( int(self.cluster.fs.stats(PATH)["mode"]) )
    assert_equal(False, mode[-1])

    # Setup post data
    permissions = ('user_read', 'user_write', 'user_execute',
        'group_read', 'group_write', 'group_execute',
        'other_read', 'other_write', 'other_execute',
        'sticky') # Order matters!
    permissions_dict = dict(filter(lambda x: x[1], zip(permissions, mode)))
    permissions_dict['sticky'] = True
    kwargs = {'path': [PATH]}
    kwargs.update(permissions_dict)

    # Set sticky bit, then check sticky bit is on in hdfs
    response = self.c.post("/filebrowser/chmod", kwargs)
    mode = expand_mode( int(self.cluster.fs.stats(PATH)["mode"]) )
    assert_equal(True, mode[-1])

    # Unset sticky bit, then check sticky bit is off in hdfs
    del kwargs['sticky']
    response = self.c.post("/filebrowser/chmod", kwargs)
    mode = expand_mode( int(self.cluster.fs.stats(PATH)["mode"]) )
    assert_equal(False, mode[-1])
コード例 #2
0
ファイル: views_test.py プロジェクト: CaeserNieh/hue
  def test_chmod_sticky(self):
    prefix = self.cluster.fs_prefix + '/test_chmod_sticky'

    PATH = "%s/chmod_test" % prefix
    self.cluster.fs.mkdir(PATH)

    # Get current mode and make sure sticky bit is off
    mode = expand_mode( int(self.cluster.fs.stats(PATH)["mode"]) )
    assert_equal(False, mode[-1])

    # Setup post data
    permissions = ('user_read', 'user_write', 'user_execute',
        'group_read', 'group_write', 'group_execute',
        'other_read', 'other_write', 'other_execute',
        'sticky') # Order matters!
    permissions_dict = dict(filter(lambda x: x[1], zip(permissions, mode)))
    permissions_dict['sticky'] = True
    kwargs = {'path': [PATH]}
    kwargs.update(permissions_dict)

    # Set sticky bit, then check sticky bit is on in hdfs
    response = self.c.post("/filebrowser/chmod", kwargs)
    mode = expand_mode( int(self.cluster.fs.stats(PATH)["mode"]) )
    assert_equal(True, mode[-1])

    # Unset sticky bit, then check sticky bit is off in hdfs
    del kwargs['sticky']
    response = self.c.post("/filebrowser/chmod", kwargs)
    mode = expand_mode( int(self.cluster.fs.stats(PATH)["mode"]) )
    assert_equal(False, mode[-1])
コード例 #3
0
ファイル: views_test.py プロジェクト: jackerxff/hue
def test_chmod_sticky():
    cluster = pseudo_hdfs4.shared_cluster()

    try:
        c = make_logged_in_client(cluster.superuser)
        cluster.fs.setuser(cluster.superuser)

        PATH = "/chmod_test"
        cluster.fs.mkdir(PATH)

        # Get current mode and make sure sticky bit is off
        mode = expand_mode(int(cluster.fs.stats(PATH)["mode"]))
        assert_equal(False, mode[-1])

        # Setup post data
        permissions = (
            "user_read",
            "user_write",
            "user_execute",
            "group_read",
            "group_write",
            "group_execute",
            "other_read",
            "other_write",
            "other_execute",
            "sticky",
        )  # Order matters!
        permissions_dict = dict(filter(lambda x: x[1], zip(permissions, mode)))
        permissions_dict["sticky"] = True
        kwargs = {"path": [PATH]}
        kwargs.update(permissions_dict)

        # Set sticky bit, then check sticky bit is on in hdfs
        response = c.post("/filebrowser/chmod", kwargs)
        mode = expand_mode(int(cluster.fs.stats(PATH)["mode"]))
        assert_equal(True, mode[-1])

        # Unset sticky bit, then check sticky bit is off in hdfs
        del kwargs["sticky"]
        response = c.post("/filebrowser/chmod", kwargs)
        mode = expand_mode(int(cluster.fs.stats(PATH)["mode"]))
        assert_equal(False, mode[-1])

    finally:
        try:
            cluster.fs.rmtree(PATH)  # Clean up
        except:
            pass  # Don't let cleanup errors mask earlier failures
コード例 #4
0
def test_chmod_sticky():
    cluster = pseudo_hdfs4.shared_cluster()

    try:
        c = make_logged_in_client(cluster.superuser)
        cluster.fs.setuser(cluster.superuser)

        PATH = "/chmod_test"
        cluster.fs.mkdir(PATH)

        # Get current mode and make sure sticky bit is off
        mode = expand_mode(int(cluster.fs.stats(PATH)["mode"]))
        assert_equal(False, mode[-1])

        # Setup post data
        permissions = ('user_read', 'user_write', 'user_execute', 'group_read',
                       'group_write', 'group_execute', 'other_read',
                       'other_write', 'other_execute', 'sticky'
                       )  # Order matters!
        permissions_dict = dict(filter(lambda x: x[1], zip(permissions, mode)))
        permissions_dict['sticky'] = True
        kwargs = {'path': [PATH]}
        kwargs.update(permissions_dict)

        # Set sticky bit, then check sticky bit is on in hdfs
        response = c.post("/filebrowser/chmod", kwargs)
        mode = expand_mode(int(cluster.fs.stats(PATH)["mode"]))
        assert_equal(True, mode[-1])

        # Unset sticky bit, then check sticky bit is off in hdfs
        del kwargs['sticky']
        response = c.post("/filebrowser/chmod", kwargs)
        mode = expand_mode(int(cluster.fs.stats(PATH)["mode"]))
        assert_equal(False, mode[-1])

    finally:
        try:
            cluster.fs.rmtree(PATH)  # Clean up
        except:
            pass  # Don't let cleanup errors mask earlier failures
コード例 #5
0
ファイル: views_test.py プロジェクト: QLGu/hue
def test_chmod_sticky():
  cluster = pseudo_hdfs4.shared_cluster()

  try:
    c = make_logged_in_client(cluster.superuser)
    cluster.fs.setuser(cluster.superuser)

    PATH = "/chmod_test"
    cluster.fs.mkdir(PATH)

    # Get current mode and make sure sticky bit is off
    mode = expand_mode( int(cluster.fs.stats(PATH)["mode"]) )
    assert_equal(False, mode[-1])

    # Setup post data
    permissions = ('user_read', 'user_write', 'user_execute',
        'group_read', 'group_write', 'group_execute',
        'other_read', 'other_write', 'other_execute',
        'sticky') # Order matters!
    permissions_dict = dict(filter(lambda x: x[1], zip(permissions, mode)))
    permissions_dict['sticky'] = True
    kwargs = {'path': [PATH]}
    kwargs.update(permissions_dict)

    # Set sticky bit, then check sticky bit is on in hdfs
    response = c.post("/filebrowser/chmod", kwargs)
    mode = expand_mode( int(cluster.fs.stats(PATH)["mode"]) )
    assert_equal(True, mode[-1])

    # Unset sticky bit, then check sticky bit is off in hdfs
    del kwargs['sticky']
    response = c.post("/filebrowser/chmod", kwargs)
    mode = expand_mode( int(cluster.fs.stats(PATH)["mode"]) )
    assert_equal(False, mode[-1])

  finally:
    cleanup_tree(cluster, PATH)