#!/usr/bin/env python
# test has been developed by Robert Harakaly and changed for SAM by Victor Galaktionov 
# get information about a LFC file or directory in the name server (lfc_stat) 
# meta: proxy=true
# meta: preconfig=../../LFC-config

import os,lfc,sys
from testClass import _test, _ntest, SAM_Run, LFC_VO, TEST_HOME

class lfc_stat_test:
    def __init__(self):
        self.name = "lfc_stat_test"

    def test(self):
        stat=lfc.lfc_filestat()
        ret=lfc.lfc_stat("/",stat)
        return ret

    def testnon(self):
        stat=lfc.lfc_filestat()
        ret=lfc.lfc_stat("/nonexisting",stat)
        return ret

    def run(self):
        print "%s:                     " %self.name
	test01 = self.test() == 0
        if test01:
            print "[OK]"
        else:
            print "[FAILED]"
	test02 = self.testnon() == -1
        if test02:
            print "[OK]"
        else:
            print "[FAILED]"
        return test01 & test02

#************* Interface for SAM and Python tests ***************
SAM_Run(lfc_stat_test)

