diff --git a/doc/_build/doctrees/environment.pickle b/doc/_build/doctrees/environment.pickle index 902b715..8b32899 100644 --- a/doc/_build/doctrees/environment.pickle +++ b/doc/_build/doctrees/environment.pickle Binary files differ diff --git a/doc/_build/doctrees/using.doctree b/doc/_build/doctrees/using.doctree index 779daaa..91190d6 100644 --- a/doc/_build/doctrees/using.doctree +++ b/doc/_build/doctrees/using.doctree Binary files differ diff --git a/doc/_build/html/searchindex.js b/doc/_build/html/searchindex.js index 96aa2a1..bd398b8 100644 --- a/doc/_build/html/searchindex.js +++ b/doc/_build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({objects:{tests:{tests:[4,0,0]}},terms:{all:[4,1,2],code:[4,1],prefil:4,four:4,kati:4,runserv:1,dirnam:1,follow:[4,1],decid:1,under:3,introduc:1,merchant:3,everi:[4,1],string:4,far:[4,1],offlin:1,util:4,context_processor:1,mechan:4,exact:4,special:[4,1,3],contenttyp:1,administr:4,level:1,did:4,button:4,list:[4,2],"try":4,item:[],adjust:1,quick:1,setup:[4,1],dir:1,pleas:[4,1,3],modelbackend:1,impli:3,httpresponseredirect:4,cfg:[],seper:1,past:1,second:1,download:1,further:4,compat:1,index:4,what:4,appear:[4,1],sum:[],abl:1,current:[4,3],delet:[4,2],version:[1,3],franziska:3,"new":4,net:1,"public":3,gener:3,remeb:1,here:[4,1,3],modif:1,ubuntu:1,path:1,along:3,modifi:[4,1,3],sinc:4,valu:1,search:0,vertifi:1,anymor:1,jame:4,doctest:4,action:4,chang:[4,1,2],mailman_media:1,contactpag:2,via:4,appli:1,app:[0,1,4],sponser:2,foundat:3,api:[0,1],sponsel:3,instal:[0,1],middlewar:[1,2],from:[4,1,2],would:1,commun:1,doubl:4,perm:4,next:1,websit:[1,3],few:[4,1],call:[4,1],recommend:1,type:4,web_host:4,mailman_django:[0,1],abspath:1,ital:[],site:[0,1,4],trail:1,berlio:3,stick:1,particular:3,hold:1,unpack:1,account:4,join:1,prepar:1,work:[4,1],dev:4,itself:1,can:[4,1,2,3],purpos:3,tar:1,sudo:1,templat:1,topic:4,want:[4,1],contribut:[0,3],cours:1,end:[4,1],georg:4,how:4,instead:[4,1],config:1,css:1,updat:1,resourc:[0,4],after:[4,1],usabl:4,befor:[4,1],wrong:4,authentif:[4,1],data:1,postfix:1,bind:1,bootstrap:1,django:[0,1,4],inform:[4,3],allow:[4,1],fallback:1,egg:1,listnam:4,help:4,style:1,directli:4,fit:3,better:1,requir:[4,1],onc:[4,1],mail:4,hidden:1,main:[],might:1,guarente:1,split:1,them:[4,1],"return":4,thei:4,python:[4,1],auth:[4,1],mention:1,now:[4,1],term:3,benst:1,somewher:1,name:[4,1],anyth:2,edit:4,simpl:1,separ:4,easili:1,each:4,debug:[4,1],found:[4,3],went:4,mailman_test_bindir:1,domain:[4,2],replac:[],idea:[0,2],realli:[4,1],redistribut:3,"static":[],connect:1,our:[4,1,3],todo:[4,2],dependeci:1,space:[],miss:[0,2],develop:[0,1,2,4],publish:3,api_us:[4,1],content:[0,1,4],rest_serv:1,got:[4,1],correct:4,earlier:1,free:[4,1,2,3],cooki:4,reason:1,base:1,mailmanweb:[],lists_of_domain:1,put:1,org:3,"40mail":4,launch:1,could:[4,1,3],membership:4,keep:1,thing:[4,1],place:[4,1],root_urlconf:1,requireti:[],view:[4,1],first:[4,1],softwar:3,rang:[],render:1,feel:[4,1,2],media_root:1,natti:1,alreadi:1,done:[4,1],least:4,stabl:[4,1],installed_app:1,open:4,gpl:[0,3],differ:1,rrze:[0,3],hardcopi:1,licens:[0,3],system:[4,1],messag:[4,1],licenc:3,fullfil:1,"final":4,shell:[4,1],option:[4,1,3],real_nam:4,copi:[1,3],specifi:4,gsoc:1,part:[1,3],mm_membership:4,priveledg:1,serv:1,enjoi:4,provid:[4,2],new_domain:4,project:[1,3],were:1,posit:4,fqdn_listnam:4,pre:4,ani:[1,3],packag:1,have:[4,1,3],tabl:1,need:[4,1],element:1,florian:1,destroi:1,client:[0,1,4],note:[4,1],without:3,indic:4,singl:4,even:3,sure:[4,1],distribut:3,shall:4,usernam:[4,1],object:4,plan:1,letter:4,watt:4,"class":[4,1],icon:[0,3],don:1,bzr:1,url:[4,1],doc:4,later:[4,1,3],hardcod:4,temporili:4,doe:4,pars:4,usual:1,came:4,show:2,text:[4,3],liza:4,session:[4,1],permiss:[4,1],fine:1,eas:1,redirect:4,absolut:1,onli:[4,1],launchpad:1,copyright:3,explain:[0,4],configur:1,should:[4,1,3],new_list1:4,suppos:1,hope:3,media_url:1,nearli:1,get:[4,1],"__file__":1,stop:4,csrf:1,subscript:4,restart:1,template_dir:1,common:3,restadmin:1,where:1,summari:4,set:[0,1,3,4],see:[4,1,3],domain_admin:4,result:1,respons:4,fail:[4,1],awar:[4,1],statu:4,mailman3a7:1,databas:4,someth:4,between:[4,1],"import":4,awai:1,email:4,realnam:4,correclti:1,advertis:4,subfold:1,addit:[4,3],both:[4,1],last:4,plugin:1,admin:[4,1],howev:1,instanc:4,context:1,delete_list:4,logout:4,login:[4,1],com:[4,1],load:4,simpli:[1,2],point:1,instanti:4,address:[4,1],header:[],non:1,linux:4,backend:[4,1],mailman:[0,1,3,4],coupl:[4,1],"0a7":1,been:4,compon:1,much:1,unsubscrib:4,subscrib:[4,2],upcom:1,xxx:2,togeth:[4,1],i18n:1,ngeorg:4,those:1,"case":[4,1],creativecommon:3,therefor:4,gnu:3,align:1,abov:[0,4],mail_host:4,everyon:1,authentication_backend:1,new_list:4,list_own:4,archiv:4,revis:1,decor:1,let:4,welcom:0,author:4,receiv:3,media:1,make:[4,1],same:[4,1],handl:1,html:[1,3],gui:4,document:[0,4],finish:4,http:[4,1,3],moment:1,http_host:4,user:[4,1,2],implement:[4,2],expand:4,appropri:1,framework:4,api_pass:[4,1],well:[4,1],membership_set:4,exampl:[4,1],command:1,thi:[4,1,3],english:4,everyth:[4,1],latest:1,just:1,rest:[0,1,2,4],mailman3:[0,1,2,4],webui:1,restbackend:1,languag:4,easi:1,project_path:1,list_summari:4,add:[4,1],lawrenc:1,save:4,modul:[4,1],bin:1,applic:[0,1],which:[4,1,2],unter:[0,3],know:1,gsoc_mailman:1,press:4,password:[4,1],mailmanwebgsoc2011:1,like:[1,2],template_context_processor:1,success:4,restpass:1,server:[0,1,2],href:4,setup_mm:4,either:[4,3],page:[0,1,4],www:[1,3],right:[4,1],acknowledg:[0,2],creation:4,some:[4,1],home:1,successfulli:1,buildout:1,djangoproject:[4,1],confirm:4,woun:1,thank:3,select:4,slash:1,testobject:4,localhost:[4,1],refer:4,machin:4,core:1,run:[0,1,4],bold:[],symlink:1,step:1,repositori:1,post:4,mm_new_domain:4,stage:4,about:[1,3],central:4,usa:4,mass_subscrib:4,acl:[0,2,4],act:4,fals:4,processor:1,block:4,own:[4,1],addus:4,status_cod:4,within:[4,1],warranti:3,creativ:3,empti:4,contrib:1,your:[4,1,3],manag:[4,1],log:4,"40exampl":4,execut:4,print:4,"long":1,custom:1,avail:[4,1],start:[4,1],includ:[4,1],suit:4,systers_django:[],"function":[0,1,2,4],head:4,form:4,descrip:1,link:1,translat:4,teardown_mm:4,line:4,"true":4,succe:4,made:[4,1],render_mailman_them:1,possibl:1,"default":1,access:[0,1,4],displai:4,below:4,memebership:4,otherwis:1,more:[4,3],extend_ajax:1,proud:2,creat:[4,1,3],request:4,dure:1,exist:[4,1],file:[1,3],syncdb:1,check:[4,1],inc:3,again:1,titl:[],when:1,detail:3,gettext:4,other:[4,1],futur:1,branch:1,test:[0,1,2,4],you:[4,1,2,3],why:4,consid:1,bullet:[],directori:[4,1],descript:4,mailman_them:1,mass:4,time:[1,2],escap:4},objtypes:{"0":"py:module"},titles:["Welcome to mailman_django’s documentation!","Installation","Acknowledgements","Contributions:","Using the Django App - Developers Resource"],objnames:{"0":"Python module"},filenames:["index","setup","acknowledgements","license","using"]}) \ No newline at end of file +Search.setIndex({objects:{tests:{tests:[4,0,0]}},terms:{all:[4,1,2],code:[4,1],prefil:4,four:4,kati:4,runserv:1,dirnam:1,follow:[4,1],decid:[4,1],under:3,introduc:1,merchant:3,everi:1,string:4,far:[4,1],offlin:1,util:4,context_processor:1,mechan:4,exact:4,special:[4,1,3],contenttyp:1,administr:4,level:1,did:4,button:4,list:[4,2],"try":4,item:[],adjust:1,httpredirectobject:4,quick:1,setup:[4,1],dir:1,pleas:[4,1,3],modelbackend:1,impli:3,httpresponseredirect:4,cfg:[],seper:[4,1],past:1,second:1,download:1,further:[],compat:1,index:4,what:4,appear:[4,1],sum:[],abl:1,current:[4,3],delet:[4,2],version:[1,3],franziska:3,"new":4,net:1,"public":3,gener:3,remeb:1,here:[4,1,3],themself:4,ubuntu:1,path:1,along:3,modifi:[4,1,3],sinc:[],valu:[4,1],search:0,vertifi:1,anymor:1,jame:4,doctest:4,action:4,chang:[4,1,2],mailman_media:1,contactpag:2,via:[],appli:1,app:[0,1,4],sponser:2,foundat:3,api:[0,1],sponsel:3,instal:[0,1,4],middlewar:[4,1,2],from:[4,1,2],describ:4,would:1,commun:1,doubl:4,perm:[],next:[4,1],websit:[1,3],few:[4,1],call:[4,1],recommend:1,type:4,web_host:4,mailman_django:[0,1],abspath:1,ital:[],site:[0,1,4],trail:1,berlio:3,stick:1,particular:3,hold:1,unpack:1,easiest:4,account:4,join:1,prepar:1,work:[4,1],dev:4,itself:1,can:[4,1,2,3],purpos:3,login_requir:4,tar:1,sudo:1,templat:1,topic:4,want:[4,1],contribut:[0,3],cours:1,end:[4,1],faulti:4,georg:4,write:4,how:[],instead:[4,1],config:1,css:1,updat:1,resourc:[0,4],after:[4,1],usabl:[],befor:[4,1],wrong:4,authentif:[4,1],data:1,postfix:1,bind:1,bootstrap:1,django:[0,1,4],inform:[4,3],allow:[4,1],fallback:1,automaticli:4,egg:1,order:4,listnam:4,help:[],becaus:4,style:1,directli:4,fit:3,better:1,requir:[4,1],onc:[4,1],mail:4,hidden:1,main:[],might:1,guarente:1,split:1,them:1,"return":4,thei:4,python:[4,1],auth:[4,1],unfortuneatli:4,mention:1,front:4,now:[4,1],term:3,benst:1,somewher:1,name:[4,1],anyth:2,edit:4,simpl:[4,1],authent:4,separ:4,easili:1,each:4,debug:[4,1],found:3,went:4,mailman_test_bindir:1,domain:[4,2],replac:[],idea:[0,2],procedur:4,realli:[4,1],redistribut:3,"static":[],connect:[4,1],our:[4,1,3],todo:[4,2],dependeci:1,logout:4,space:[],miss:[0,2],develop:[0,1,2,4],publish:3,api_us:[4,1],content:[0,1,4],rest_serv:1,got:[4,1],correct:4,earlier:1,free:[4,1,2,3],cooki:[],reason:[4,1],base:1,mailmanweb:[],lists_of_domain:1,put:1,org:3,"40mail":4,launch:1,could:[1,3],membership:4,keep:1,thing:[4,1],place:[4,1],root_urlconf:1,requireti:[],summari:4,first:[4,1],softwar:3,rang:[],render:1,feel:[4,1,2],media_root:1,natti:1,restrict:4,instruct:4,alreadi:[4,1],done:[4,1],least:4,stabl:[4,1],installed_app:1,open:4,gpl:[0,3],differ:1,rrze:[0,3],hardcopi:1,licens:[0,3],system:1,messag:[4,1],licenc:3,fullfil:1,"final":4,store:4,shell:[4,1],option:[4,1,3],real_nam:4,copi:[1,3],specifi:[],gsoc:1,part:[4,1,3],mm_membership:4,priveledg:1,serv:1,enjoi:4,provid:[4,2],new_domain:4,project:[1,3],were:1,posit:4,fqdn_listnam:4,pre:4,ani:[1,3],packag:1,have:[4,1,3],tabl:1,need:[4,1],element:1,florian:1,destroi:1,client:[0,1,4],note:[4,1],without:[4,3],take:4,indic:4,singl:4,even:3,sure:[4,1],distribut:3,shall:4,usernam:[4,1],object:4,plan:[4,1],letter:4,watt:4,"class":[4,1],icon:[0,3],don:1,bzr:1,url:[4,1],doc:4,later:[4,1,3],hardcod:4,temporili:4,doe:4,pars:4,left:4,came:4,show:2,text:[4,3],liza:4,session:[4,1],permiss:[4,1],corner:4,fine:1,eas:1,redirect:4,absolut:1,onli:[4,1],locat:4,launchpad:1,copyright:3,explain:[0,4],configur:1,should:[4,1,3],new_list1:4,suppos:1,hope:3,media_url:1,nearli:1,get:[4,1],"__file__":1,stop:4,csrf:1,subscript:4,restart:1,template_dir:1,whether:4,common:3,restadmin:1,where:1,view:[4,1],set:[0,1,3,4],see:[4,1,3],domain_admin:4,result:1,respons:4,fail:[4,1],wonder:4,awar:[4,1],statu:4,mailman3a7:1,databas:4,someth:4,between:[4,1],"import":4,awai:1,email:4,realnam:4,correclti:1,advertis:4,subfold:1,addit:[4,3],both:[4,1],last:4,plugin:1,admin:1,howev:1,instanc:4,context:[4,1],delete_list:4,modif:1,login:[4,1],com:[4,1],load:4,simpli:[4,1,2],point:1,instanti:[],address:[4,1],header:[],non:1,linux:4,backend:[4,1],mailman:[0,1,3,4],coupl:1,"0a7":1,been:4,compon:1,much:1,unsubscrib:4,subscrib:[4,2],upcom:1,xxx:2,togeth:[4,1],i18n:1,ngeorg:4,those:1,"case":[4,1],creativecommon:3,therefor:4,look:4,gnu:3,align:1,abov:[0,4],mail_host:4,everyon:1,authentication_backend:1,new_list:4,list_own:4,archiv:4,revis:1,decor:[4,1],let:4,welcom:0,author:[],receiv:3,media:1,make:[4,1],same:[4,1],handl:[4,1],html:[1,3],gui:4,document:[0,4],finish:4,http:[4,1,3],upon:4,moment:[4,1],http_host:4,user:[4,1,2],implement:[4,2],expand:4,appropri:1,framework:[],api_pass:[4,1],usual:1,well:[4,1],membership_set:4,exampl:[4,1],command:1,thi:[4,1,3],english:4,everyth:[4,1],latest:1,just:1,rest:[0,1,2,4],mailman3:[0,1,2,4],webui:[4,1],restbackend:[4,1],languag:4,easi:1,project_path:1,had:4,list_summari:4,add:[4,1],lawrenc:1,save:[],modul:[4,1],bin:1,applic:[0,1],which:[4,1,2],unter:[0,3],know:1,gsoc_mailman:1,press:4,password:[4,1],mailmanwebgsoc2011:1,like:[1,2],template_context_processor:1,success:4,restpass:1,server:[0,1,2],href:4,setup_mm:4,either:[4,3],page:[0,1,4],www:[1,3],right:[4,1],acknowledg:[0,2,4],creation:4,some:[4,1],home:1,successfulli:1,buildout:1,djangoproject:[4,1],confirm:4,woun:1,thank:3,select:4,slash:1,testobject:4,localhost:[4,1],refer:4,machin:4,core:1,run:[0,1,4],bold:[],symlink:1,step:1,repositori:1,post:4,mm_new_domain:4,stage:[],about:[1,3],central:[],usa:4,mass_subscrib:4,acl:[0,2,4],act:4,fals:4,processor:1,block:4,own:[4,1],addus:4,status_cod:4,within:[4,1],warranti:3,creativ:3,empti:4,contrib:1,your:[4,1,3],manag:[4,1],log:4,wai:4,"40exampl":4,execut:4,print:4,"long":1,custom:1,avail:[4,1],start:[4,1],includ:[4,1],suit:4,systers_django:[],"function":[0,1,2,4],head:4,form:4,descrip:1,link:[4,1],translat:4,teardown_mm:4,line:4,"true":4,succe:4,made:[4,1],render_mailman_them:1,possibl:1,"default":1,access:[0,1,4],displai:4,below:4,memebership:4,otherwis:1,more:[4,3],extend_ajax:1,proud:2,creat:[4,1,3],request:4,dure:1,exist:[4,1],file:[4,1,3],syncdb:1,check:[4,1],inc:3,again:[4,1],titl:[],when:1,detail:3,gettext:4,other:[4,1],futur:1,branch:1,test:[0,1,2,4],you:[4,1,2,3],why:4,consid:1,stai:4,bullet:[],directori:[4,1],bottom:4,descript:4,mailman_them:1,mass:4,time:[1,2],escap:4},objtypes:{"0":"py:module"},titles:["Welcome to mailman_django’s documentation!","Installation","Acknowledgements","Contributions:","Using the Django App - Developers Resource"],objnames:{"0":"Python module"},filenames:["index","setup","acknowledgements","license","using"]}) \ No newline at end of file diff --git a/doc/_build/html/using.html b/doc/_build/html/using.html index 06e376a..24b8d05 100644 --- a/doc/_build/html/using.html +++ b/doc/_build/html/using.html @@ -81,6 +81,11 @@ +
Import HTTPRedirectObject to check whether a response redirects
+
>>> from django.http import HttpResponseRedirect
+
+
+
@@ -89,60 +94,63 @@

