summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavaL <ayoyo@thoughtworks.com>2016-05-18 18:54:39 +0200
committerNavaL <ayoyo@thoughtworks.com>2016-05-18 18:54:44 +0200
commit021fd399db4801c3d2c96b6f2bace99046d9f54b (patch)
treed56736d4c7609d04d95a3552d833c0bbee60d7cd
parent804213b24bad0cc222c98888d8ddac356252465c (diff)
Issue #692 re-added logout back in the feature toggle
-rw-r--r--service/pixelated/resources/features_resource.py8
-rw-r--r--service/test/functional/features/login.feature2
-rw-r--r--service/test/functional/features/steps/login.py11
-rw-r--r--web-ui/app/js/features/features.js12
4 files changed, 26 insertions, 7 deletions
diff --git a/service/pixelated/resources/features_resource.py b/service/pixelated/resources/features_resource.py
index 4856b64b..d4b7de7d 100644
--- a/service/pixelated/resources/features_resource.py
+++ b/service/pixelated/resources/features_resource.py
@@ -31,10 +31,16 @@ class FeaturesResource(Resource):
def render_GET(self, request):
disabled_features = self._disabled_features()
- return respond_json({'disabled_features': disabled_features}, request)
+ features = {'disabled_features': disabled_features}
+ self._add_multi_user_to(features)
+ return respond_json(features, request)
def _disabled_features(self):
disabled_features = [default_disabled_feature for default_disabled_feature in self.DISABLED_FEATURES]
if os.environ.get('FEEDBACK_URL') is None:
disabled_features.append('feedback')
return disabled_features
+
+ def _add_multi_user_to(self, features):
+ if self._multi_user:
+ features.update({'multi_user': {'logout': LogoutResource.BASE_URL}})
diff --git a/service/test/functional/features/login.feature b/service/test/functional/features/login.feature
index d22cc774..c50f8eea 100644
--- a/service/test/functional/features/login.feature
+++ b/service/test/functional/features/login.feature
@@ -27,3 +27,5 @@ Feature: login and logout
And I click on the login button
Then I should see the fancy interstitial
Then I have mails
+ When I logout
+ Then I should see the login page
diff --git a/service/test/functional/features/steps/login.py b/service/test/functional/features/steps/login.py
index 7f17567a..e2dc1381 100644
--- a/service/test/functional/features/steps/login.py
+++ b/service/test/functional/features/steps/login.py
@@ -42,3 +42,14 @@ def step_impl(context):
def _wait_for_interstitial_to_reload():
time.sleep(6)
+
+
+@when(u'I logout')
+def click_logout(context):
+ logout_button = wait_until_element_is_visible_by_locator(context, (By.CSS_SELECTOR, 'ul#logout'))
+ logout_button.click()
+
+
+@then(u'I should see the login page')
+def see_login_page(context):
+ assert find_element_by_css_selector(context, 'form#login_form')
diff --git a/web-ui/app/js/features/features.js b/web-ui/app/js/features/features.js
index 80ecc225..f71d56ea 100644
--- a/web-ui/app/js/features/features.js
+++ b/web-ui/app/js/features/features.js
@@ -18,16 +18,16 @@
define(['helpers/monitored_ajax'], function(monitoredAjax) {
'use strict';
var cachedDisabledFeatures;
- var cachedDispatcherFeatures;
+ var cachedMultiUserFeatures;
function getDisabledFeatures() {
cachedDisabledFeatures = cachedDisabledFeatures || fetchFeatures().disabled_features;
return cachedDisabledFeatures;
}
- function getDispatcherFeatures() {
- cachedDispatcherFeatures = cachedDispatcherFeatures || fetchFeatures().dispatcher_features;
- return cachedDispatcherFeatures;
+ function getMultiUserFeatures() {
+ cachedMultiUserFeatures = cachedMultiUserFeatures || fetchFeatures().multi_user;
+ return cachedMultiUserFeatures;
}
function fetchFeatures() {
@@ -52,10 +52,10 @@ define(['helpers/monitored_ajax'], function(monitoredAjax) {
return this.isEnabled('autoRefresh');
},
isLogoutEnabled: function () {
- return _.has(getDispatcherFeatures(), 'logout');
+ return _.has(getMultiUserFeatures(), 'logout');
},
getLogoutUrl: function () {
- return getDispatcherFeatures().logout;
+ return getMultiUserFeatures().logout;
}
};
});