<s> """<STR_LIT>""" <EOL> from unittest import skip <EOL> from django . test import TestCase <EOL> from django . test . client import Client <EOL> from django . core . urlresolvers import reverse <EOL> from django . contrib . auth . models import User as DjangoUser <EOL> from treeio . core . models import Group , Perspective , ModuleSetting <EOL> from treeio . messaging . models import Message , MessageStream <EOL> from treeio . identities . models import Contact , ContactType <EOL> class MessagingModelsTest ( TestCase ) : <EOL> "<STR_LIT>" <EOL> username = "<STR_LIT:test>" <EOL> password = "<STR_LIT:password>" <EOL> def test_model_message ( self ) : <EOL> "<STR_LIT>" <EOL> contact_type = ContactType ( name = '<STR_LIT:test>' ) <EOL> contact_type . save ( ) <EOL> contact = Contact ( name = '<STR_LIT:test>' , contact_type = contact_type ) <EOL> contact . save ( ) <EOL> self . user = DjangoUser ( username = self . username , password = '<STR_LIT>' ) <EOL> self . user . set_password ( self . password ) <EOL> self . user . save ( ) <EOL> stream = MessageStream ( name = '<STR_LIT:test>' ) <EOL> stream . save ( ) <EOL> obj = Message ( title = '<STR_LIT:test>' , body = '<STR_LIT:test>' , author = contact , stream = stream ) <EOL> obj . save ( ) <EOL> self . assertEquals ( '<STR_LIT:test>' , obj . title ) <EOL> self . assertNotEquals ( obj . id , None ) <EOL> obj . delete ( ) <EOL> def test_model_message_stream ( self ) : <EOL> "<STR_LIT>" <EOL> obj = MessageStream ( name = '<STR_LIT:test>' ) <EOL> obj . save ( ) <EOL> self . assertEquals ( '<STR_LIT:test>' , obj . name ) <EOL> self . assertNotEquals ( obj . id , None ) <EOL> obj . delete ( ) <EOL> class MessagingViewsTest ( TestCase ) : <EOL> "<STR_LIT>" <EOL> username = "<STR_LIT:test>" <EOL> password = "<STR_LIT:password>" <EOL> prepared = False <EOL> def setUp ( self ) : <EOL> "<STR_LIT>" <EOL> if not self . prepared : <EOL> self . group , created = Group . objects . get_or_create ( name = '<STR_LIT:test>' ) <EOL> duser , created = DjangoUser . objects . get_or_create ( <EOL> username = self . username ) <EOL> duser . set_password ( self . password ) <EOL> duser . save ( ) <EOL> perspective , created = Perspective . objects . get_or_create ( <EOL> name = '<STR_LIT:default>' ) <EOL> perspective . set_default_user ( ) <EOL> perspective . save ( ) <EOL> ModuleSetting . set ( '<STR_LIT>' , perspective . id ) <EOL> self . contact_type = ContactType ( name = '<STR_LIT:test>' ) <EOL> self . contact_type . set_default_user ( ) <EOL> self . contact_type . save ( ) <EOL> self . contact = Contact ( name = '<STR_LIT:test>' , contact_type = self . contact_type ) <EOL> self . contact . set_default_user ( ) <EOL> self . contact . save ( ) <EOL> self . stream = MessageStream ( name = '<STR_LIT:test>' ) <EOL> self . stream . set_default_user ( ) <EOL> self . stream . save ( ) <EOL> self . message = Message ( <EOL> title = '<STR_LIT:test>' , body = '<STR_LIT:test>' , author = self . contact , stream = self . stream ) <EOL> self . message . set_default_user ( ) <EOL> self . message . save ( ) <EOL> self . client = Client ( ) <EOL> self . prepared = True <EOL> def test_message_index_login ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( response . status_code , <NUM_LIT:200> ) <EOL> def test_message_index_sent ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( response . status_code , <NUM_LIT:200> ) <EOL> def test_message_index_inbox ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( response . status_code , <NUM_LIT:200> ) <EOL> def test_message_index_unread ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( response . status_code , <NUM_LIT:200> ) <EOL> def test_message_compose_login ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> pass <EOL> def test_message_view_login ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . message . id ] ) ) <EOL> self . assertEquals ( response . status_code , <NUM_LIT:200> ) <EOL> def test_message_delete_login ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . message . id ] ) ) <EOL> self . assertEquals ( response . status_code , <NUM_LIT:200> ) <EOL> def test_stream_add ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . stream . id ] ) ) <EOL> self . assertEquals ( response . status_code , <NUM_LIT:200> ) <EOL> def test_stream_view ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . stream . id ] ) ) <EOL> self . assertEquals ( response . status_code , <NUM_LIT:200> ) <EOL> def test_stream_edit ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . stream . id ] ) ) <EOL> self . assertEquals ( response . status_code , <NUM_LIT:200> ) <EOL> def test_stream_delete ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . stream . id ] ) ) <EOL> self . assertEquals ( response . status_code , <NUM_LIT:200> ) <EOL> def test_messaging_settings_view ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( response . status_code , <NUM_LIT:200> ) <EOL> def test_finance_settings_edit ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . post ( '<STR_LIT>' , <EOL> { '<STR_LIT:username>' : self . username , '<STR_LIT:password>' : self . password } ) <EOL> self . assertRedirects ( response , '<STR_LIT:/>' ) <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertEquals ( response . status_code , <NUM_LIT:200> ) <EOL> def test_message_index_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) <EOL> def test_message_sent_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) <EOL> def test_message_inbox_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) <EOL> def test_message_unread_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) <EOL> def test_message_compose_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) <EOL> def test_message_view_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . message . id ] ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) <EOL> def test_message_delete_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . message . id ] ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) <EOL> def test_stream_add_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . stream . id ] ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) <EOL> def test_stream_view_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . stream . id ] ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) <EOL> def test_stream_edit_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . stream . id ] ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) <EOL> def test_stream_delete_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . stream . id ] ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) <EOL> def test_messaging_settings_view_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) <EOL> def test_finance_settings_edit_out ( self ) : <EOL> "<STR_LIT>" <EOL> response = self . client . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . assertRedirects ( response , reverse ( '<STR_LIT>' ) ) </s>
