Commits

Chris Blower  committed 69f5e84 Draft

add apikey to edit profile page

  • Participants
  • Parent commits 1fa622c

Comments (0)

Files changed (4)

File web/frontend/features/edit_profile.feature

+Feature: Edit Profile Page
+
+  Scenario: I see my API key if I'm a premium account holder
+    Given I am an "Individual" user
+    When I visit the edit profile page
+    Then I should see the API key
+
+  Scenario: I don't see my API key if I'm a free user
+    Given I am a "Free" user
+    When I visit the edit profile page
+    Then I should not see the API key

File web/frontend/features/edit_profile_steps.py

+from lettuce import step,before,world,after
+
+@step(u'Then I should see the API key')
+def then_i_should_see_the_api_key(step):
+    apikey =  "5b7e6c1b-cfab-4485-bda0-8b00bdd7b2ea"
+    element =  world.browser.find_by_css("#apikey")
+    assert element
+    assert apikey in element.first.text
+
+@step(u'Then I should not see the API key')
+def then_i_should_not_see_the_api_key(step):
+    assert not world.browser.find_by_css("#apikey")
+

File web/frontend/features/url_steps.py

         'corporate home':               '/corporate/',
         'corporate features':           '/corporate/features/',
         'corporate contact':            '/corporate/contact/',
-        'corporate contact thanks':     '/corporate/contact/thanks'
+        'corporate contact thanks':     '/corporate/contact/thanks',
+        'edit profile':                 '/profiles/edit/'
         }
 
 def page_name_is_valid(name):

File web/templates/profiles/edit_profile.html

                     {{ form.bio }}
                     {% field_errors form.bio %}
                 </p>
+                {% if not "free" in profile.plan %}
+                  <p id="apikey">
+                    {{ profile.apikey }}
+                  </p>
+                {% endif %}
                 <p class="password">
                     <a href="{% url auth_password_change %}"><img src="{{ MEDIA_URL }}images/icons/key.png" width="16" height="16" alt="" /> Change&nbsp;your&nbsp;password</a>
                 </p>