<s> import os <EOL> from django . conf import settings <EOL> from django . contrib . auth import models <EOL> from django . contrib . auth . models import User , Group , Permission <EOL> from django . contrib . contenttypes . models import ContentType <EOL> from django . core import management <EOL> from django . core . urlresolvers import reverse <EOL> from django . db . models import get_model <EOL> from django . test import TestCase <EOL> from django . test . client import Client <EOL> from authority . models import Permission <EOL> from django_addons . autodiscover import autodiscover_notifications <EOL> from transifex . txcommon . tests . base import BaseTestCase , USER_ROLES , NoticeTypes <EOL> from transifex . txcommon . log import logger <EOL> from transifex . languages . models import Language <EOL> from transifex . projects . models import Project <EOL> from transifex . projects . permissions . project import ProjectPermission <EOL> from transifex . teams . models import Team <EOL> from django . utils import unittest <EOL> Watch = get_model ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> POFileLock = get_model ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def skip ( func ) : <EOL> func_name = func . __name__ <EOL> def decorator ( func ) : <EOL> msg = "<STR_LIT>" % func_name <EOL> if settings . TX_ROOT != settings . PROJECT_PATH : <EOL> logger . debug ( msg ) <EOL> return unittest . skipUnless ( settings . TX_ROOT == settings . PROJECT_PATH , msg ) <EOL> return decorator <EOL> class PrivateProjectTest ( BaseTestCase ) : <EOL> """<STR_LIT>""" <EOL> @ skip <EOL> def test_project_list_with_anonymous_user ( self ) : <EOL> """<STR_LIT>""" <EOL> response = self . client [ '<STR_LIT>' ] . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . failUnlessEqual ( len ( response . context [ '<STR_LIT>' ] ) , <EOL> Project . objects . filter ( private = False ) . count ( ) ) <EOL> for project in response . context [ '<STR_LIT>' ] : <EOL> self . failIfEqual ( project . slug , self . project_private . slug ) <EOL> response = self . client [ '<STR_LIT>' ] . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . failUnlessEqual ( len ( response . context [ '<STR_LIT>' ] ) , <EOL> Project . objects . filter ( private = False ) . count ( ) ) <EOL> self . failIfEqual ( response . context [ '<STR_LIT>' ] [ <NUM_LIT:0> ] . slug , self . project_private . slug ) <EOL> @ skip <EOL> def test_project_list_with_logged_in_user ( self ) : <EOL> """<STR_LIT>""" <EOL> response = self . client [ '<STR_LIT>' ] . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . failUnlessEqual ( len ( response . context [ '<STR_LIT>' ] ) , <EOL> Project . objects . filter ( private = False ) . count ( ) ) <EOL> for project in response . context [ '<STR_LIT>' ] : <EOL> self . failIfEqual ( project . slug , self . project_private . slug ) <EOL> response = self . client [ '<STR_LIT>' ] . get ( reverse ( '<STR_LIT>' ) ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . failUnlessEqual ( len ( response . context [ '<STR_LIT>' ] ) , <EOL> Project . objects . filter ( private = False ) . count ( ) ) <EOL> for project in response . context [ '<STR_LIT>' ] : <EOL> self . failIfEqual ( project . slug , self . project_private . slug ) <EOL> def test_project_detail ( self ) : <EOL> """<STR_LIT>""" <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> def test_resource_details ( self ) : <EOL> """<STR_LIT>""" <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( self . urls [ '<STR_LIT>' ] ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> def test_widgets ( self ) : <EOL> """<STR_LIT>""" <EOL> url = reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug } ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( url ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( url ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> def test_search_project ( self ) : <EOL> """<STR_LIT>""" <EOL> URL = reverse ( '<STR_LIT>' ) <EOL> TERMS_1_1 = { '<STR_LIT:q>' : self . project_private . slug } <EOL> TERMS_1_2 = { '<STR_LIT:q>' : self . resource_private . slug } <EOL> TERMS_1_3 = { '<STR_LIT:q>' : self . project_private . name } <EOL> for user in USER_ROLES : <EOL> response = self . client [ user ] . get ( URL , TERMS_1_1 ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . assertFalse ( self . project_private in response . context [ '<STR_LIT>' ] ) <EOL> response = self . client [ user ] . get ( URL , TERMS_1_2 ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . assertFalse ( self . project_private in response . context [ '<STR_LIT>' ] ) <EOL> response = self . client [ user ] . get ( URL , TERMS_1_3 ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> self . assertFalse ( self . project_private in response . context [ '<STR_LIT>' ] ) <EOL> def test_teams_access ( self ) : <EOL> """<STR_LIT>""" <EOL> URLs = { <EOL> '<STR_LIT>' : { <EOL> <NUM_LIT> : [ <EOL> '<STR_LIT>' % self . project_private . slug , <EOL> '<STR_LIT>' % ( self . project_private . slug , <EOL> self . language . code ) <EOL> ] , <EOL> <NUM_LIT> : [ <EOL> '<STR_LIT>' % self . project_private . slug , <EOL> '<STR_LIT>' % ( self . project_private . slug , <EOL> self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , <EOL> self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code , <EOL> self . user [ '<STR_LIT>' ] . username ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code , <EOL> self . user [ '<STR_LIT>' ] . username ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % self . project_private . slug , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> ] <EOL> } , <EOL> '<STR_LIT>' : { <EOL> <NUM_LIT> : [ <EOL> '<STR_LIT>' % self . project_private . slug , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % self . project_private . slug , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code , <EOL> self . user [ '<STR_LIT>' ] . username ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code , <EOL> self . user [ '<STR_LIT>' ] . username ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % self . project_private . slug , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) <EOL> ] <EOL> } , <EOL> '<STR_LIT>' : { <EOL> <NUM_LIT:200> : [ <EOL> '<STR_LIT>' % self . project_private . slug , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % self . project_private . slug , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) <EOL> ] , <EOL> <NUM_LIT> : [ <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % self . project_private . slug <EOL> ] , <EOL> <NUM_LIT> : [ <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code , <EOL> self . user [ '<STR_LIT>' ] . username ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code , <EOL> self . user [ '<STR_LIT>' ] . username ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) <EOL> ] , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> <NUM_LIT:200> : [ <EOL> '<STR_LIT>' % self . project_private . slug , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) <EOL> ] , <EOL> <NUM_LIT> : [ <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % self . project_private . slug <EOL> ] , <EOL> <NUM_LIT> : [ <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code , <EOL> self . user [ '<STR_LIT>' ] . username ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code , <EOL> self . user [ '<STR_LIT>' ] . username ) <EOL> ] , <EOL> <NUM_LIT> : [ <EOL> '<STR_LIT>' % self . project_private . slug , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) <EOL> ] <EOL> } , <EOL> '<STR_LIT>' : { <EOL> <NUM_LIT:200> : [ <EOL> '<STR_LIT>' % self . project_private . slug , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) <EOL> ] , <EOL> <NUM_LIT> : [ <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % self . project_private . slug <EOL> ] , <EOL> <NUM_LIT> : [ <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> ] , <EOL> <NUM_LIT> : [ <EOL> '<STR_LIT>' % self . project_private . slug , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code , <EOL> self . user [ '<STR_LIT>' ] . username ) , <EOL> '<STR_LIT>' % ( self . project_private . slug , self . language . code , <EOL> self . user [ '<STR_LIT>' ] . username ) <EOL> ] <EOL> } <EOL> } <EOL> for user in URLs . keys ( ) : <EOL> for status_code in URLs [ user ] . keys ( ) : <EOL> for url in URLs [ user ] [ status_code ] : <EOL> response = self . client [ user ] . get ( url ) <EOL> self . failUnlessEqual ( response . status_code , status_code , <EOL> "<STR_LIT>" % ( <EOL> user , url , response . status_code , status_code ) ) <EOL> def test_view_strings ( self ) : <EOL> """<STR_LIT>""" <EOL> URL = self . urls [ '<STR_LIT>' ] <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> URL = reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug , <EOL> '<STR_LIT>' : self . resource_private . slug , <EOL> '<STR_LIT>' : self . language_ar . code } ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> def test_edit_strings ( self ) : <EOL> """<STR_LIT>""" <EOL> URL = self . urls [ '<STR_LIT>' ] <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> URL = reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug , <EOL> '<STR_LIT>' : self . resource_private . slug , <EOL> '<STR_LIT>' : self . language_ar . code } ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> def test_download_file ( self ) : <EOL> """<STR_LIT>""" <EOL> URL = reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug , <EOL> '<STR_LIT>' : self . resource_private . slug , <EOL> '<STR_LIT>' : self . language . code } ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> URL = reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug , <EOL> '<STR_LIT>' : self . resource_private . slug , <EOL> '<STR_LIT>' : self . language_ar . code } ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> def test_lock_unlock_file ( self ) : <EOL> """<STR_LIT>""" <EOL> URL = reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug , <EOL> '<STR_LIT>' : self . resource_private . slug , <EOL> '<STR_LIT>' : self . language . code } ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL , follow = True ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL , follow = True ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL , follow = True ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> URL = reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug , <EOL> '<STR_LIT>' : self . resource_private . slug , <EOL> '<STR_LIT>' : self . language_ar . code } ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL , follow = True ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL , follow = True ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL , follow = True ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> def test_watch_unwatch_file ( self ) : <EOL> """<STR_LIT>""" <EOL> from notification . models import NoticeType <EOL> URL = reverse ( '<STR_LIT>' , <EOL> kwargs = { '<STR_LIT>' : self . project_private . slug , <EOL> '<STR_LIT>' : self . resource_private . slug , <EOL> '<STR_LIT>' : self . language . code } ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL , follow = True ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL , follow = True ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> URL = reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug , <EOL> '<STR_LIT>' : self . resource_private . slug , <EOL> '<STR_LIT>' : self . language_ar . code } ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL , follow = True ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL , follow = True ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> def test_watch_unwatch_project ( self ) : <EOL> """<STR_LIT>""" <EOL> from notification . models import NoticeType <EOL> URL = reverse ( '<STR_LIT>' , <EOL> kwargs = { '<STR_LIT>' : self . project_private . slug } ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL , follow = True ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . post ( URL , follow = True ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> def test_charts ( self ) : <EOL> """<STR_LIT>""" <EOL> URLs = [ <EOL> reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug , <EOL> '<STR_LIT>' : self . resource_private . slug } ) , <EOL> reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug , <EOL> '<STR_LIT>' : self . resource_private . slug } ) , <EOL> reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug , <EOL> '<STR_LIT>' : self . resource_private . slug } ) , <EOL> reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug , <EOL> '<STR_LIT>' : self . resource_private . slug } ) <EOL> ] <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> for url in URLs : <EOL> response = self . client [ user ] . get ( url ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> for url in URLs : <EOL> response = self . client [ user ] . get ( url ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> def test_timeline ( self ) : <EOL> """<STR_LIT>""" <EOL> URL = reverse ( '<STR_LIT>' , kwargs = { '<STR_LIT>' : self . project_private . slug , } ) <EOL> for user in [ '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT> ) <EOL> for user in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> response = self . client [ user ] . get ( URL ) <EOL> self . failUnlessEqual ( response . status_code , <NUM_LIT:200> ) <EOL> def test_public_to_private ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def test_private_to_public ( self ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class ProjectLookupsTests ( BaseTestCase ) : <EOL> def test_private_projects_ajax_lookup ( self ) : <EOL> """<STR_LIT>""" <EOL> public_project = "<STR_LIT>" <EOL> private_project = "<STR_LIT>" <EOL> self . assertTrue ( self . user [ '<STR_LIT>' ] not in self . project_private . maintainers . all ( ) ) <EOL> resp = self . client [ '<STR_LIT>' ] . get ( '<STR_LIT>' , { '<STR_LIT:q>' : '<STR_LIT:p>' , '<STR_LIT>' : '<STR_LIT>' , } ) <EOL> self . assertContains ( resp , public_project , status_code = <NUM_LIT:200> ) <EOL> self . assertNotContains ( resp , private_project , status_code = <NUM_LIT:200> ) <EOL> self . assertTrue ( self . user [ '<STR_LIT>' ] in self . project_private . maintainers . all ( ) ) <EOL> resp = self . client [ '<STR_LIT>' ] . get ( '<STR_LIT>' , { '<STR_LIT:q>' : '<STR_LIT:p>' , '<STR_LIT>' : '<STR_LIT>' , } ) <EOL> self . assertContains ( resp , public_project , status_code = <NUM_LIT:200> ) <EOL> self . assertContains ( resp , private_project , status_code = <NUM_LIT:200> ) <EOL> self . assertTrue ( self . user [ '<STR_LIT>' ] in self . team_private . members . all ( ) ) <EOL> self . assertFalse ( self . user [ '<STR_LIT>' ] in self . project_private . maintainers . all ( ) ) <EOL> resp = self . client [ '<STR_LIT>' ] . get ( '<STR_LIT>' , { '<STR_LIT:q>' : '<STR_LIT:p>' , '<STR_LIT>' : '<STR_LIT>' , } ) <EOL> self . assertContains ( resp , public_project , status_code = <NUM_LIT:200> ) <EOL> self . assertContains ( resp , private_project , status_code = <NUM_LIT:200> ) </s>
