Skip to content
Snippets Groups Projects
Commit 500ced23 authored by anonymous's avatar anonymous
Browse files

add kiel text and fix login problem

parent 57fcf31b
No related branches found
No related tags found
No related merge requests found
...@@ -113,7 +113,7 @@ class Initialization(CkanCommand): ...@@ -113,7 +113,7 @@ class Initialization(CkanCommand):
'active': True, 'active': True,
'owner_org': "landeshauptstadt-kiel", 'owner_org': "landeshauptstadt-kiel",
'frequency': "MANUAL", 'frequency': "MANUAL",
'notes': "Kommunalverwaltung" 'notes': "Die Stadt Kiel ist die nördlichste Großstadt Deutschlands und die Landeshauptstadt Schleswig-Holsteins. Als kreisfreie Stadt erledigt sie neben den kommunalen Selbstverwaltungsaufgaben auch Aufgaben einer unteren staatlichen Verwaltungsbehörde und erzeugt, erhebt und verarbeitet als Gebietskörperschaft eine Vielzahl von Daten mit lokalem Bezug."
}, },
"Statistisches Amt für Hamburg und Schleswig-Holstein - Anstalt des öffentlichen Rechts - (Statistikamt Nord)": { "Statistisches Amt für Hamburg und Schleswig-Holstein - Anstalt des öffentlichen Rechts - (Statistikamt Nord)": {
'name': u"statistikamt-nord", 'name': u"statistikamt-nord",
......
...@@ -31,10 +31,10 @@ is_required=false) %} ...@@ -31,10 +31,10 @@ is_required=false) %}
placeholder="{{ placeholder }}" {{ onFocus }} {{ attributes(attrs) }} /> placeholder="{{ placeholder }}" {{ onFocus }} {{ attributes(attrs) }} />
</div> </div>
<div class="span6 inline-error"> <div class="span6 inline-error">
{% if error is string %} {% if error is iterable and error is not string %}
{{error}}
{% else %}
{{error|first}} {{error|first}}
{% else %}
{{error}}
{% endif %} {% endif %}
</div> </div>
</div> </div>
......
...@@ -31,12 +31,10 @@ class TestUser(helpers.FunctionalTestBase): ...@@ -31,12 +31,10 @@ class TestUser(helpers.FunctionalTestBase):
@odsh_test() @odsh_test()
def test_user_logout(self): def test_user_logout(self):
app = self._get_test_app() #act
final_response = self._logout()
logout_url = url_for(controller='user', action='logout')
logout_response = app.get(logout_url, status=302)
final_response = helpers.webtest_maybe_follow(logout_response)
# assert
assert_true('You are now logged out.' in final_response) assert_true('You are now logged out.' in final_response)
@odsh_test() @odsh_test()
...@@ -48,10 +46,21 @@ class TestUser(helpers.FunctionalTestBase): ...@@ -48,10 +46,21 @@ class TestUser(helpers.FunctionalTestBase):
# act # act
response = self._open_url('/user/'+user['name']) response = self._open_url('/user/'+user['name'])
# arrange # assert
# we land on the default search page # we land on the default search page
response.mustcontain('API Key') response.mustcontain('API Key')
@odsh_test()
def test_user_login_wrong_password(self):
# arrange
user = factories.User()
# act
response = self._login_user(user, 'wrong')
# assert
response.mustcontain('Login failed. Bad username or password.')
def _open_url(self, url): def _open_url(self, url):
app = self._get_test_app() app = self._get_test_app()
return app.get(url) return app.get(url)
...@@ -61,11 +70,21 @@ class TestUser(helpers.FunctionalTestBase): ...@@ -61,11 +70,21 @@ class TestUser(helpers.FunctionalTestBase):
# let's go to the last redirect in the chain # let's go to the last redirect in the chain
return helpers.webtest_maybe_follow(submit_response) return helpers.webtest_maybe_follow(submit_response)
def _login_user(self, user): def _login_user(self, user, password=None):
response = self._open_url('/user/login') response = self._open_url('/user/login')
login_form = response.forms[0] login_form = response.forms[0]
login_form['login'] = user['name'] login_form['login'] = user['name']
login_form['password'] = 'pass' if password is None:
password = 'pass'
login_form['password'] = password
return self._submit_form(login_form) return self._submit_form(login_form)
def _logout(self):
app = self._get_test_app()
logout_url = url_for(controller='user', action='logout')
logout_response = app.get(logout_url, status=302)
final_response = helpers.webtest_maybe_follow(logout_response)
return final_response
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment