<s> import os <EOL> import sys <EOL> import copy <EOL> import lxml . etree <EOL> from mock import Mock , MagicMock , patch <EOL> from Bcfg2 . Client . Tools . POSIX . Hardlink import * <EOL> path = os . path . dirname ( __file__ ) <EOL> while path != "<STR_LIT:/>" : <EOL> if os . path . basename ( path ) . lower ( ) . startswith ( "<STR_LIT:test>" ) : <EOL> sys . path . append ( path ) <EOL> if os . path . basename ( path ) == "<STR_LIT>" : <EOL> break <EOL> path = os . path . dirname ( path ) <EOL> from Testbase import TestPOSIXLinkTool <EOL> from common import * <EOL> class TestPOSIXHardlink ( TestPOSIXLinkTool ) : <EOL> test_obj = POSIXHardlink <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test__verify ( self , mock_samefile ) : <EOL> entry = lxml . etree . Element ( "<STR_LIT>" , name = "<STR_LIT>" , type = "<STR_LIT>" , <EOL> to = "<STR_LIT>" ) <EOL> ptool = self . get_obj ( ) <EOL> self . assertEqual ( ptool . _verify ( entry ) , mock_samefile . return_value ) <EOL> self . assertItemsEqual ( mock_samefile . call_args [ <NUM_LIT:0> ] , <EOL> [ entry . get ( "<STR_LIT:name>" ) , entry . get ( "<STR_LIT:to>" ) ] ) <EOL> @ patch ( "<STR_LIT>" ) <EOL> def test__link ( self , mock_link ) : <EOL> entry = lxml . etree . Element ( "<STR_LIT>" , name = "<STR_LIT>" , type = "<STR_LIT>" , <EOL> to = "<STR_LIT>" ) <EOL> ptool = self . get_obj ( ) <EOL> self . assertEqual ( ptool . _link ( entry ) , mock_link . return_value ) <EOL> mock_link . assert_called_with ( entry . get ( "<STR_LIT:to>" ) , entry . get ( "<STR_LIT:name>" ) ) </s>
