From dc3ac3ca36640754f6cf57398fa0060b6d5f5908 Mon Sep 17 00:00:00 2001 From: Francisco de la Vega Date: Tue, 26 Dec 2017 12:56:20 +0100 Subject: [PATCH] Remove deprecated test, CKAN does not redirect to login on forbidden error --- README.md | 4 ++-- ckanext/oauth2/tests/test_selenium.py | 27 ++------------------------- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 89c5494..ed1099d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -OAuth2 CKAN extension [![Build Status](https://build.conwet.fi.upm.es/jenkins/buildStatus/icon?job=ckan_oauth2)](https://build.conwet.fi.upm.es/jenkins/job/ckan_oauth2/) +OAuth2 CKAN extension [![Build Status](https://travis-ci.org/conwetlab/ckanext-oauth2.svg?branch=fiware_migration)](https://travis-ci.org/conwetlab/ckanext-oauth2.svg?branch=fiware_migration) [![Coverage Status](https://coveralls.io/repos/github/conwetlab/ckanext-oauth2/badge.svg?branch=fiware_migration)](https://coveralls.io/github/conwetlab/ckanext-oauth2?branch=fiware_migration) ===================== The OAuth2 extension allows site visitors to login through an OAuth2 server. -**Note**: This extension has been tested in CKAN 2.2 and 2.3. It may not work in other versions. +**Note**: This extension is being tested in CKAN 2.6 and 2.7. These are therefore considered as the supported versions **Note**: If you want to use the FIWARE IdM, use the code on `fiware-migration` branch. diff --git a/ckanext/oauth2/tests/test_selenium.py b/ckanext/oauth2/tests/test_selenium.py index 00192e9..d43d76a 100644 --- a/ckanext/oauth2/tests/test_selenium.py +++ b/ckanext/oauth2/tests/test_selenium.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2014 CoNWeT Lab., Universidad Politécnica de Madrid +# Copyright (c) 2014 - 2017 CoNWeT Lab., Universidad Politécnica de Madrid # This file is part of OAuth2 CKAN Extension. @@ -115,13 +115,6 @@ def test_basic_login_different_referer(self): self.assertEqual("filab2 Example User", driver.find_element_by_css_selector("span.username").text) self.assertEqual(self.base_url + "dataset", driver.current_url) - # def test_user_denies_ckan_access_to_their_account(self): - # # User rejects the application to access his/her information - # driver = self.driver - # self._log_in(self.base_url, FILAB3_MAIL) - # driver.find_element_by_name("cancel").click() - # assert driver.find_element_by_xpath("//div/div/div/div").text.startswith("The end-user or authorization server denied the request.") - def test_user_access_unauthorized_page(self): driver = self.driver self._log_in(self.base_url) @@ -133,23 +126,6 @@ def test_user_access_unauthorized_page(self): # Check that an error message is shown assert driver.find_element_by_xpath("//div/div/div/div").text.startswith("Need to be system administrator to administer") - def test_user_access_unauthorized_page_not_logged(self): - driver = self.driver - driver.get(self.base_url + "ckan-admin") - - # Check that the user has been redirected to the log in page - # self.assertEquals(IDM_URL + "/users/sign_in", driver.current_url) - assert driver.current_url.startswith(IDM_URL + "/oauth2/authorize") - - # Log in the user - self._introduce_log_in_parameters() - - if driver.current_url.startswith(IDM_URL): - driver.find_element_by_xpath("//button[@type='submit']").click() - - # Check that the user is logged in now - self.assertEqual("filab2 Example User", driver.find_element_by_css_selector("span.username").text) - def test_register_btn(self): driver = self.driver driver.get(self.base_url) @@ -166,5 +142,6 @@ def test_register(self, action, expected_url): time.sleep(3) # Wait the OAuth2 Server to return the page self.assertEqual(expected_url, driver.current_url) + if __name__ == "__main__": unittest.main()