<s> from __future__ import absolute_import <EOL> import os <EOL> from os import path <EOL> import unittest <EOL> from click . testing import CliRunner <EOL> from tldr import cli <EOL> import mock <EOL> ROOT = path . dirname ( path . realpath ( __file__ ) ) <EOL> class BasicTestCase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . repo_dir = path . join ( ROOT , '<STR_LIT>' ) <EOL> self . config_path = path . join ( self . repo_dir , '<STR_LIT>' ) <EOL> os . environ [ '<STR_LIT>' ] = self . repo_dir <EOL> self . runner = CliRunner ( ) <EOL> self . call_init_command ( ) <EOL> def tearDown ( self ) : <EOL> if path . exists ( self . config_path ) : <EOL> os . remove ( self . config_path ) <EOL> def call_init_command ( self , repo_dir = path . join ( ROOT , '<STR_LIT>' ) , <EOL> platform = '<STR_LIT>' ) : <EOL> with mock . patch ( '<STR_LIT>' , side_effect = [ repo_dir , platform ] ) : <EOL> result = self . runner . invoke ( cli . init ) <EOL> return result <EOL> def call_update_command ( self ) : <EOL> with mock . patch ( '<STR_LIT>' , return_value = None ) : <EOL> result = self . runner . invoke ( cli . update ) <EOL> return result <EOL> def call_find_command ( self , command_name ) : <EOL> result = self . runner . invoke ( cli . find , [ command_name ] ) <EOL> return result <EOL> def call_reindex_command ( self ) : <EOL> result = self . runner . invoke ( cli . reindex ) <EOL> return result <EOL> def call_locate_command ( self , command_name ) : <EOL> result = self . runner . invoke ( cli . locate , [ command_name ] ) <EOL> return result </s>