Getting Started

-

To start the test, import the django test client.

+

Starting the test module we do use a special Django Test Client which needs to be imported first.

>>> from django.test.client import Client
+>>> c = Client()
 
-

Then instantiate a test client.

-
>>> c = Client()
-
-
-

Go to the start page listing all lists.

-
>>> response = c.get('/',)
-
-
-

Make sure the load was a success by checking the status code.

-
>>> response.status_code
+

Once this is created we can try accessing our first Page and check that this was done successful

+
>>> response = c.get('/lists/',)
+>>> response.status_code
 200
 
-
-

Check that login is required for a couple of pages

-

Try to access some of the admin Pages. Accessing these pages -redirects to a login page since we need admin authority to view and use them -#TODO - ACL tests will be implemented for each site at a central place at later stages of development. -Please be aware that this test only checks for authentification ONCE.

+
+

Login Required

+

As described within the installation instructions we already started using authentification. The easiest way testing it is that we simply load a page which is restricted to some users only. +This was done using Django’s @login_required Decorator in front of the View. +One of the pages which requires a Login is the Domain Administration, if we can load the page without a redirect to the Login page, you’re either already logged in or something went wrong.

>>> response = c.get('/domains/')
-
-
-

Check that Http Redirect to the login is returned #TODO check url

-
>>> from django.http import HttpResponseRedirect
 >>> print type(response) == HttpResponseRedirect
 True
 
