<s> from django . conf import settings <EOL> from django . core . urlresolvers import reverse <EOL> from transifex . languages . models import Language <EOL> from transifex . resources . models import SourceEntity <EOL> from transifex . teams . models import Team <EOL> from transifex . txcommon . tests . base import BaseTestCase <EOL> class ResourcesTemplateTests ( BaseTestCase ) : <EOL> def test_create_resource_template_tag ( self ) : <EOL> """<STR_LIT>""" <EOL> resp = self . client [ '<STR_LIT>' ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertTemplateUsed ( resp , <EOL> '<STR_LIT>' ) <EOL> self . assertContains ( resp , <EOL> "<STR_LIT>" ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> resp = self . client [ user ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertNotContains ( resp , <EOL> "<STR_LIT>" ) <EOL> def test_priority_table_snippet ( self ) : <EOL> """<STR_LIT>""" <EOL> resp = self . client [ '<STR_LIT>' ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertTemplateUsed ( resp , '<STR_LIT>' ) <EOL> self . assertContains ( resp , <EOL> '<STR_LIT>' % <EOL> ( self . resource . slug , ) , <EOL> status_code = <NUM_LIT:200> ) <EOL> self . assertContains ( resp , <EOL> '<STR_LIT>' % <EOL> ( self . resource . priority . level , ) ) <EOL> self . assertContains ( resp , <EOL> '<STR_LIT>' % <EOL> ( settings . STATIC_URL , <EOL> self . resource . priority . display_level ) ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> resp = self . client [ user ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertNotContains ( resp , <EOL> '<STR_LIT>' % <EOL> ( self . resource . slug , ) , <EOL> status_code = <NUM_LIT:200> ) <EOL> def test_available_langs_per_resource ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( type ( self . resource . available_languages . count ( ) ) , int ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> resp = self . client [ user ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertContains ( <EOL> resp , "<STR_LIT>" % ( <EOL> self . resource . available_languages . count ( ) <EOL> ) ) <EOL> def test_total_strings_per_resource ( self ) : <EOL> """<STR_LIT>""" <EOL> self . resource . update_total_entities ( ) <EOL> self . assertEqual ( self . resource . total_entities , <EOL> SourceEntity . objects . filter ( <EOL> resource = self . resource ) . count ( ) ) <EOL> def test_javascript_snippet_cycle_priority ( self ) : <EOL> """<STR_LIT>""" <EOL> resp = self . client [ '<STR_LIT>' ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertTemplateUsed ( resp , '<STR_LIT>' ) <EOL> self . assertContains ( resp , <EOL> '<STR_LIT>' % <EOL> ( reverse ( '<STR_LIT>' , <EOL> args = [ self . project . slug , "<STR_LIT>" ] ) , ) , <EOL> status_code = <NUM_LIT:200> ) <EOL> self . assertContains ( resp , <EOL> '<STR_LIT>' ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> resp = self . client [ user ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertNotContains ( resp , <EOL> '<STR_LIT>' % <EOL> ( reverse ( '<STR_LIT>' , <EOL> args = [ self . project . slug , "<STR_LIT>" ] ) , ) , <EOL> status_code = <NUM_LIT:200> ) <EOL> self . assertNotContains ( resp , <EOL> '<STR_LIT>' ) <EOL> def test_translate_resource_button ( self ) : <EOL> """<STR_LIT>""" <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> resp = self . client [ user ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertTemplateUsed ( resp , '<STR_LIT>' ) <EOL> msg = '<STR_LIT>' <EOL> self . assertContains ( resp , msg , status_code = <NUM_LIT:200> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> resp = self . client [ user ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertNotContains ( resp , msg , status_code = <NUM_LIT:200> ) <EOL> def test_resource_edit_button ( self ) : <EOL> """<STR_LIT>""" <EOL> resp = self . client [ '<STR_LIT>' ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertTemplateUsed ( resp , '<STR_LIT>' ) <EOL> self . assertContains ( resp , '<STR_LIT>' , status_code = <NUM_LIT:200> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> resp = self . client [ user ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertNotContains ( resp , '<STR_LIT>' , status_code = <NUM_LIT:200> ) <EOL> def test_delete_translation_resource_button ( self ) : <EOL> """<STR_LIT>""" <EOL> resp = self . client [ '<STR_LIT>' ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertTemplateUsed ( resp , '<STR_LIT>' ) <EOL> self . assertContains ( resp , '<STR_LIT>' , status_code = <NUM_LIT:200> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> resp = self . client [ user ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertNotContains ( resp , '<STR_LIT>' , status_code = <NUM_LIT> ) <EOL> def test_disabled_visit_team_resource_actions ( self ) : <EOL> """<STR_LIT>""" <EOL> lang = Language . objects . by_code_or_alias ( '<STR_LIT>' ) <EOL> resp = self . client [ '<STR_LIT>' ] . get ( <EOL> reverse ( '<STR_LIT>' , args = [ self . resource . project . slug , <EOL> self . resource . slug , lang . code ] ) , <EOL> ) <EOL> self . assertEqual ( resp . status_code , <NUM_LIT> ) <EOL> def test_resource_details_team_and_zero_percent ( self ) : <EOL> """<STR_LIT>""" <EOL> self . project . team_set . filter ( language = self . language ) . delete ( ) <EOL> resp = self . client [ '<STR_LIT>' ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertContains ( resp , self . language_ar . name , status_code = <NUM_LIT:200> , <EOL> msg_prefix = "<STR_LIT>" ) <EOL> self . assertNotContains ( resp , '<STR_LIT>' ) <EOL> t = Team . objects . create ( language = self . language_ar , project = self . project , <EOL> creator = self . user [ '<STR_LIT>' ] ) <EOL> resp = self . client [ '<STR_LIT>' ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . assertContains ( resp , self . language_ar . name , status_code = <NUM_LIT:200> , <EOL> msg_prefix = "<STR_LIT>" ) <EOL> self . assertContains ( resp , '<STR_LIT>' <EOL> '<STR_LIT>' ) </s>
