<s> import os <EOL> import unittest <EOL> import uuid <EOL> from Infrastructure . SessionManager import SessionManager <EOL> os . environ [ "<STR_LIT>" ] = "<STR_LIT>" <EOL> class FakeUuidGenerator ( object ) : <EOL> def __init__ ( self , static_uuid ) : <EOL> self . static_uuid = static_uuid <EOL> def uuid1 ( self ) : <EOL> return uuid . UUID ( self . static_uuid ) <EOL> class TestsSessionManager ( unittest . TestCase ) : <EOL> def test_creating_session ( self ) : <EOL> file_name = '<STR_LIT>' <EOL> try : <EOL> os . remove ( os . path . dirname ( os . path . realpath ( __file__ ) ) + "<STR_LIT>" + file_name ) <EOL> except OSError : <EOL> pass <EOL> fake_uuid_generator = FakeUuidGenerator ( '<STR_LIT>' % file_name ) <EOL> session_manager = SessionManager ( fake_uuid_generator ) <EOL> session_manager . create_session ( ) <EOL> self . assertEqual ( session_manager . get_active_sessions ( ) , [ file_name ] ) <EOL> def test_clear_sessions ( self ) : <EOL> file_name = '<STR_LIT>' <EOL> try : <EOL> os . remove ( os . path . dirname ( os . path . realpath ( __file__ ) ) + "<STR_LIT>" + file_name ) <EOL> except OSError : <EOL> pass <EOL> fake_uuid_generator = FakeUuidGenerator ( '<STR_LIT>' % file_name ) <EOL> session_manager = SessionManager ( fake_uuid_generator ) <EOL> session_manager . create_session ( ) <EOL> session_manager . clear_sessions ( ) <EOL> self . assertEqual ( session_manager . get_active_sessions ( ) , [ ] ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
