<s> import pytest <EOL> from mock import patch , MagicMock <EOL> from gitfs . worker . commit_queue import BaseQueue , CommitQueue <EOL> class TestBaseQueue ( object ) : <EOL> def test_commit ( self ) : <EOL> queue = BaseQueue ( ) <EOL> with pytest . raises ( Exception ) : <EOL> queue . commit ( ) <EOL> def test_get ( self ) : <EOL> mocked_queue = MagicMock ( ) <EOL> mocked_queue . get . return_value = "<STR_LIT>" <EOL> with patch ( '<STR_LIT>' ) as mocked_queue_module : <EOL> mocked_queue_module . return_value = mocked_queue <EOL> queue = BaseQueue ( ) <EOL> assert queue . get ( "<STR_LIT:args>" , arg = "<STR_LIT>" ) == "<STR_LIT>" <EOL> mocked_queue . get . assert_called_once_with ( "<STR_LIT:args>" , arg = "<STR_LIT>" ) <EOL> class TestCommitQueue ( object ) : <EOL> def test_add ( self ) : <EOL> mocked_queue = MagicMock ( ) <EOL> queue = CommitQueue ( ) <EOL> queue . queue = mocked_queue <EOL> queue . add ( "<STR_LIT>" ) <EOL> mocked_queue . put . assert_called_once_with ( "<STR_LIT>" ) <EOL> def test_to_list ( self ) : <EOL> queue = CommitQueue ( ) <EOL> assert queue . _to_list ( "<STR_LIT:a>" ) == [ "<STR_LIT:a>" ] <EOL> def test_commit_witth_no_message ( self ) : <EOL> queue = CommitQueue ( ) <EOL> with pytest . raises ( ValueError ) : <EOL> queue . commit ( ) <EOL> def test_commit_witth_no_add_and_no_remove ( self ) : <EOL> queue = CommitQueue ( ) <EOL> with pytest . raises ( ValueError ) : <EOL> queue . commit ( message = "<STR_LIT:message>" ) <EOL> def test_commit ( self ) : <EOL> mocked_queue = MagicMock ( ) <EOL> queue = CommitQueue ( ) <EOL> queue . queue = mocked_queue <EOL> queue . commit ( message = "<STR_LIT:message>" , add = "<STR_LIT>" , remove = "<STR_LIT>" ) <EOL> mocked_queue . put . assert_called_once_with ( { <EOL> '<STR_LIT:type>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : [ "<STR_LIT>" ] , <EOL> '<STR_LIT:message>' : "<STR_LIT:message>" , <EOL> '<STR_LIT>' : [ "<STR_LIT>" ] , <EOL> } <EOL> } ) </s>
