<s> from tests import unittest , mock , Redmine , URL <EOL> from redmine . resultsets import ResourceSet <EOL> responses = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT:foo>' } } , <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } } , <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT>' : <NUM_LIT:2> , '<STR_LIT:id>' : <NUM_LIT:1> } } , <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT>' : <NUM_LIT:3> , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT>' : <NUM_LIT:4> , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT>' : <NUM_LIT:3> , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT>' : <NUM_LIT:4> , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT:filename>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT:title>' : '<STR_LIT>' , '<STR_LIT:version>' : <NUM_LIT:1> } } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT:title>' : '<STR_LIT>' , '<STR_LIT:version>' : <NUM_LIT:1> } , { '<STR_LIT:title>' : '<STR_LIT>' , '<STR_LIT:version>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:1> } } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:name>' : '<STR_LIT>' } } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:name>' : '<STR_LIT>' } , { '<STR_LIT:id>' : <NUM_LIT:2> , '<STR_LIT:name>' : '<STR_LIT>' } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:1> } } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT:version>' : { <EOL> '<STR_LIT>' : { '<STR_LIT:version>' : { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:name>' : '<STR_LIT>' } } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:name>' : '<STR_LIT>' } , { '<STR_LIT:id>' : <NUM_LIT:2> , '<STR_LIT:name>' : '<STR_LIT>' } ] } , <EOL> } , <EOL> '<STR_LIT:user>' : { <EOL> '<STR_LIT>' : { '<STR_LIT:user>' : { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } } , <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } } , <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } } , <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT:title>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:title>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT:title>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:title>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT:content>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } } , <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } } , <EOL> '<STR_LIT:all>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:2> } ] } , <EOL> } , <EOL> } <EOL> class TestResources ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . url = URL <EOL> self . redmine = Redmine ( self . url ) <EOL> self . response = mock . Mock ( status_code = <NUM_LIT:200> ) <EOL> patcher_get = mock . patch ( '<STR_LIT>' , return_value = self . response ) <EOL> patcher_post = mock . patch ( '<STR_LIT>' , return_value = self . response ) <EOL> patcher_put = mock . patch ( '<STR_LIT>' , return_value = self . response ) <EOL> patcher_delete = mock . patch ( '<STR_LIT>' , return_value = self . response ) <EOL> patcher_get . start ( ) <EOL> patcher_post . start ( ) <EOL> patcher_put . start ( ) <EOL> patcher_delete . start ( ) <EOL> self . addCleanup ( patcher_get . stop ) <EOL> self . addCleanup ( patcher_post . stop ) <EOL> self . addCleanup ( patcher_put . stop ) <EOL> self . addCleanup ( patcher_delete . stop ) <EOL> def test_supports_dictionary_like_attribute_retrieval ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> project = self . redmine . project . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( project [ '<STR_LIT:id>' ] , <NUM_LIT:1> ) <EOL> self . assertEqual ( project [ '<STR_LIT:name>' ] , '<STR_LIT>' ) <EOL> def test_supports_url_retrieval ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . project . get ( <NUM_LIT:1> ) . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_supports_internal_id ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . project . get ( <NUM_LIT:1> ) . internal_id , <NUM_LIT:1> ) <EOL> def test_supports_setting_of_attributes ( self ) : <EOL> project = self . redmine . project . new ( ) <EOL> project . name = '<STR_LIT>' <EOL> project . description = '<STR_LIT>' <EOL> self . assertEqual ( project . name , '<STR_LIT>' ) <EOL> self . assertEqual ( project . description , '<STR_LIT>' ) <EOL> def test_supports_setting_of_date_datetime_attributes ( self ) : <EOL> from datetime import date , datetime <EOL> issue = self . redmine . issue . new ( ) <EOL> issue . start_date = date ( <NUM_LIT> , <NUM_LIT:3> , <NUM_LIT:9> ) <EOL> self . assertEqual ( issue . _attributes [ '<STR_LIT>' ] , date ( <NUM_LIT> , <NUM_LIT:3> , <NUM_LIT:9> ) ) <EOL> self . assertEqual ( issue . _changes [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> issue . start_date = datetime ( <NUM_LIT> , <NUM_LIT:3> , <NUM_LIT:9> , <NUM_LIT:20> , <NUM_LIT:2> , <NUM_LIT:2> ) <EOL> self . assertEqual ( issue . _attributes [ '<STR_LIT>' ] , datetime ( <NUM_LIT> , <NUM_LIT:3> , <NUM_LIT:9> , <NUM_LIT:20> , <NUM_LIT:2> , <NUM_LIT:2> ) ) <EOL> self . assertEqual ( issue . _changes [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> def test_supports_setting_of_attributes_via_dict ( self ) : <EOL> project = self . redmine . project . new ( ) <EOL> project [ '<STR_LIT:name>' ] = '<STR_LIT>' <EOL> project [ '<STR_LIT:description>' ] = '<STR_LIT>' <EOL> self . assertEqual ( project . name , '<STR_LIT>' ) <EOL> self . assertEqual ( project . description , '<STR_LIT>' ) <EOL> def test_setting_create_readonly_attrs_raises_exception ( self ) : <EOL> from redmine . exceptions import ReadonlyAttrError <EOL> with self . assertRaises ( ReadonlyAttrError ) : <EOL> project = self . redmine . project . new ( ) <EOL> project . id = <NUM_LIT:1> <EOL> def test_setting_update_readonly_attrs_raises_exception ( self ) : <EOL> from redmine . exceptions import ReadonlyAttrError <EOL> with self . assertRaises ( ReadonlyAttrError ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> project = self . redmine . project . get ( <NUM_LIT:1> ) <EOL> project . identifier = <NUM_LIT:1> <EOL> def test_control_raising_of_resource_attr_exception ( self ) : <EOL> from redmine . exceptions import ResourceAttrError <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . redmine . raise_attr_exception = False <EOL> self . assertEqual ( self . redmine . project . get ( <NUM_LIT:1> ) . foo , None ) <EOL> self . redmine . raise_attr_exception = ( '<STR_LIT>' , ) <EOL> self . assertRaises ( ResourceAttrError , lambda : self . redmine . project . get ( <NUM_LIT:1> ) . foo ) <EOL> self . redmine . raise_attr_exception = True <EOL> self . assertRaises ( ResourceAttrError , lambda : self . redmine . project . get ( <NUM_LIT:1> ) . foo ) <EOL> def test_saving_new_resource_creates_it ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> project = self . redmine . project . new ( ) <EOL> project . name = '<STR_LIT>' <EOL> self . assertEqual ( project . save ( ) , True ) <EOL> self . assertEqual ( project . id , <NUM_LIT:1> ) <EOL> def test_saving_existing_resource_updates_it ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> project = self . redmine . project . get ( <NUM_LIT:1> ) <EOL> project . name = '<STR_LIT>' <EOL> self . assertEqual ( project . save ( ) , True ) <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:name>' : '<STR_LIT>' } } <EOL> project = project . refresh ( ) <EOL> self . assertEqual ( project . name , '<STR_LIT>' ) <EOL> def test_custom_int ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( int ( self . redmine . project . get ( <NUM_LIT:1> ) ) , <NUM_LIT:1> ) <EOL> def test_custom_str ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( str ( self . redmine . project . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_custom_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( self . redmine . project . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_can_refresh_itself ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> project = self . redmine . project . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( project . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( project . name , '<STR_LIT>' ) <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:2> , '<STR_LIT:name>' : '<STR_LIT>' } } <EOL> project = project . refresh ( ) <EOL> self . assertEqual ( project . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( project . name , '<STR_LIT>' ) <EOL> def test_resource_dict_is_converted_to_resource_object ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> issue . _attributes [ '<STR_LIT>' ] = { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:name>' : '<STR_LIT>' } <EOL> self . assertEqual ( repr ( issue . author ) , '<STR_LIT>' ) <EOL> def test_resource_list_of_dicts_is_converted_to_resource_set ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> issue . _attributes [ '<STR_LIT>' ] = [ { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:name>' : '<STR_LIT>' } , { '<STR_LIT:id>' : <NUM_LIT:2> , '<STR_LIT:name>' : '<STR_LIT>' } ] <EOL> self . assertEqual ( <EOL> repr ( issue . custom_fields ) , <EOL> '<STR_LIT>' <EOL> ) <EOL> def test_dir_returns_resource_attributes ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> attributes = dir ( self . redmine . issue . get ( <NUM_LIT:1> ) ) <EOL> self . assertIn ( '<STR_LIT:id>' , attributes ) <EOL> self . assertIn ( '<STR_LIT>' , attributes ) <EOL> self . assertIn ( '<STR_LIT>' , attributes ) <EOL> self . assertIn ( '<STR_LIT>' , attributes ) <EOL> def test_supports_iteration ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> project = list ( self . redmine . project . get ( <NUM_LIT:1> ) ) <EOL> self . assertIn ( ( '<STR_LIT:name>' , '<STR_LIT>' ) , project ) <EOL> self . assertIn ( ( '<STR_LIT:id>' , <NUM_LIT:1> ) , project ) <EOL> def test_setting_custom_field_raises_exception_if_not_list_of_dicts ( self ) : <EOL> from redmine . exceptions import CustomFieldValueError <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : [ { '<STR_LIT:id>' : <NUM_LIT:1> } ] } } <EOL> project = self . redmine . project . get ( <NUM_LIT:1> ) <EOL> with self . assertRaises ( CustomFieldValueError ) : <EOL> project . custom_fields = '<STR_LIT:foo>' <EOL> def test_resource_is_picklable ( self ) : <EOL> import pickle <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> project = self . redmine . project . get ( <NUM_LIT:1> ) <EOL> unpickled_project = pickle . loads ( pickle . dumps ( project ) ) <EOL> self . assertEqual ( project . id , unpickled_project . id ) <EOL> self . assertEqual ( project . name , unpickled_project . name ) <EOL> def test_project_version ( self ) : <EOL> self . assertEqual ( self . redmine . project . resource_class . redmine_version , '<STR_LIT:1.0>' ) <EOL> def test_project_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> project = self . redmine . project . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( project . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( project . name , '<STR_LIT>' ) <EOL> def test_project_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> projects = self . redmine . project . all ( ) <EOL> self . assertEqual ( projects [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( projects [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( projects [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( projects [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_project_create ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> project = self . redmine . project . create ( name = '<STR_LIT>' , identifier = '<STR_LIT:foo>' ) <EOL> self . assertEqual ( project . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( project . name , '<STR_LIT>' ) <EOL> def test_project_delete ( self ) : <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( self . redmine . project . delete ( <NUM_LIT:1> ) , True ) <EOL> def test_project_update ( self ) : <EOL> self . response . json . return_value = { <EOL> '<STR_LIT>' : { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : [ { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:value>' : '<STR_LIT:foo>' } ] } } <EOL> project = self . redmine . project . get ( <NUM_LIT:1> ) <EOL> project . homepage = '<STR_LIT>' <EOL> project . parent_id = <NUM_LIT:3> <EOL> project . custom_fields = [ { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:value>' : '<STR_LIT:bar>' } ] <EOL> self . assertEqual ( project . save ( ) , True ) <EOL> self . assertEqual ( project . custom_fields [ <NUM_LIT:0> ] . value , '<STR_LIT:bar>' ) <EOL> def test_project_relations ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> project = self . redmine . project . get ( <NUM_LIT:1> ) <EOL> self . assertIsInstance ( project . wiki_pages , ResourceSet ) <EOL> self . assertIsInstance ( project . memberships , ResourceSet ) <EOL> self . assertIsInstance ( project . issue_categories , ResourceSet ) <EOL> self . assertIsInstance ( project . versions , ResourceSet ) <EOL> self . assertIsInstance ( project . news , ResourceSet ) <EOL> self . assertIsInstance ( project . issues , ResourceSet ) <EOL> def test_project_includes ( self ) : <EOL> response_includes = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> project = self . redmine . project . get ( <NUM_LIT:1> ) <EOL> response_includes [ '<STR_LIT>' ] . update ( responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( project . issue_categories , ResourceSet ) <EOL> response_includes [ '<STR_LIT>' ] . update ( responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] ) <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( project . trackers , ResourceSet ) <EOL> response_includes [ '<STR_LIT>' ] . update ( { '<STR_LIT>' : [ { '<STR_LIT:id>' : <NUM_LIT> , '<STR_LIT:name>' : '<STR_LIT>' } ] } ) <EOL> self . response . json . return_value = response_includes <EOL> self . assertEqual ( project . enabled_modules , [ '<STR_LIT>' ] ) <EOL> def test_project_returns_status_without_conversion ( self ) : <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:status>' : <NUM_LIT:1> } } <EOL> project = self . redmine . project . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( project . status , <NUM_LIT:1> ) <EOL> def test_project_is_new ( self ) : <EOL> project = self . redmine . project . new ( ) <EOL> self . assertEqual ( int ( project ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( str ( project ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( project ) , '<STR_LIT>' ) <EOL> def test_project_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . project . get ( <NUM_LIT:1> ) . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_project_parent_converts_to_resource ( self ) : <EOL> from redmine . resources import Project <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:2> } } } <EOL> parent = self . redmine . project . get ( <NUM_LIT:1> ) . parent <EOL> self . assertIsInstance ( parent , Project ) <EOL> self . assertEqual ( parent . id , <NUM_LIT:2> ) <EOL> def test_issue_version ( self ) : <EOL> self . assertEqual ( self . redmine . issue . resource_class . redmine_version , '<STR_LIT:1.0>' ) <EOL> def test_issue_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( issue . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( issue . subject , '<STR_LIT>' ) <EOL> def test_issue_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> issues = self . redmine . issue . all ( ) <EOL> self . assertEqual ( issues [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( issues [ <NUM_LIT:0> ] . subject , '<STR_LIT>' ) <EOL> self . assertEqual ( issues [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( issues [ <NUM_LIT:1> ] . subject , '<STR_LIT>' ) <EOL> def test_issue_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issues = self . redmine . issue . filter ( project_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( issues [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( issues [ <NUM_LIT:0> ] . subject , '<STR_LIT>' ) <EOL> self . assertEqual ( issues [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( issues [ <NUM_LIT:1> ] . subject , '<STR_LIT>' ) <EOL> def test_issue_create ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue = self . redmine . issue . create ( project_id = '<STR_LIT:bar>' , subject = '<STR_LIT>' , version_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( issue . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( issue . subject , '<STR_LIT>' ) <EOL> def test_issue_delete ( self ) : <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( self . redmine . issue . delete ( <NUM_LIT:1> ) , True ) <EOL> def test_issue_update ( self ) : <EOL> self . response . json . return_value = { <EOL> '<STR_LIT>' : { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : [ { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:value>' : '<STR_LIT:foo>' } ] } } <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> issue . subject = '<STR_LIT>' <EOL> issue . description = '<STR_LIT>' <EOL> issue . custom_fields = [ { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:value>' : '<STR_LIT:bar>' } ] <EOL> self . assertEqual ( issue . save ( ) , True ) <EOL> self . assertEqual ( issue . custom_fields [ <NUM_LIT:0> ] . value , '<STR_LIT:bar>' ) <EOL> def test_issue_relations ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> self . assertIsInstance ( issue . relations , ResourceSet ) <EOL> self . assertIsInstance ( issue . time_entries , ResourceSet ) <EOL> def test_issue_includes ( self ) : <EOL> response_includes = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( issue . children , ResourceSet ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( issue . attachments , ResourceSet ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( issue . relations , ResourceSet ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ { '<STR_LIT:id>' : <NUM_LIT:1> } , { '<STR_LIT:id>' : <NUM_LIT:2> } ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( issue . journals , ResourceSet ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT:user>' ] [ '<STR_LIT:all>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( issue . watchers , ResourceSet ) <EOL> def test_issue_add_watcher_raises_exception_if_wrong_version ( self ) : <EOL> from redmine . exceptions import ResourceVersionMismatchError <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . redmine . ver = '<STR_LIT>' <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> self . assertRaises ( ResourceVersionMismatchError , lambda : issue . watcher . add ( <NUM_LIT:1> ) ) <EOL> def test_issue_add_watcher ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( issue . watcher . add ( <NUM_LIT:1> ) , True ) <EOL> def test_issue_remove_watcher ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( issue . watcher . remove ( <NUM_LIT:1> ) , True ) <EOL> def test_issue_custom_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( self . redmine . issue . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_issue_custom_repr_without_subject ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> del issue [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( issue ) , '<STR_LIT>' ) <EOL> def test_issue_custom_str ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( str ( self . redmine . issue . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_issue_custom_str_without_subject ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> del issue [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( str ( issue ) , '<STR_LIT:1>' ) <EOL> def test_issue_journals ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> issue . _attributes [ '<STR_LIT>' ] = [ { '<STR_LIT:id>' : <NUM_LIT:1> } ] <EOL> self . assertEqual ( str ( issue . journals [ <NUM_LIT:0> ] ) , '<STR_LIT:1>' ) <EOL> self . assertEqual ( repr ( issue . journals [ <NUM_LIT:0> ] ) , '<STR_LIT>' ) <EOL> def test_issue_journals_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> issue . _attributes [ '<STR_LIT>' ] = [ { '<STR_LIT:id>' : <NUM_LIT:1> } ] <EOL> self . assertEqual ( issue . journals [ <NUM_LIT:0> ] . url , None ) <EOL> def test_issue_version_can_be_retrieved_via_version_attribute ( self ) : <EOL> from redmine . resources import Version <EOL> self . response . json . return_value = { <EOL> '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:name>' : '<STR_LIT>' } } } <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> self . assertIsInstance ( issue . version , Version ) <EOL> def test_issue_version_can_be_set_via_version_attribute ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue = self . redmine . issue . get ( <NUM_LIT:1> ) <EOL> issue . version_id = <NUM_LIT:1> <EOL> self . assertEqual ( issue . fixed_version . id , <NUM_LIT:1> ) <EOL> def test_issue_is_new ( self ) : <EOL> issue = self . redmine . issue . new ( ) <EOL> self . assertEqual ( int ( issue ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( str ( issue ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( issue ) , '<STR_LIT>' ) <EOL> def test_issue_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . issue . get ( <NUM_LIT:1> ) . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_issue_parent_converts_to_resource ( self ) : <EOL> from redmine . resources import Issue <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:2> } } } <EOL> parent = self . redmine . issue . get ( <NUM_LIT:1> ) . parent <EOL> self . assertIsInstance ( parent , Issue ) <EOL> self . assertEqual ( parent . id , <NUM_LIT:2> ) <EOL> def test_time_entry_version ( self ) : <EOL> self . assertEqual ( self . redmine . time_entry . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_time_entry_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> time_entry = self . redmine . time_entry . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( time_entry . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( time_entry . hours , <NUM_LIT:2> ) <EOL> def test_time_entry_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> time_entries = self . redmine . time_entry . all ( ) <EOL> self . assertEqual ( time_entries [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( time_entries [ <NUM_LIT:0> ] . hours , <NUM_LIT:3> ) <EOL> self . assertEqual ( time_entries [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( time_entries [ <NUM_LIT:1> ] . hours , <NUM_LIT:4> ) <EOL> def test_time_entry_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> time_entries = self . redmine . time_entry . filter ( issue_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( time_entries [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( time_entries [ <NUM_LIT:0> ] . hours , <NUM_LIT:3> ) <EOL> self . assertEqual ( time_entries [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( time_entries [ <NUM_LIT:1> ] . hours , <NUM_LIT:4> ) <EOL> def test_time_entry_create ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> time_entry = self . redmine . time_entry . create ( issue_id = <NUM_LIT:1> , hours = <NUM_LIT:2> ) <EOL> self . assertEqual ( time_entry . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( time_entry . hours , <NUM_LIT:2> ) <EOL> def test_time_entry_delete ( self ) : <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( self . redmine . time_entry . delete ( <NUM_LIT:1> ) , True ) <EOL> def test_time_entry_update ( self ) : <EOL> self . response . json . return_value = { <EOL> '<STR_LIT>' : { '<STR_LIT>' : <NUM_LIT:2> , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:1> } , '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:1> } } } <EOL> time_entry = self . redmine . time_entry . get ( <NUM_LIT:1> ) <EOL> time_entry . hours = <NUM_LIT:3> <EOL> time_entry . issue_id = <NUM_LIT:2> <EOL> time_entry . activity_id = <NUM_LIT:2> <EOL> self . assertEqual ( time_entry . save ( ) , True ) <EOL> def test_time_entry_translate_params ( self ) : <EOL> manager = self . redmine . time_entry <EOL> manager . filter ( from_date = '<STR_LIT>' , to_date = '<STR_LIT>' ) <EOL> self . assertIn ( '<STR_LIT>' , manager . params ) <EOL> self . assertIn ( '<STR_LIT:to>' , manager . params ) <EOL> def test_time_entry_custom_str ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( str ( self . redmine . time_entry . get ( <NUM_LIT:1> ) ) , '<STR_LIT:1>' ) <EOL> def test_time_entry_custom_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( self . redmine . time_entry . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_time_entry_is_new ( self ) : <EOL> time_entry = self . redmine . time_entry . new ( ) <EOL> self . assertEqual ( int ( time_entry ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( str ( time_entry ) , '<STR_LIT:0>' ) <EOL> self . assertEqual ( repr ( time_entry ) , '<STR_LIT>' ) <EOL> def test_time_entry_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . time_entry . get ( <NUM_LIT:1> ) . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_enumeration_version ( self ) : <EOL> self . assertEqual ( self . redmine . enumeration . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_enumeration_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> enumerations = self . redmine . enumeration . filter ( resource = '<STR_LIT>' ) <EOL> self . assertEqual ( enumerations [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( enumerations [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( enumerations [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( enumerations [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_enumeration_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( <EOL> self . redmine . enumeration . filter ( resource = '<STR_LIT>' ) [ <NUM_LIT:0> ] . url , <EOL> '<STR_LIT>' . format ( self . url ) <EOL> ) <EOL> def test_attachment_version ( self ) : <EOL> self . assertEqual ( self . redmine . attachment . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_attachment_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> attachment = self . redmine . attachment . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( attachment . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( attachment . filename , '<STR_LIT>' ) <EOL> def test_attachment_custom_str ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( str ( self . redmine . attachment . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_attachment_custom_str_without_filename ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> attachment = self . redmine . attachment . get ( <NUM_LIT:1> ) <EOL> del attachment [ '<STR_LIT>' ] [ '<STR_LIT:filename>' ] <EOL> self . assertEqual ( str ( attachment ) , '<STR_LIT:1>' ) <EOL> def test_attachment_custom_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( self . redmine . attachment . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_attachment_custom_repr_without_subject ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> attachment = self . redmine . attachment . get ( <NUM_LIT:1> ) <EOL> del attachment [ '<STR_LIT>' ] [ '<STR_LIT:filename>' ] <EOL> self . assertEqual ( repr ( attachment ) , '<STR_LIT>' ) <EOL> def test_attachment_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . attachment . get ( <NUM_LIT:1> ) . url , '<STR_LIT>' . format ( self . url ) ) <EOL> @ mock . patch ( '<STR_LIT>' , mock . mock_open ( ) , create = True ) <EOL> def test_attachment_download ( self ) : <EOL> response = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> response [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> self . response . json . return_value = response <EOL> self . response . iter_content = lambda chunk_size : ( str ( num ) for num in range ( <NUM_LIT:0> , <NUM_LIT:5> ) ) <EOL> self . assertEqual ( self . redmine . attachment . get ( <NUM_LIT:1> ) . download ( '<STR_LIT>' ) , '<STR_LIT>' ) <EOL> def test_wiki_page_version ( self ) : <EOL> self . assertEqual ( self . redmine . wiki_page . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_wiki_page_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> wiki_page = self . redmine . wiki_page . get ( '<STR_LIT>' , project_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( wiki_page . title , '<STR_LIT>' ) <EOL> def test_wiki_page_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> wiki_pages = self . redmine . wiki_page . filter ( project_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( wiki_pages [ <NUM_LIT:0> ] . title , '<STR_LIT>' ) <EOL> self . assertEqual ( wiki_pages [ <NUM_LIT:1> ] . title , '<STR_LIT>' ) <EOL> def test_wiki_page_create ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> wiki_page = self . redmine . wiki_page . create ( project_id = '<STR_LIT:foo>' , title = '<STR_LIT>' ) <EOL> self . assertEqual ( wiki_page . title , '<STR_LIT>' ) <EOL> def test_wiki_page_delete ( self ) : <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( self . redmine . wiki_page . delete ( '<STR_LIT>' , project_id = <NUM_LIT:1> ) , True ) <EOL> def test_wiki_page_update ( self ) : <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT:title>' : '<STR_LIT>' , '<STR_LIT:version>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' } } <EOL> wiki_page = self . redmine . wiki_page . get ( '<STR_LIT>' , project_id = <NUM_LIT:1> ) <EOL> wiki_page . text = '<STR_LIT>' <EOL> self . assertEqual ( wiki_page . save ( ) , True ) <EOL> self . assertEqual ( wiki_page . version , <NUM_LIT:2> ) <EOL> def test_wiki_page_refresh_by_title ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> wiki_page = self . redmine . wiki_page . get ( '<STR_LIT>' , project_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( wiki_page . title , '<STR_LIT>' ) <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT:title>' : '<STR_LIT>' } } <EOL> wiki_page = wiki_page . refresh ( ) <EOL> self . assertEqual ( wiki_page . title , '<STR_LIT>' ) <EOL> def test_wiki_page_refreshes_itself_if_text_attribute_not_exists ( self ) : <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT:title>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' } } <EOL> wiki_page = self . redmine . wiki_page . get ( '<STR_LIT>' , project_id = <NUM_LIT:1> ) <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT:title>' : '<STR_LIT>' , '<STR_LIT:text>' : '<STR_LIT:foo>' } } <EOL> self . assertEqual ( wiki_page . text , '<STR_LIT:foo>' ) <EOL> def test_wiki_page_supports_internal_id ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . wiki_page . get ( '<STR_LIT>' , project_id = <NUM_LIT:1> ) . internal_id , '<STR_LIT>' ) <EOL> def test_wiki_page_custom_int ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( int ( self . redmine . wiki_page . get ( '<STR_LIT>' , project_id = <NUM_LIT:1> ) ) , <NUM_LIT:1> ) <EOL> def test_wiki_page_custom_str ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( str ( self . redmine . wiki_page . get ( '<STR_LIT>' , project_id = <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_wiki_page_custom_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( self . redmine . wiki_page . get ( '<STR_LIT>' , project_id = <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_wiki_page_includes ( self ) : <EOL> response_includes = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> wiki_page = self . redmine . wiki_page . get ( '<STR_LIT>' , project_id = <NUM_LIT:1> ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( wiki_page . attachments , ResourceSet ) <EOL> def test_wiki_page_is_new ( self ) : <EOL> wiki_page = self . redmine . wiki_page . new ( ) <EOL> self . assertEqual ( int ( wiki_page ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( str ( wiki_page ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( wiki_page ) , '<STR_LIT>' ) <EOL> def test_wiki_page_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( <EOL> self . redmine . wiki_page . get ( '<STR_LIT>' , project_id = '<STR_LIT>' ) . url , <EOL> '<STR_LIT>' . format ( self . url ) <EOL> ) <EOL> def test_wiki_page_parent_converts_to_resource ( self ) : <EOL> from redmine . resources import WikiPage <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT:title>' : '<STR_LIT>' , '<STR_LIT>' : <NUM_LIT:1> , '<STR_LIT>' : { '<STR_LIT:title>' : '<STR_LIT>' } } } <EOL> parent = self . redmine . wiki_page . get ( '<STR_LIT>' , project_id = <NUM_LIT:1> ) . parent <EOL> self . assertIsInstance ( parent , WikiPage ) <EOL> self . assertEqual ( parent . title , '<STR_LIT>' ) <EOL> def test_project_membership_version ( self ) : <EOL> self . assertEqual ( self . redmine . project_membership . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_project_membership_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> membership = self . redmine . project_membership . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( membership . id , <NUM_LIT:1> ) <EOL> def test_project_membership_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> memberships = self . redmine . project_membership . filter ( project_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( memberships [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( memberships [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> def test_project_membership_create ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> membership = self . redmine . project_membership . create ( project_id = '<STR_LIT:foo>' , user_id = <NUM_LIT:1> , role_ids = [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> self . assertEqual ( membership . id , <NUM_LIT:1> ) <EOL> def test_project_membership_delete ( self ) : <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( self . redmine . project_membership . delete ( <NUM_LIT:1> ) , True ) <EOL> def test_project_membership_update ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> membership = self . redmine . project_membership . get ( <NUM_LIT:1> ) <EOL> membership . role_ids = [ <NUM_LIT:1> , <NUM_LIT:2> ] <EOL> self . assertEqual ( membership . save ( ) , True ) <EOL> self . assertEqual ( membership . roles [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( membership . roles [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> def test_project_membership_custom_str ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( str ( self . redmine . project_membership . get ( <NUM_LIT:1> ) ) , '<STR_LIT:1>' ) <EOL> def test_project_membership_custom_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( self . redmine . project_membership . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_project_membership_is_new ( self ) : <EOL> membership = self . redmine . project_membership . new ( ) <EOL> self . assertEqual ( int ( membership ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( str ( membership ) , '<STR_LIT:0>' ) <EOL> self . assertEqual ( repr ( membership ) , '<STR_LIT>' ) <EOL> def test_project_membership_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . project_membership . get ( <NUM_LIT:1> ) . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_issue_category_version ( self ) : <EOL> self . assertEqual ( self . redmine . issue_category . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_issue_category_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> issue_category = self . redmine . issue_category . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( issue_category . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( issue_category . name , '<STR_LIT>' ) <EOL> def test_issue_category_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> categories = self . redmine . issue_category . filter ( project_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( categories [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( categories [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( categories [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( categories [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_issue_category_create ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> category = self . redmine . issue_category . create ( project_id = '<STR_LIT:foo>' , name = '<STR_LIT>' ) <EOL> self . assertEqual ( category . name , '<STR_LIT>' ) <EOL> def test_issue_category_delete ( self ) : <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( self . redmine . issue_category . delete ( <NUM_LIT:1> ) , True ) <EOL> def test_issue_category_update ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> category = self . redmine . issue_category . get ( <NUM_LIT:1> ) <EOL> category . name = '<STR_LIT>' <EOL> self . assertEqual ( category . save ( ) , True ) <EOL> def test_issue_category_is_new ( self ) : <EOL> category = self . redmine . issue_category . new ( ) <EOL> self . assertEqual ( int ( category ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( str ( category ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( category ) , '<STR_LIT>' ) <EOL> def test_issue_category_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . issue_category . get ( <NUM_LIT:1> ) . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_issue_relation_version ( self ) : <EOL> self . assertEqual ( self . redmine . issue_relation . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_issue_relation_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> relation = self . redmine . issue_relation . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( relation . id , <NUM_LIT:1> ) <EOL> def test_issue_relation_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> relations = self . redmine . issue_relation . filter ( issue_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( relations [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( relations [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> def test_issue_relation_create ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> relation = self . redmine . issue_relation . create ( issue_id = <NUM_LIT:1> , issue_to_id = <NUM_LIT:2> ) <EOL> self . assertEqual ( relation . id , <NUM_LIT:1> ) <EOL> def test_issue_relation_delete ( self ) : <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( self . redmine . issue_relation . delete ( <NUM_LIT:1> ) , True ) <EOL> def test_issue_relation_custom_str ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( str ( self . redmine . issue_relation . get ( <NUM_LIT:1> ) ) , '<STR_LIT:1>' ) <EOL> def test_issue_relation_custom_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( self . redmine . issue_relation . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_issue_relation_is_new ( self ) : <EOL> relation = self . redmine . issue_relation . new ( ) <EOL> self . assertEqual ( int ( relation ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( str ( relation ) , '<STR_LIT:0>' ) <EOL> self . assertEqual ( repr ( relation ) , '<STR_LIT>' ) <EOL> def test_issue_relation_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . issue_relation . get ( <NUM_LIT:1> ) . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_version_version ( self ) : <EOL> self . assertEqual ( self . redmine . version . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_version_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT:version>' ] [ '<STR_LIT>' ] <EOL> version = self . redmine . version . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( version . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( version . name , '<STR_LIT>' ) <EOL> def test_version_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT:version>' ] [ '<STR_LIT>' ] <EOL> versions = self . redmine . version . filter ( project_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( versions [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( versions [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( versions [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( versions [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_version_create ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT:version>' ] [ '<STR_LIT>' ] <EOL> version = self . redmine . version . create ( project_id = '<STR_LIT:foo>' , name = '<STR_LIT>' ) <EOL> self . assertEqual ( version . name , '<STR_LIT>' ) <EOL> def test_version_delete ( self ) : <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( self . redmine . version . delete ( <NUM_LIT:1> ) , True ) <EOL> def test_version_update ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT:version>' ] [ '<STR_LIT>' ] <EOL> version = self . redmine . version . get ( <NUM_LIT:1> ) <EOL> version . name = '<STR_LIT>' <EOL> self . assertEqual ( version . save ( ) , True ) <EOL> def test_version_returns_status_without_conversion ( self ) : <EOL> self . response . json . return_value = { '<STR_LIT:version>' : { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:status>' : '<STR_LIT:foo>' } } <EOL> version = self . redmine . version . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( version . status , '<STR_LIT:foo>' ) <EOL> def test_version_is_new ( self ) : <EOL> version = self . redmine . version . new ( ) <EOL> self . assertEqual ( int ( version ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( str ( version ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( version ) , '<STR_LIT>' ) <EOL> def test_version_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT:version>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . version . get ( <NUM_LIT:1> ) . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_user_version ( self ) : <EOL> self . assertEqual ( self . redmine . user . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_user_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT:user>' ] [ '<STR_LIT>' ] <EOL> user = self . redmine . user . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( user . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( user . firstname , '<STR_LIT>' ) <EOL> def test_user_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT:user>' ] [ '<STR_LIT:all>' ] <EOL> users = self . redmine . user . all ( ) <EOL> self . assertEqual ( users [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( users [ <NUM_LIT:0> ] . firstname , '<STR_LIT>' ) <EOL> self . assertEqual ( users [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( users [ <NUM_LIT:1> ] . firstname , '<STR_LIT>' ) <EOL> def test_user_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT:user>' ] [ '<STR_LIT>' ] <EOL> users = self . redmine . user . filter ( status_id = <NUM_LIT:2> ) <EOL> self . assertEqual ( users [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( users [ <NUM_LIT:0> ] . firstname , '<STR_LIT>' ) <EOL> self . assertEqual ( users [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( users [ <NUM_LIT:1> ] . firstname , '<STR_LIT>' ) <EOL> def test_user_create ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT:user>' ] [ '<STR_LIT>' ] <EOL> user = self . redmine . user . create ( firstname = '<STR_LIT>' , lastname = '<STR_LIT>' ) <EOL> self . assertEqual ( user . firstname , '<STR_LIT>' ) <EOL> self . assertEqual ( user . lastname , '<STR_LIT>' ) <EOL> def test_user_delete ( self ) : <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( self . redmine . user . delete ( <NUM_LIT:1> ) , True ) <EOL> def test_user_update ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT:user>' ] [ '<STR_LIT>' ] <EOL> user = self . redmine . user . get ( <NUM_LIT:1> ) <EOL> user . lastname = '<STR_LIT>' <EOL> user . firstname = '<STR_LIT>' <EOL> self . assertEqual ( user . save ( ) , True ) <EOL> def test_user_custom_str ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT:user>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( str ( self . redmine . user . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_user_custom_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT:user>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( self . redmine . user . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_user_relations ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT:user>' ] [ '<STR_LIT>' ] <EOL> user = self . redmine . user . get ( <NUM_LIT:1> ) <EOL> self . assertIsInstance ( user . issues , ResourceSet ) <EOL> self . assertIsInstance ( user . time_entries , ResourceSet ) <EOL> self . assertIsInstance ( user . contacts , ResourceSet ) <EOL> self . assertIsInstance ( user . deals , ResourceSet ) <EOL> def test_user_includes ( self ) : <EOL> response_includes = responses [ '<STR_LIT:user>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> user = self . redmine . user . get ( <NUM_LIT:1> ) <EOL> response_includes [ '<STR_LIT:user>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( user . memberships , ResourceSet ) <EOL> response_includes [ '<STR_LIT:user>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( user . groups , ResourceSet ) <EOL> def test_user_returns_status_without_conversion ( self ) : <EOL> self . response . json . return_value = { '<STR_LIT:user>' : { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:status>' : <NUM_LIT:1> } } <EOL> user = self . redmine . user . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( user . status , <NUM_LIT:1> ) <EOL> def test_user_is_new ( self ) : <EOL> user = self . redmine . user . new ( ) <EOL> self . assertEqual ( int ( user ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( str ( user ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( user ) , '<STR_LIT>' ) <EOL> def test_user_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT:user>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . user . get ( <NUM_LIT:1> ) . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_group_version ( self ) : <EOL> self . assertEqual ( self . redmine . group . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_group_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> group = self . redmine . group . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( group . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( group . name , '<STR_LIT>' ) <EOL> def test_group_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> groups = self . redmine . group . all ( ) <EOL> self . assertEqual ( groups [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( groups [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( groups [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( groups [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_group_create ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> group = self . redmine . group . create ( name = '<STR_LIT>' ) <EOL> self . assertEqual ( group . name , '<STR_LIT>' ) <EOL> def test_group_delete ( self ) : <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( self . redmine . group . delete ( <NUM_LIT:1> ) , True ) <EOL> def test_group_update ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> group = self . redmine . group . get ( <NUM_LIT:1> ) <EOL> group . name = '<STR_LIT>' <EOL> self . assertEqual ( group . save ( ) , True ) <EOL> def test_group_includes ( self ) : <EOL> response_includes = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> group = self . redmine . group . get ( <NUM_LIT:1> ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( group . memberships , ResourceSet ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT:user>' ] [ '<STR_LIT:all>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( group . users , ResourceSet ) <EOL> def test_group_add_user ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> group = self . redmine . group . get ( <NUM_LIT:1> ) <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( group . user . add ( <NUM_LIT:1> ) , True ) <EOL> def test_group_remove_user ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> group = self . redmine . group . get ( <NUM_LIT:1> ) <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( group . user . remove ( <NUM_LIT:1> ) , True ) <EOL> def test_group_is_new ( self ) : <EOL> group = self . redmine . group . new ( ) <EOL> self . assertEqual ( int ( group ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( str ( group ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( group ) , '<STR_LIT>' ) <EOL> def test_group_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . group . get ( <NUM_LIT:1> ) . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_role_version ( self ) : <EOL> self . assertEqual ( self . redmine . role . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_role_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> role = self . redmine . role . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( role . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( role . name , '<STR_LIT>' ) <EOL> def test_role_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> roles = self . redmine . role . all ( ) <EOL> self . assertEqual ( roles [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( roles [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( roles [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( roles [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_role_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . role . get ( <NUM_LIT:1> ) . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_news_version ( self ) : <EOL> self . assertEqual ( self . redmine . news . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_news_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> news = self . redmine . news . all ( ) <EOL> self . assertEqual ( news [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( news [ <NUM_LIT:0> ] . title , '<STR_LIT>' ) <EOL> self . assertEqual ( news [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( news [ <NUM_LIT:1> ] . title , '<STR_LIT>' ) <EOL> def test_news_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> news = self . redmine . news . filter ( project_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( news [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( news [ <NUM_LIT:0> ] . title , '<STR_LIT>' ) <EOL> self . assertEqual ( news [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( news [ <NUM_LIT:1> ] . title , '<STR_LIT>' ) <EOL> def test_news_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( self . redmine . news . filter ( project_id = <NUM_LIT:1> ) [ <NUM_LIT:0> ] . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_news_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( self . redmine . news . filter ( project_id = <NUM_LIT:1> ) [ <NUM_LIT:0> ] ) , '<STR_LIT>' ) <EOL> def test_issue_status_version ( self ) : <EOL> self . assertEqual ( self . redmine . issue_status . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_issue_status_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> statuses = self . redmine . issue_status . all ( ) <EOL> self . assertEqual ( statuses [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( statuses [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( statuses [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( statuses [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_issue_status_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> self . assertEqual ( self . redmine . issue_status . all ( ) [ <NUM_LIT:0> ] . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_tracker_version ( self ) : <EOL> self . assertEqual ( self . redmine . tracker . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_tracker_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> trackers = self . redmine . tracker . all ( ) <EOL> self . assertEqual ( trackers [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( trackers [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( trackers [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( trackers [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_tracker_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> self . assertEqual ( self . redmine . tracker . all ( ) [ <NUM_LIT:0> ] . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_query_version ( self ) : <EOL> self . assertEqual ( self . redmine . query . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_query_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> queries = self . redmine . query . all ( ) <EOL> self . assertEqual ( queries [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( queries [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( queries [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( queries [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_query_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> self . assertEqual ( self . redmine . query . all ( ) [ <NUM_LIT:0> ] . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_custom_field_version ( self ) : <EOL> self . assertEqual ( self . redmine . custom_field . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_custom_field_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> fields = self . redmine . custom_field . all ( ) <EOL> self . assertEqual ( fields [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( fields [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( fields [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( fields [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_custom_field_return_value_even_if_there_is_none ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> fields = self . redmine . custom_field . all ( ) <EOL> self . assertEqual ( fields [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( fields [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( fields [ <NUM_LIT:0> ] . value , '<STR_LIT>' ) <EOL> def test_custom_field_returns_single_tracker_instead_of_multiple_trackers ( self ) : <EOL> self . response . json . return_value = { <EOL> '<STR_LIT>' : [ { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : { '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:name>' : '<STR_LIT>' } } } ] } <EOL> fields = self . redmine . custom_field . all ( ) <EOL> self . assertEqual ( fields [ <NUM_LIT:0> ] . trackers [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( fields [ <NUM_LIT:0> ] . trackers [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> def test_custom_field_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> self . assertEqual ( self . redmine . custom_field . all ( ) [ <NUM_LIT:0> ] . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_contact_tag_version ( self ) : <EOL> self . assertEqual ( self . redmine . contact_tag . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_contact_tag_requirements ( self ) : <EOL> self . assertEqual ( self . redmine . contact_tag . resource_class . requirements , ( ( '<STR_LIT>' , '<STR_LIT>' ) , ) ) <EOL> def test_contact_tag_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> tags = self . redmine . contact_tag . all ( ) <EOL> self . assertEqual ( tags [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( tags [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( tags [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( tags [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_contact_tag_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> self . assertEqual ( self . redmine . contact_tag . all ( ) [ <NUM_LIT:0> ] . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_deal_status_version ( self ) : <EOL> self . assertEqual ( self . redmine . deal_status . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_deal_status_requirements ( self ) : <EOL> self . assertEqual ( self . redmine . deal_status . resource_class . requirements , ( ( '<STR_LIT>' , '<STR_LIT>' ) , ) ) <EOL> def test_deal_status_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> statuses = self . redmine . deal_status . all ( ) <EOL> self . assertEqual ( statuses [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( statuses [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( statuses [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( statuses [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_deal_status_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> self . assertEqual ( self . redmine . deal_status . all ( ) [ <NUM_LIT:0> ] . url , '<STR_LIT>' . format ( self . url ) ) <EOL> def test_deal_category_version ( self ) : <EOL> self . assertEqual ( self . redmine . deal_category . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_deal_category_requirements ( self ) : <EOL> self . assertEqual ( self . redmine . deal_category . resource_class . requirements , ( ( '<STR_LIT>' , '<STR_LIT>' ) , ) ) <EOL> def test_deal_category_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> categories = self . redmine . deal_category . filter ( project_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( categories [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( categories [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( categories [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( categories [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_deal_category_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( <EOL> self . redmine . deal_category . filter ( project_id = <NUM_LIT:1> ) [ <NUM_LIT:0> ] . url , <EOL> '<STR_LIT>' . format ( self . url ) <EOL> ) <EOL> def test_crm_query_version ( self ) : <EOL> self . assertEqual ( self . redmine . crm_query . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_crm_query_requirements ( self ) : <EOL> self . assertEqual ( self . redmine . crm_query . resource_class . requirements , ( ( '<STR_LIT>' , '<STR_LIT>' ) , ) ) <EOL> def test_crm_query_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> queries = self . redmine . crm_query . filter ( resource = '<STR_LIT>' ) <EOL> self . assertEqual ( queries [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( queries [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( queries [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( queries [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_crm_query_url ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( <EOL> self . redmine . crm_query . filter ( resource = '<STR_LIT>' ) [ <NUM_LIT:0> ] . url , <EOL> '<STR_LIT>' . format ( self . url ) <EOL> ) <EOL> def test_note_version ( self ) : <EOL> self . assertEqual ( self . redmine . note . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_note_requirements ( self ) : <EOL> self . assertEqual ( self . redmine . note . resource_class . requirements , ( ( '<STR_LIT>' , '<STR_LIT>' ) , ) ) <EOL> def test_note_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> note = self . redmine . note . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( note . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( note . content , '<STR_LIT>' ) <EOL> def test_note_source_to_resource_conversion ( self ) : <EOL> from redmine . resources import Contact <EOL> self . response . json . return_value = { <EOL> '<STR_LIT>' : { '<STR_LIT:content>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:source>' : { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:type>' : '<STR_LIT>' } } } <EOL> note = self . redmine . note . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( note . source . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( note . source . name , '<STR_LIT>' ) <EOL> self . assertIsInstance ( note . source , Contact ) <EOL> def test_note_custom_str ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( str ( self . redmine . note . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_note_custom_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( self . redmine . note . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_contact_version ( self ) : <EOL> self . assertEqual ( self . redmine . contact . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_contact_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> contact = self . redmine . contact . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( contact . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( contact . first_name , '<STR_LIT>' ) <EOL> def test_contact_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> contacts = self . redmine . contact . all ( ) <EOL> self . assertEqual ( contacts [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( contacts [ <NUM_LIT:0> ] . first_name , '<STR_LIT>' ) <EOL> self . assertEqual ( contacts [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( contacts [ <NUM_LIT:1> ] . first_name , '<STR_LIT>' ) <EOL> def test_contact_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> contacts = self . redmine . contact . filter ( project_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( contacts [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( contacts [ <NUM_LIT:0> ] . first_name , '<STR_LIT>' ) <EOL> self . assertEqual ( contacts [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( contacts [ <NUM_LIT:1> ] . first_name , '<STR_LIT>' ) <EOL> def test_contact_create ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> contact = self . redmine . contact . create ( project_id = '<STR_LIT:bar>' , first_name = '<STR_LIT>' ) <EOL> self . assertEqual ( contact . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( contact . first_name , '<STR_LIT>' ) <EOL> def test_contact_delete ( self ) : <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( self . redmine . contact . delete ( <NUM_LIT:1> ) , True ) <EOL> def test_contact_update ( self ) : <EOL> self . response . json . return_value = { <EOL> '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : [ { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:value>' : '<STR_LIT:foo>' } ] } } <EOL> contact = self . redmine . contact . get ( <NUM_LIT:1> ) <EOL> contact . custom_fields = [ { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:value>' : '<STR_LIT:bar>' } ] <EOL> self . assertEqual ( contact . save ( ) , True ) <EOL> self . assertEqual ( contact . custom_fields [ <NUM_LIT:0> ] . value , '<STR_LIT:bar>' ) <EOL> def test_contact_includes ( self ) : <EOL> response_includes = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> contact = self . redmine . contact . get ( <NUM_LIT:1> ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( contact . notes , ResourceSet ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( contact . contacts , ResourceSet ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( contact . deals , ResourceSet ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( contact . issues , ResourceSet ) <EOL> def test_contact_add_project_raises_exception_if_wrong_version ( self ) : <EOL> from redmine . exceptions import ResourceVersionMismatchError <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . redmine . ver = '<STR_LIT>' <EOL> contact = self . redmine . contact . get ( <NUM_LIT:1> ) <EOL> self . assertRaises ( ResourceVersionMismatchError , lambda : contact . project . add ( <NUM_LIT:1> ) ) <EOL> def test_contact_add_project ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> contact = self . redmine . contact . get ( <NUM_LIT:1> ) <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( contact . project . add ( <NUM_LIT:1> ) , True ) <EOL> def test_contact_add_project_raises_exceptions_if_bad_project_requested ( self ) : <EOL> from redmine . exceptions import ValidationError <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> contact = self . redmine . contact . get ( <NUM_LIT:1> ) <EOL> self . response . status_code = <NUM_LIT> <EOL> self . assertRaises ( ValidationError , lambda : contact . project . add ( <NUM_LIT:1> ) ) <EOL> self . response . status_code = <NUM_LIT> <EOL> self . assertRaises ( ValidationError , lambda : contact . project . add ( <NUM_LIT:1> ) ) <EOL> def test_contact_remove_project ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> contact = self . redmine . contact . get ( <NUM_LIT:1> ) <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( contact . project . remove ( <NUM_LIT:1> ) , True ) <EOL> def test_contact_remove_project_raises_exception_if_bad_project_requested ( self ) : <EOL> from redmine . exceptions import ValidationError <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> contact = self . redmine . contact . get ( <NUM_LIT:1> ) <EOL> self . response . status_code = <NUM_LIT> <EOL> self . assertRaises ( ValidationError , lambda : contact . project . remove ( <NUM_LIT:1> ) ) <EOL> self . response . status_code = <NUM_LIT> <EOL> self . assertRaises ( ValidationError , lambda : contact . project . remove ( <NUM_LIT:1> ) ) <EOL> def test_contact_phones_returns_as_list_of_items ( self ) : <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT>' : '<STR_LIT>' } , { '<STR_LIT>' : '<STR_LIT>' } ] } } <EOL> self . assertEqual ( self . redmine . contact . get ( <NUM_LIT:1> ) . phones , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] } } <EOL> self . assertEqual ( self . redmine . contact . get ( <NUM_LIT:1> ) . phones , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def test_contact_emails_returns_as_list_of_items ( self ) : <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT>' : [ { '<STR_LIT:address>' : '<STR_LIT:foo>' } , { '<STR_LIT:address>' : '<STR_LIT:bar>' } ] } } <EOL> self . assertEqual ( self . redmine . contact . get ( <NUM_LIT:1> ) . emails , [ '<STR_LIT:foo>' , '<STR_LIT:bar>' ] ) <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT>' : [ '<STR_LIT:foo>' , '<STR_LIT:bar>' ] } } <EOL> self . assertEqual ( self . redmine . contact . get ( <NUM_LIT:1> ) . emails , [ '<STR_LIT:foo>' , '<STR_LIT:bar>' ] ) <EOL> def test_contact_avatar_converts_to_resource ( self ) : <EOL> from redmine . resources import Attachment <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : { '<STR_LIT>' : <NUM_LIT:2> } } } <EOL> avatar = self . redmine . contact . get ( <NUM_LIT:1> ) . avatar <EOL> self . assertIsInstance ( avatar , Attachment ) <EOL> self . assertEqual ( avatar . id , <NUM_LIT:2> ) <EOL> def test_contact_sets_phones_emails_taglist_via_setattr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> contact = self . redmine . contact . get ( <NUM_LIT:1> ) <EOL> contact . phones = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> contact . emails = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> contact . tag_list = [ '<STR_LIT:foo>' , '<STR_LIT:bar>' ] <EOL> self . assertEqual ( contact . _changes [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( contact . _changes [ '<STR_LIT:email>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( contact . _changes [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> def test_contact_custom_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( self . redmine . contact . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_contact_with_lastname_custom_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> contact = self . redmine . contact . get ( <NUM_LIT:1> ) <EOL> contact [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> self . assertEqual ( repr ( contact ) , '<STR_LIT>' ) <EOL> def test_contact_custom_str ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( str ( self . redmine . contact . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_contact_with_lastname_custom_str ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> contact = self . redmine . contact . get ( <NUM_LIT:1> ) <EOL> contact [ '<STR_LIT>' ] [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> self . assertEqual ( str ( contact ) , '<STR_LIT>' ) <EOL> def test_deal_version ( self ) : <EOL> self . assertEqual ( self . redmine . deal . resource_class . redmine_version , '<STR_LIT>' ) <EOL> def test_deal_get ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> deal = self . redmine . deal . get ( <NUM_LIT:1> ) <EOL> self . assertEqual ( deal . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( deal . name , '<STR_LIT>' ) <EOL> def test_deal_all ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT:all>' ] <EOL> deals = self . redmine . deal . all ( ) <EOL> self . assertEqual ( deals [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( deals [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( deals [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( deals [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_deal_filter ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> deals = self . redmine . deal . filter ( project_id = <NUM_LIT:1> ) <EOL> self . assertEqual ( deals [ <NUM_LIT:0> ] . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( deals [ <NUM_LIT:0> ] . name , '<STR_LIT>' ) <EOL> self . assertEqual ( deals [ <NUM_LIT:1> ] . id , <NUM_LIT:2> ) <EOL> self . assertEqual ( deals [ <NUM_LIT:1> ] . name , '<STR_LIT>' ) <EOL> def test_deal_create ( self ) : <EOL> self . response . status_code = <NUM_LIT> <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> deal = self . redmine . deal . create ( project_id = '<STR_LIT:bar>' , name = '<STR_LIT>' ) <EOL> self . assertEqual ( deal . id , <NUM_LIT:1> ) <EOL> self . assertEqual ( deal . name , '<STR_LIT>' ) <EOL> def test_deal_delete ( self ) : <EOL> self . response . content = '<STR_LIT>' <EOL> self . assertEqual ( self . redmine . deal . delete ( <NUM_LIT:1> ) , True ) <EOL> def test_deal_update ( self ) : <EOL> self . response . json . return_value = { <EOL> '<STR_LIT>' : { '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : [ { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:value>' : '<STR_LIT:foo>' } ] } } <EOL> deal = self . redmine . deal . get ( <NUM_LIT:1> ) <EOL> deal . custom_fields = [ { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT:value>' : '<STR_LIT:bar>' } ] <EOL> self . assertEqual ( deal . save ( ) , True ) <EOL> self . assertEqual ( deal . custom_fields [ <NUM_LIT:0> ] . value , '<STR_LIT:bar>' ) <EOL> def test_deal_includes ( self ) : <EOL> response_includes = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> deal = self . redmine . deal . get ( <NUM_LIT:1> ) <EOL> response_includes [ '<STR_LIT>' ] [ '<STR_LIT>' ] = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . response . json . return_value = response_includes <EOL> self . assertIsInstance ( deal . notes , ResourceSet ) <EOL> def test_deal_category_status_converts_to_resource ( self ) : <EOL> from redmine . resources import DealCategory , DealStatus <EOL> self . response . json . return_value = { '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : { '<STR_LIT:id>' : <NUM_LIT:2> } , '<STR_LIT:status>' : { '<STR_LIT:id>' : <NUM_LIT:3> } } } <EOL> deal = self . redmine . deal . get ( <NUM_LIT:1> ) <EOL> self . assertIsInstance ( deal . category , DealCategory ) <EOL> self . assertEqual ( deal . category . id , <NUM_LIT:2> ) <EOL> self . assertIsInstance ( deal . status , DealStatus ) <EOL> self . assertEqual ( deal . status . id , <NUM_LIT:3> ) <EOL> def test_deal_custom_repr ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( repr ( self . redmine . deal . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_deal_custom_repr_without_name ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> deal = self . redmine . deal . get ( <NUM_LIT:1> ) <EOL> del deal [ '<STR_LIT>' ] [ '<STR_LIT:name>' ] <EOL> self . assertEqual ( repr ( deal ) , '<STR_LIT>' ) <EOL> def test_deal_custom_str ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> self . assertEqual ( str ( self . redmine . deal . get ( <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> def test_deal_custom_str_without_name ( self ) : <EOL> self . response . json . return_value = responses [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> deal = self . redmine . deal . get ( <NUM_LIT:1> ) <EOL> del deal [ '<STR_LIT>' ] [ '<STR_LIT:name>' ] <EOL> self . assertEqual ( str ( deal ) , '<STR_LIT:1>' ) </s>
