allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [2/5] git commit: [#5909] Split Contacts and Availability to separate pages
Date Wed, 13 Mar 2013 20:21:14 GMT
[#5909] Split Contacts and Availability to separate pages


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8feb5419
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8feb5419
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8feb5419

Branch: refs/heads/master
Commit: 8feb54191dbfb25b879a608249c54daba20abcda
Parents: 0e7d7f6
Author: Simone Gatti <simone.gatti88@gmail.com>
Authored: Wed Mar 13 04:35:43 2013 +0000
Committer: Cory Johns <johnsca@geek.net>
Committed: Wed Mar 13 20:20:46 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/auth.py              |  214 ++++++++++---------
 Allura/allura/templates/user_availability.html |   74 +++++++
 Allura/allura/templates/user_contacts.html     |   55 +++++
 Allura/allura/templates/user_preferences.html  |  100 +--------
 Allura/allura/tests/functional/test_auth.py    |   44 ++--
 5 files changed, 274 insertions(+), 213 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8feb5419/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 8b0be12..462f449 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -366,9 +366,124 @@ class UserSkillsController(BaseController):
         flash('Your skills list was successfully updated!')
         redirect('/auth/prefs/user_skills')
 
+class UserContactsController(BaseController):
+
+    @expose('jinja:allura:templates/user_contacts.html')
+    def index(self, **kw):
+        require_authenticated()
+        return dict()
+
+    @expose()
+    @require_post()
+    @validate(F.add_socialnetwork_form, error_handler=index)
+    def add_social_network(self, **kw):
+        require_authenticated()
+        c.user.add_socialnetwork(kw['socialnetwork'], kw['accounturl'])
+        flash('Your personal contacts were successfully updated!')
+        redirect('.')
+
+    @expose()
+    @require_post()
+    @validate(F.remove_socialnetwork_form, error_handler=index)
+    def remove_social_network(self, **kw):
+        require_authenticated()
+        c.user.remove_socialnetwork(kw['socialnetwork'], kw['account'])
+        flash('Your personal contacts were successfully updated!')
+        redirect('.')
+
+    @expose()
+    @require_post()
+    @validate(F.add_telnumber_form, error_handler=index)
+    def add_telnumber(self, **kw):
+        require_authenticated()
+        c.user.add_telephonenumber(kw['newnumber'])
+        flash('Your personal contacts were successfully updated!')
+        redirect('.')
+
+    @expose()
+    @require_post()
+    @validate(F.remove_textvalue_form, error_handler=index)
+    def remove_telnumber(self, **kw):
+        require_authenticated()
+        c.user.remove_telephonenumber(kw['oldvalue'])
+        flash('Your personal contacts were successfully updated!')
+        redirect('.')
+
+    @expose()
+    @require_post()
+    @validate(F.add_website_form, error_handler=index)
+    def add_webpage(self, **kw):
+        require_authenticated()
+        c.user.add_webpage(kw['newwebsite'])
+        flash('Your personal contacts were successfully updated!')
+        redirect('.')
+
+    @expose()
+    @require_post()
+    @validate(F.remove_textvalue_form, error_handler=index)
+    def remove_webpage(self, **kw):
+        require_authenticated()
+        c.user.remove_webpage(kw['oldvalue'])
+        flash('Your personal contacts were successfully updated!')
+        redirect('.')
+
+    @expose()
+    @require_post()
+    @validate(F.skype_account_form, error_handler=index)
+    def skype_account(self, **kw):
+        require_authenticated()
+        c.user.set_pref('skypeaccount', kw['skypeaccount'])
+        flash('Your personal contacts were successfully updated!')
+        redirect('.')
+
+class UserAvailabilityController(BaseController):
+
+    @expose('jinja:allura:templates/user_availability.html')
+    def index(self, **kw):
+        require_authenticated()
+        return dict()
+
+    @expose()
+    @require_post()
+    @validate(F.add_timeslot_form, error_handler=index)
+    def add_timeslot(self, **kw):
+        require_authenticated()
+        c.user.add_timeslot(kw['weekday'], kw['starttime'], kw['endtime'])
+        flash('Your availability timeslots were successfully updated!')
+        redirect('.')
+
+    @expose()
+    @require_post()
+    @validate(F.remove_timeslot_form, error_handler=index)
+    def remove_timeslot(self, **kw):
+        require_authenticated()
+        c.user.remove_timeslot(kw['weekday'], kw['starttime'], kw['endtime'])
+        flash('Your availability timeslots were successfully updated!')
+        redirect('.')
+
+    @expose()
+    @require_post()
+    @validate(F.add_inactive_period_form, error_handler=index)
+    def add_inactive_period(self, **kw):
+        require_authenticated()
+        c.user.add_inactive_period(kw['startdate'], kw['enddate'])
+        flash('Your inactivity periods were successfully updated!')
+        redirect('.')
+
+    @expose()
+    @require_post()
+    @validate(F.remove_inactive_period_form, error_handler=index)
+    def remove_inactive_period(self, **kw):
+        require_authenticated()
+        c.user.remove_inactive_period(kw['startdate'], kw['enddate'])
+        flash('Your availability timeslots were successfully updated!')
+        redirect('.')
+
 class PreferencesController(BaseController):
 
     user_skills = UserSkillsController()
+    user_contacts = UserContactsController()
+    user_availability = UserAvailabilityController()
 
     @with_trailing_slash
     @expose('jinja:allura:templates/user_preferences.html')
@@ -558,105 +673,6 @@ class PreferencesController(BaseController):
 
     @expose()
     @require_post()
-    @validate(F.add_socialnetwork_form, error_handler=index)
-    def add_social_network(self, **kw):
-        require_authenticated()
-        c.user.add_socialnetwork(kw['socialnetwork'], kw['accounturl'])
-        flash('Your personal contacts were successfully updated!')
-        redirect('.#Contacts')
-
-    @expose()
-    @require_post()
-    @validate(F.remove_socialnetwork_form, error_handler=index)
-    def remove_social_network(self, **kw):
-        require_authenticated()
-        c.user.remove_socialnetwork(kw['socialnetwork'], kw['account'])
-        flash('Your personal contacts were successfully updated!')
-        redirect('.#Contacts')
-
-    @expose()
-    @require_post()
-    @validate(F.add_telnumber_form, error_handler=index)
-    def add_telnumber(self, **kw):
-        require_authenticated()
-        c.user.add_telephonenumber(kw['newnumber'])
-        flash('Your personal contacts were successfully updated!')
-        redirect('.#Contacts')
-
-    @expose()
-    @require_post()
-    @validate(F.remove_textvalue_form, error_handler=index)
-    def remove_telnumber(self, **kw):
-        require_authenticated()
-        c.user.remove_telephonenumber(kw['oldvalue'])
-        flash('Your personal contacts were successfully updated!')
-        redirect('.#Contacts')
-
-    @expose()
-    @require_post()
-    @validate(F.add_website_form, error_handler=index)
-    def add_webpage(self, **kw):
-        require_authenticated()
-        c.user.add_webpage(kw['newwebsite'])
-        flash('Your personal contacts were successfully updated!')
-        redirect('.#Contacts')
-
-    @expose()
-    @require_post()
-    @validate(F.remove_textvalue_form, error_handler=index)
-    def remove_webpage(self, **kw):
-        require_authenticated()
-        c.user.remove_webpage(kw['oldvalue'])
-        flash('Your personal contacts were successfully updated!')
-        redirect('.#Contacts')
-
-    @expose()
-    @require_post()
-    @validate(F.skype_account_form, error_handler=index)
-    def skype_account(self, **kw):
-        require_authenticated()
-        c.user.set_pref('skypeaccount', kw['skypeaccount'])
-        flash('Your personal contacts were successfully updated!')
-        redirect('.#Contacts')
-
-    @expose()
-    @require_post()
-    @validate(F.add_timeslot_form, error_handler=index)
-    def add_timeslot(self, **kw):
-        require_authenticated()
-        c.user.add_timeslot(kw['weekday'], kw['starttime'], kw['endtime'])
-        flash('Your availability timeslots were successfully updated!')
-        redirect('.#Availability')
-
-    @expose()
-    @require_post()
-    @validate(F.remove_timeslot_form, error_handler=index)
-    def remove_timeslot(self, **kw):
-        require_authenticated()
-        c.user.remove_timeslot(kw['weekday'], kw['starttime'], kw['endtime'])
-        flash('Your availability timeslots were successfully updated!')
-        redirect('.#Availability')
-
-    @expose()
-    @require_post()
-    @validate(F.add_inactive_period_form, error_handler=index)
-    def add_inactive_period(self, **kw):
-        require_authenticated()
-        c.user.add_inactive_period(kw['startdate'], kw['enddate'])
-        flash('Your inactivity periods were successfully updated!')
-        redirect('.#Availability')
-
-    @expose()
-    @require_post()
-    @validate(F.remove_inactive_period_form, error_handler=index)
-    def remove_inactive_period(self, **kw):
-        require_authenticated()
-        c.user.remove_inactive_period(kw['startdate'], kw['enddate'])
-        flash('Your availability timeslots were successfully updated!')
-        redirect('.#Availability')
-
-    @expose()
-    @require_post()
     def upload_sshkey(self, key=None):
         ap = plugin.AuthenticationProvider.get(request)
         try:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8feb5419/Allura/allura/templates/user_availability.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_availability.html b/Allura/allura/templates/user_availability.html
new file mode 100644
index 0000000..d7f46b7
--- /dev/null
+++ b/Allura/allura/templates/user_availability.html
@@ -0,0 +1,74 @@
+{% set hide_left_bar = True %}
+{% extends g.theme.master %}
+
+{% block title %}{{c.user.username}} / Availability{% endblock %}
+
+{% block header %}Availability timeslots of {{c.user.username}} {% endblock %}
+
+{% block content %}
+  <div class="grid-20">
+    <h2>Availability</h2>
+    <div class="grid-18">
+      Please, set your time intervals choosing a weekday and entering the time interval according
to the timezone specified in your personal data, using the format HH:MM. If you didn't set
any timezone, your timeslots could be meaningless to other users, therefore they will be ignored.
+    </div>
+    <div class="grid-18">
+      You can also specify periods of time during which you won't be able to work on the
forge, in orther to communicate other users
+      that they can't contact you during those days. Please, do it specifying date intervals
in format DD/MM/YYYY.
+    </div> 
+  </div>
+  <div class="grid-20">
+    {%if c.user.get_availability_timeslots() %}
+      <h3>Existing availability timeslots</h3>
+      <table>
+        <tr>
+          <thead>
+            <th>Weekday</th>
+            <th>Start time</th>
+            <th>End time</th>
+            <th>Actions</th>
+          </thead>
+        </tr>
+        {% for ts in c.user.get_availability_timeslots() %}
+          {{g.theme.remove_timeslot_form.display(
+                action="/auth/prefs/user_availability/remove_timeslot",
+                weekday=ts.week_day,
+                starttime=ts.start_time,
+                endtime=ts.end_time)}} 
+        {%endfor%}
+      </table>
+    {% endif %}
+    <h3>Add a new availability timeslot</h3>
+    {{g.theme.add_timeslot_form.display(action="/auth/prefs/user_availability/add_timeslot")}}
+  </div>
+
+  <div class="grid-20">
+    {%if c.user.get_inactive_periods() %}
+      <h3>Existing periods of inactivity on the forge</h3>
+      <table>
+        <tr>
+          <thead>
+            <th>Start date</th>
+            <th>End date</th>
+            <th>Actions</th>
+          </thead>
+        </tr>
+        {% for ip in c.user.get_inactive_periods() %}
+          {{g.theme.remove_inactive_period_form.display(
+                action="/auth/prefs/user_availability/remove_inactive_period",
+                startdate=ip.start_date,
+                enddate=ip.end_date)}} 
+        {%endfor%}
+      </table>
+    {% endif %}
+    <h3>Add a new period of inactivity on the forge</h3>
+    {{g.theme.add_inactive_period_form.display(action="/auth/prefs/user_availability/add_inactive_period")}}
+    <h3>Other possible actions</h3>
+    <div class="grid-20" style="margin-bottom:10px;"/>
+      <ul>
+        <li>
+          <a href="/auth/prefs">Go to you profile</a> to set the remaining personal
preferences.
+        </li>
+      </ul>
+    </div>
+  </div>
+{% endblock %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8feb5419/Allura/allura/templates/user_contacts.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_contacts.html b/Allura/allura/templates/user_contacts.html
new file mode 100644
index 0000000..d6d1811
--- /dev/null
+++ b/Allura/allura/templates/user_contacts.html
@@ -0,0 +1,55 @@
+{% set hide_left_bar = True %}
+{% extends g.theme.master %}
+
+{% block title %}{{c.user.username}} / Contacts{% endblock %}
+
+{% block header %}Contacts of {{c.user.username}} {% endblock %}
+
+{% block content %}
+  <div class="grid-20">
+    <h2>Personal Contacts</h2>
+    <h3>Skype account</h3>
+
+    {{g.theme.skype_account_form.display(action="/auth/prefs/user_contacts/skype_account",
+          initial_value=c.user.get_pref('skypeaccount'))}}
+     
+    {%if c.user.get_pref('socialnetworks') or c.user.get_pref('telnumbers') or c.user.get_pref('webpages')
%}
+      <h3>Other existing contacts</h3>
+        <table>
+          <tr>
+            <thead>
+              <th>Type</th>
+              <th>Contact</th>
+              <th>Actions</th>
+            </thead>
+          </tr>
+          {% for sn in c.user.get_pref('socialnetworks') %}
+             {{g.theme.remove_socialnetwork_form.display(action="/auth/prefs/user_contacts/remove_social_network",
account=sn.accounturl, socialnetwork=sn.socialnetwork)}} 
+          {% endfor %}
+
+          {% for tn in c.user.get_pref('telnumbers') %}
+              {{g.theme.remove_textvalue_form.display(action="/auth/prefs/user_contacts/remove_telnumber",
value=tn, label="Telephone number")}} 
+          {%endfor%}
+
+          {% for ws in c.user.get_pref('webpages') %}
+              {{g.theme.remove_textvalue_form.display(action="/auth/prefs/user_contacts/remove_webpage",
value=ws, label="Website url")}} 
+          {%endfor%}
+        </table>
+    {% endif %}
+
+    <h3>Add a social network account</h3>
+    {{g.theme.add_socialnetwork_form.display(action="/auth/prefs/user_contacts/add_social_network")}}
+    <h3>Add a telephone number</h3>
+    {{g.theme.add_telnumber_form.display(action="/auth/prefs/user_contacts/add_telnumber")}}
+    <h3>Add a personal website</h3>
+    {{g.theme.add_website_form.display(action="/auth/prefs/user_contacts/add_webpage")}}
+  <h3>Other possible actions</h3>
+    <div class="grid-20" style="margin-bottom:10px;"/>
+      <ul>
+        <li>
+          <a href="/auth/prefs">Go to you profile</a> to set the remaining personal
preferences.
+        </li>
+      </ul>
+    </div>
+  </div>
+{% endblock %}

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8feb5419/Allura/allura/templates/user_preferences.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/user_preferences.html b/Allura/allura/templates/user_preferences.html
index be4dfe6..4e1391e 100644
--- a/Allura/allura/templates/user_preferences.html
+++ b/Allura/allura/templates/user_preferences.html
@@ -25,103 +25,19 @@
   <div style="clear:both" class="grid-20">
     <a name="Contacts"></a>
     <h2>Personal Contacts</h2>
-    <h3>Skype account</h3>
-
-    {{g.theme.skype_account_form.display(action="/auth/prefs/skype_account",
-          initial_value=c.user.get_pref('skypeaccount'))}}
-     
-    {%if c.user.get_pref('socialnetworks') or c.user.get_pref('telnumbers') or c.user.get_pref('webpages')
%}
-      <h3>Other existing contacts</h3>
-        <table>
-          <tr>
-            <thead>
-              <th>Type</th>
-              <th>Contact</th>
-              <th>Actions</th>
-            </thead>
-          </tr>
-          {% for sn in c.user.get_pref('socialnetworks') %}
-             {{g.theme.remove_socialnetwork_form.display(account=sn.accounturl, socialnetwork=sn.socialnetwork)}}

-          {% endfor %}
-
-          {% for tn in c.user.get_pref('telnumbers') %}
-              {{g.theme.remove_textvalue_form.display(action="/auth/prefs/remove_telnumber",
value=tn, label="Telephone number")}} 
-          {%endfor%}
-
-          {% for ws in c.user.get_pref('webpages') %}
-              {{g.theme.remove_textvalue_form.display(action="/auth/prefs/remove_webpage",
value=ws, label="Website url")}} 
-          {%endfor%}
-        </table>
-    {% endif %}
-
-    <h3>Add a social network account</h3>
-    {{g.theme.add_socialnetwork_form.display(action="/auth/prefs/add_social_network")}}
-    <h3>Add a telephone number</h3>
-    {{g.theme.add_telnumber_form.display(action="/auth/prefs/add_telnumber")}}
-    <h3>Add a personal website</h3>
-    {{g.theme.add_website_form.display(action="/auth/prefs/add_webpage")}}
+    <p>
+      If you want, you can set your contacts allowing other members to contact you or you
can set your personal website allowing other members to introduce your self.
+    </p>
+    <ul><li><a href="/auth/prefs/user_contacts">Click here to check and
change your contacts</a></li></ul>
   </div>
 
   <a name="Availability"></a>
   <div style="clear:both" class="grid-20">
     <h2>Availability</h2>
-    <div class="grid-18">
-      If you want, you can set the weekly timeslot during which you are usually available
to support other users of the forge.
-      Please, set your time intervals choosing a weekday and entering the time interval according
to the timezone specified in your 
-      personal data, using the format HH:MM. If you didn't set any timezone, your timeslots
could be meaningless to other users, 
-      therefore they will be ignored.
-    </div>
-    <div class="grid-18">
-      You can also specify periods of time during which you won't be able to work on the
forge, in orther to communicate other users
-      that they can't contact you during those days. Please, do it specifying date intervals
in format DD/MM/YYYY.
-    </div> 
-  </div>
-  <div class="grid-20">
-    {%if c.user.get_availability_timeslots() %}
-      <h3>Existing availability timeslots</h3>
-      <table>
-        <tr>
-          <thead>
-            <th>Weekday</th>
-            <th>Start time</th>
-            <th>End time</th>
-            <th>Actions</th>
-          </thead>
-        </tr>
-        {% for ts in c.user.get_availability_timeslots() %}
-          {{g.theme.remove_timeslot_form.display(
-                action="/auth/prefs/remove_timeslot",
-                weekday=ts.week_day,
-                starttime=ts.start_time,
-                endtime=ts.end_time)}} 
-        {%endfor%}
-      </table>
-    {% endif %}
-    <h3>Add a new availability timeslot</h3>
-    {{g.theme.add_timeslot_form.display(action="/auth/prefs/add_timeslot")}}
-  </div>
-
-  <div class="grid-20">
-    {%if c.user.get_inactive_periods() %}
-      <h3>Existing periods of inactivity on the forge</h3>
-      <table>
-        <tr>
-          <thead>
-            <th>Start date</th>
-            <th>End date</th>
-            <th>Actions</th>
-          </thead>
-        </tr>
-        {% for ip in c.user.get_inactive_periods() %}
-          {{g.theme.remove_inactive_period_form.display(
-                action="/auth/prefs/remove_inactive_period",
-                startdate=ip.start_date,
-                enddate=ip.end_date)}} 
-        {%endfor%}
-      </table>
-    {% endif %}
-    <h3>Add a new period of inactivity on the forge</h3>
-    {{g.theme.add_inactive_period_form.display(action="/auth/prefs/add_inactive_period")}}
+    <p>
+      If you want, you can set the weekly timeslot during which you are usually available
to support other users of the forge. (If you didn't set any timezone, your timeslots could
be meaningless to other users, therefore they will be ignored!)
+    </p>
+    <ul><li><a href="/auth/prefs/user_availability">Click here to check
and change your availability slots</a></li></ul>
   </div>
 
   <div class="grid-20">

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8feb5419/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index d7b5f89..0b4bb1c 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -435,8 +435,8 @@ class TestPreferences(TestController):
     def test_contacts(self):
         #Add skype account
         testvalue = 'testaccount'
-        result = self.app.get('/auth/prefs')
-        r = self.app.post('/auth/prefs/skype_account',
+        result = self.app.get('/auth/prefs/user_contacts')
+        r = self.app.post('/auth/prefs/user_contacts/skype_account',
              params=dict(skypeaccount=testvalue))
         user = M.User.query.get(username='test-admin')
         assert user.skypeaccount == testvalue
@@ -444,7 +444,7 @@ class TestPreferences(TestController):
         #Add social network account
         socialnetwork = 'Facebook'
         accounturl = 'http://www.facebook.com/test'
-        r = self.app.post('/auth/prefs/add_social_network',
+        r = self.app.post('/auth/prefs/user_contacts/add_social_network',
              params=dict(socialnetwork=socialnetwork,
                          accounturl = accounturl))
         user = M.User.query.get(username='test-admin')
@@ -455,7 +455,7 @@ class TestPreferences(TestController):
         #Add second social network account
         socialnetwork2 = 'Twitter'
         accounturl2 = 'http://twitter.com/test'
-        r = self.app.post('/auth/prefs/add_social_network',
+        r = self.app.post('/auth/prefs/user_contacts/add_social_network',
              params=dict(socialnetwork=socialnetwork2,
                          accounturl = '@test'))
         user = M.User.query.get(username='test-admin')
@@ -464,7 +464,7 @@ class TestPreferences(TestController):
                 {'socialnetwork':socialnetwork2, 'accounturl':accounturl2} in user.socialnetworks)
 
         #Remove first social network account
-        r = self.app.post('/auth/prefs/remove_social_network',
+        r = self.app.post('/auth/prefs/user_contacts/remove_social_network',
              params=dict(socialnetwork=socialnetwork,
                          account = accounturl))
         user = M.User.query.get(username='test-admin')
@@ -472,7 +472,7 @@ class TestPreferences(TestController):
                {'socialnetwork':socialnetwork2, 'accounturl':accounturl2} in user.socialnetworks
 
         #Add invalid social network account
-        r = self.app.post('/auth/prefs/add_social_network',
+        r = self.app.post('/auth/prefs/user_contacts/add_social_network',
              params=dict(accounturl = accounturl, socialnetwork=''))
         user = M.User.query.get(username='test-admin')
         assert len(user.socialnetworks) == 1 and \
@@ -480,40 +480,40 @@ class TestPreferences(TestController):
 
         #Add telephone number
         telnumber = '+3902123456'
-        r = self.app.post('/auth/prefs/add_telnumber',
+        r = self.app.post('/auth/prefs/user_contacts/add_telnumber',
              params=dict(newnumber=telnumber))
         user = M.User.query.get(username='test-admin')
         assert (len(user.telnumbers) == 1 and (user.telnumbers[0] == telnumber))
 
         #Add second telephone number
         telnumber2 = '+3902654321'
-        r = self.app.post('/auth/prefs/add_telnumber',
+        r = self.app.post('/auth/prefs/user_contacts/add_telnumber',
              params=dict(newnumber=telnumber2))
         user = M.User.query.get(username='test-admin')
         assert (len(user.telnumbers) == 2 and telnumber in user.telnumbers and telnumber2
in user.telnumbers)
 
         #Remove first telephone number
-        r = self.app.post('/auth/prefs/remove_telnumber',
+        r = self.app.post('/auth/prefs/user_contacts/remove_telnumber',
              params=dict(oldvalue=telnumber))
         user = M.User.query.get(username='test-admin')
         assert (len(user.telnumbers) == 1 and telnumber2 in user.telnumbers)
 
         #Add website
         website = 'http://www.testurl.com'
-        r = self.app.post('/auth/prefs/add_webpage',
+        r = self.app.post('/auth/prefs/user_contacts/add_webpage',
              params=dict(newwebsite=website))
         user = M.User.query.get(username='test-admin')
         assert (len(user.webpages) == 1 and (website in user.webpages))
 
         #Add second website
         website2 = 'http://www.testurl2.com'
-        r = self.app.post('/auth/prefs/add_webpage',
+        r = self.app.post('/auth/prefs/user_contacts/add_webpage',
              params=dict(newwebsite=website2))
         user = M.User.query.get(username='test-admin')
         assert (len(user.webpages) == 2 and website in user.webpages and website2 in user.webpages)
 
         #Remove first website
-        r = self.app.post('/auth/prefs/remove_webpage',
+        r = self.app.post('/auth/prefs/user_contacts/remove_webpage',
              params=dict(oldvalue=website))
         user = M.User.query.get(username='test-admin')
         assert (len(user.webpages) == 1 and website2 in user.webpages)
@@ -527,8 +527,8 @@ class TestPreferences(TestController):
         starttime = time(9,0,0)
         endtime = time(12, 0, 0)
 
-        result = self.app.get('/auth/prefs')
-        r = self.app.post('/auth/prefs/add_timeslot',
+        result = self.app.get('/auth/prefs/user_availability')
+        r = self.app.post('/auth/prefs/user_availability/add_timeslot',
              params=dict(
                  weekday=weekday,
                  starttime=starttime.strftime('%H:%M'),
@@ -542,7 +542,7 @@ class TestPreferences(TestController):
         endtime2 = time(16, 0, 0)
 
         #Add second availability timeslot
-        r = self.app.post('/auth/prefs/add_timeslot',
+        r = self.app.post('/auth/prefs/user_availability/add_timeslot',
              params=dict(
                  weekday=weekday2,
                  starttime=starttime2.strftime('%H:%M'),
@@ -553,7 +553,7 @@ class TestPreferences(TestController):
                and timeslot2dict in user.get_availability_timeslots()
 
         #Remove availability timeslot
-        r = self.app.post('/auth/prefs/remove_timeslot',
+        r = self.app.post('/auth/prefs/user_availability/remove_timeslot',
              params=dict(
                  weekday=weekday,
                  starttime=starttime.strftime('%H:%M'),
@@ -562,7 +562,7 @@ class TestPreferences(TestController):
         assert len(user.availability) == 1 and timeslot2dict in user.get_availability_timeslots()
 
         #Add invalid availability timeslot
-        r = self.app.post('/auth/prefs/add_timeslot',
+        r = self.app.post('/auth/prefs/user_availability/add_timeslot',
              params=dict(
                  weekday=weekday2,
                  starttime=endtime2.strftime('%H:%M'),
@@ -581,8 +581,8 @@ class TestPreferences(TestController):
         now = datetime(now.year, now.month, now.day)
         startdate = now + timedelta(days=1)
         enddate = now + timedelta(days=7)
-        result = self.app.get('/auth/prefs')
-        r = self.app.post('/auth/prefs/add_inactive_period',
+        result = self.app.get('/auth/prefs/user_availability')
+        r = self.app.post('/auth/prefs/user_availability/add_inactive_period',
              params=dict(
                  startdate=startdate.strftime('%d/%m/%Y'),
                  enddate=enddate.strftime('%d/%m/%Y')))
@@ -593,7 +593,7 @@ class TestPreferences(TestController):
         #Add second inactivity period
         startdate2 =  now + timedelta(days=24)
         enddate2 = now + timedelta(days=28)
-        r = self.app.post('/auth/prefs/add_inactive_period',
+        r = self.app.post('/auth/prefs/user_availability/add_inactive_period',
              params=dict(
                  startdate=startdate2.strftime('%d/%m/%Y'),
                  enddate=enddate2.strftime('%d/%m/%Y')))
@@ -603,7 +603,7 @@ class TestPreferences(TestController):
                and period2dict in user.get_inactive_periods()
 
         #Remove first inactivity period
-        r = self.app.post('/auth/prefs/remove_inactive_period',
+        r = self.app.post('/auth/prefs/user_availability/remove_inactive_period',
              params=dict(
                  startdate=startdate.strftime('%d/%m/%Y'),
                  enddate=enddate.strftime('%d/%m/%Y')))
@@ -611,7 +611,7 @@ class TestPreferences(TestController):
         assert len(user.inactiveperiod) == 1 and period2dict in user.get_inactive_periods()
 
         #Add invalid inactivity period
-        r = self.app.post('/auth/prefs/add_inactive_period',
+        r = self.app.post('/auth/prefs/user_availability/add_inactive_period',
              params=dict(
                  startdate='NOT/A/DATE',
                  enddate=enddate2.strftime('%d/%m/%Y')))


Mime
View raw message