<s> import unittest <EOL> import mock <EOL> import json <EOL> import runabove <EOL> class TestFlavor ( unittest . TestCase ) : <EOL> answer_list = '''<STR_LIT>''' <EOL> answer_one = '''<STR_LIT>''' <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> @ mock . patch ( '<STR_LIT>' ) <EOL> def setUp ( self , mock_wrapper , mock_client ) : <EOL> self . mock_wrapper = mock_wrapper <EOL> self . flavors = runabove . flavor . FlavorManager ( mock_wrapper , mock_client ) <EOL> def test_base_path ( self ) : <EOL> self . assertEqual ( self . flavors . basepath , '<STR_LIT>' ) <EOL> def test_list ( self ) : <EOL> self . mock_wrapper . get . return_value = json . loads ( self . answer_list ) <EOL> flavor_list = self . flavors . list ( ) <EOL> self . mock_wrapper . get . assert_called_once_with ( self . flavors . basepath ) <EOL> for flavor in flavor_list : <EOL> self . assertIsInstance ( flavor , runabove . flavor . Flavor ) <EOL> def test_list_by_region ( self ) : <EOL> region_name = '<STR_LIT>' <EOL> content = { '<STR_LIT>' : region_name } <EOL> self . mock_wrapper . get . return_value = json . loads ( self . answer_list ) <EOL> flavor_list = self . flavors . list_by_region ( region_name ) <EOL> self . mock_wrapper . get . assert_called_once_with ( <EOL> self . flavors . basepath , <EOL> content <EOL> ) <EOL> for flavor in flavor_list : <EOL> self . assertIsInstance ( flavor , runabove . flavor . Flavor ) <EOL> def test_get_by_name ( self ) : <EOL> self . mock_wrapper . get . return_value = json . loads ( self . answer_list ) <EOL> f = self . flavors . get_by_name ( '<STR_LIT>' ) <EOL> self . assertEquals ( <NUM_LIT:1> , len ( f ) ) <EOL> self . assertIsInstance ( f [ <NUM_LIT:0> ] , runabove . flavor . Flavor ) <EOL> def test_get_by_name_404 ( self ) : <EOL> self . mock_wrapper . get . return_value = json . loads ( self . answer_list ) <EOL> f = self . flavors . get_by_name ( '<STR_LIT>' ) <EOL> self . assertEquals ( [ ] , f ) <EOL> def test_get_by_id ( self ) : <EOL> self . mock_wrapper . get . return_value = json . loads ( self . answer_one ) <EOL> f = self . flavors . get_by_id ( '<STR_LIT>' ) <EOL> self . assertIsInstance ( f , runabove . flavor . Flavor ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