-
-

User + Login

-

For authentification we do need to setup a test user into the system. -This including the login will be with our own Auth Backend. Additional information on how to expand the Auth Backend with e.g. user perms could be found on a well documented Django Help page: -https://docs.djangoproject.com/en/dev/topics/auth/

+
+

Login of a User

+

We’ve decided to write our own Authentification Backend to use with Django. +This will handle all @login_required .authenticate() .login() requests.

+

As we do not have the Authenticating Part which connects Both Mailman and the WebUI we had to hardcode usernames and permissions into the file (auth/restbackend.py) +For more information what we’re planning to implement here take a look at the Acknowledgements.

+
+

Note

+

If you’re planning to expand this feel free to use this wonderful resource: +https://docs.djangoproject.com/en/dev/topics/auth/

+
+
+

Once the new middleware is in place we will need to create a user first. At the moment the user is automaticly created upon success of the login procedure.

>>> #c.... adduser() #TODO add user
 
-

Check our own login form, which should redirect the user to a usable page after every successful login -Login was successful if we get a return object to either the list index or a specified url ->>> response = c.post(‘/accounts/login/’, -... {“user”: “james@example.com“, -... “password”: “james”}) ->>> print type(response) == HttpResponseRedirect -True

-

Check user login directly via our own Auth Framework which will save the Login Cookie which is needed for further testing ->>> c.login(username='katie@example.com‘, password=’katie’) -True

- +

Users will have to use the Login form which is located at (/accounts/login/) in order to authenticate themself. The Login / Logout button is linked in the bottom left corner of each page as well.

+

After each successful login users should be redirected either to the site which they requested before - stored in a GET Value named next - or get the List index. Only if they’ve used a faulty login they should stay on the Login Page to try again.

+
>>> response = c.post('/accounts/login/',
+...                   {"user": "james@example.com",
+...                   "password": "james"})
+
+
+
>>> print type(response) == HttpResponseRedirect
+True
+
+
+

Unfortuneatly the Test Client requires to use the Login directly because it does handle each request seperately. For this reason we have to use the following part in the Tests only to authenticate a user. +Each successful Login will return True and write the users object into the request context, which allows simple checks whether there is a user logged in and what his name is.

+
>>> c.login(username='katie@example.com', password='katie')
+True
+
+

Permissions

@@ -494,8 +502,8 @@
  • Functionality and Test
    • Test Pre Requirements
    • Getting Started
    • -
    • Check that login is required for a couple of pages
    • -
    • User + Login
    • +
    • Login Required
    • +
    • Login of a User
    • Permissions
    • Create a New Domain
    • Create a New List
    • diff --git a/tests/tests.py b/tests/tests.py index d8162d4..ff81200 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -40,59 +40,66 @@ Import Translation Module to check success messages >>> from django.utils.translation import gettext as _ + + Import HTTPRedirectObject to check whether a response redirects + >>> from django.http import HttpResponseRedirect Getting Started =============== -To start the test, import the django test client. +Starting the test module we do use a special Django Test Client which needs to be imported first. >>> from django.test.client import Client - -Then instantiate a test client. - >>> c = Client() -Go to the start page listing all lists. +Once this is created we can try accessing our first Page and check that this was done successful - >>> response = c.get('/',) - -Make sure the load was a success by checking the status code. - + >>> response = c.get('/lists/',) >>> response.status_code 200 -Check that login is required for a couple of pages +Login Required ================================================== -Try to access some of the admin Pages. Accessing these pages -redirects to a login page since we need admin authority to view and use them -#TODO - ACL tests will be implemented for each site at a central place at later stages of development. -Please be aware that this test only checks for authentification ONCE. + +As described within the installation instructions we *already* started using authentification. The easiest way testing it is that we simply load a page which is restricted to some users only. +This was done using Django's @login_required Decorator in front of the View. +One of the pages which requires a Login is the Domain Administration, if we can load the page without a redirect to the Login page, you're either already logged in or something went wrong. >>> response = c.get('/domains/') - -Check that Http Redirect to the login is returned #TODO check url - - >>> from django.http import HttpResponseRedirect >>> print type(response) == HttpResponseRedirect True -User + Login -============ -For authentification we do need to setup a test user into the system. -This including the login will be with our own Auth Backend. Additional information on how to expand the Auth Backend with e.g. user perms could be found on a well documented Django Help page: -https://docs.djangoproject.com/en/dev/topics/auth/ +Login of a User +=============== + +We've decided to write our own Authentification Backend to use with Django. +This will handle all @login_required .authenticate() .login() requests. + +As we do not have the Authenticating Part which connects Both Mailman and the WebUI we had to hardcode usernames and permissions into the file (auth/restbackend.py) +For more information what we're planning to implement here take a look at the Acknowledgements. + + .. note:: + If you're planning to expand this feel free to use this wonderful resource: + https://docs.djangoproject.com/en/dev/topics/auth/ + +Once the new middleware is in place we will need to create a user first. At the moment the user is automaticly created upon success of the login procedure. >>> #c.... adduser() #TODO add user - Check our own login form, which should redirect the user to a usable page after every successful login - Login was successful if we get a return object to either the list index or a specified url +Users will have to use the Login form which is located at (/accounts/login/) in order to authenticate themself. The Login / Logout button is linked in the bottom left corner of each page as well. + +After each successful login users should be redirected either to the site which they requested before - stored in a GET Value named next - or get the List index. Only if they've used a faulty login they should stay on the Login Page to try again. + >>> response = c.post('/accounts/login/', ... {"user": "james@example.com", ... "password": "james"}) + >>> print type(response) == HttpResponseRedirect True - Check user login directly via our own Auth Framework which will save the Login Cookie which is needed for further testing +Unfortuneatly the Test Client requires to use the Login directly because it does handle each request seperately. For this reason we have to use the following part in the Tests only to authenticate a user. +Each successful Login will return True and write the users object into the request context, which allows simple checks whether there is a user logged in and what his name is. + >>> c.login(username='katie@example.com', password='katie') True