<s> import unittest <EOL> import mock <EOL> import appium <EOL> from AppiumLibrary . keywords import _ApplicationManagementKeywords <EOL> from webdriverremotemock import WebdriverRemoteMock <EOL> class ApplicationManagementKeywordsTests ( unittest . TestCase ) : <EOL> def test_close_application_clean_cache_sucessful ( self ) : <EOL> am = _ApplicationManagementKeywords ( ) <EOL> application = mock . Mock ( ) <EOL> am . _debug = mock . Mock ( ) <EOL> self . assertFalse ( am . _cache . current ) <EOL> am . _cache . register ( application , '<STR_LIT>' ) <EOL> self . assertTrue ( am . _cache . current ) <EOL> am . close_application ( ) <EOL> self . assertFalse ( am . _cache . current ) <EOL> def test_open_application_register_sucessful ( self ) : <EOL> am = _ApplicationManagementKeywords ( ) <EOL> appium . webdriver . Remote = WebdriverRemoteMock <EOL> am . _debug = mock . Mock ( ) <EOL> self . assertFalse ( am . _cache . current ) <EOL> am . open_application ( '<STR_LIT>' ) <EOL> self . assertTrue ( am . _cache . current ) <EOL> def test_switch_application ( self ) : <EOL> am = _ApplicationManagementKeywords ( ) <EOL> appium . webdriver . Remote = WebdriverRemoteMock <EOL> am . _debug = mock . Mock ( ) <EOL> self . assertFalse ( am . _cache . current ) <EOL> self . assertEqual ( <NUM_LIT:1> , am . open_application ( '<STR_LIT>' , alias = '<STR_LIT>' ) ) <EOL> self . assertEqual ( <NUM_LIT:2> , am . open_application ( '<STR_LIT>' , alias = '<STR_LIT>' ) ) <EOL> self . assertEqual ( <NUM_LIT:2> , am . _cache . current_index ) <EOL> am . switch_application ( '<STR_LIT>' ) <EOL> self . assertEqual ( <NUM_LIT:1> , am . _cache . current_index ) <EOL> am . switch_application ( <NUM_LIT:2> ) <EOL> self . assertEqual ( <NUM_LIT:2> , am . _cache . current_index ) <EOL> self . assertEqual ( <NUM_LIT:2> , am . switch_application ( None ) ) </s>
