Skip to content

Commit

Permalink
Aloe development fixtures (#314)
Browse files Browse the repository at this point in the history
* aloe: prefix dd features with dd_

* tests: don't user runserver_plus for tests

* allow aloe tests against dev fixtures and some simple tests
  • Loading branch information
aahunter authored Nov 18, 2016
1 parent caff0d5 commit a63c727
Show file tree
Hide file tree
Showing 13 changed files with 157 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ WORKDIR /data

# entrypoint shell script that by default starts runserver
ENTRYPOINT ["/app/docker-entrypoint.sh"]
CMD ["runserver"]
CMD ["runserver_plus"]
28 changes: 21 additions & 7 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,19 @@ function _django_fixtures {
}


function _runserver() {
echo "RUNSERVER_OPTS is ${RUNSERVER_OPTS}"

_django_collectstatic
_django_migrate
_django_fixtures

echo "running runserver ..."
exec django-admin.py ${RUNSERVER_OPTS}
}



trap exit SIGHUP SIGINT SIGTERM
defaults
env | grep -iv PASS | sort
Expand Down Expand Up @@ -160,15 +173,16 @@ fi
if [ "$1" = 'runserver' ]; then
echo "[Run] Starting runserver"

: ${RUNSERVER_OPTS="runserver_plus 0.0.0.0:${RUNSERVERPORT} --settings=${DJANGO_SETTINGS_MODULE}"}
echo "RUNSERVER_OPTS is ${RUNSERVER_OPTS}"
: ${RUNSERVER_OPTS="runserver 0.0.0.0:${RUNSERVERPORT} --settings=${DJANGO_SETTINGS_MODULE}"}
_runserver
fi

_django_collectstatic
_django_migrate
_django_fixtures
# runserver_plus entrypoint
if [ "$1" = 'runserver_plus' ]; then
echo "[Run] Starting runserver_plus"

echo "running runserver ..."
exec django-admin.py ${RUNSERVER_OPTS}
: ${RUNSERVER_OPTS="runserver_plus 0.0.0.0:${RUNSERVERPORT} --settings=${DJANGO_SETTINGS_MODULE}"}
_runserver
fi

# grdr entrypoint
Expand Down
82 changes: 82 additions & 0 deletions rdrf/rdrf/features/base_admin_page.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Feature: Admin Page and Settings
As a RDRF registry owner
I want admin users to have access to admin pages and settings
In order to do administrative tasks using the Web UI

Background:
Given development fixtures
Given a registry named "Sample Registry"

Scenario: Admin user drop-down has Admin Page item
Given I am logged in as admin
When I click the User Dropdown Menu
Then I should see a link to "Admin Page"

Scenario: Admin user has Settings in main menu
Given I am logged in as admin
When I click the User Dropdown Menu
Then I should see a link to "Settings"

Scenario: Curator user drop-down DOES NOT have Admin Page item
Given I am logged in as curator
When I click the User Dropdown Menu
Then I should NOT see a link to "Admin Page"

Scenario: Curator user DOES NOT Settings in main menu
Given I am logged in as curator
Then I should NOT see a link to "Settings"

Scenario: Admin user opens Settings menu
Given I am logged in as admin
When I click "Settings"
Then I should see a link to "Registries"
And I should see a link to "Registry Form"
And I should see a link to "Sections"
And I should see a link to "Data Elements"
And I should see a link to "CDE Policy"
And I should see a link to "Permissible Value Groups"
And I should see a link to "Permissible Values"
And I should see a link to "Consent Sections"
And I should see a link to "Consent Values"
And I should see a link to "Groups"
And I should see a link to "Importer"
And I should see a link to "Explorer"
And I should see a link to "Demographics Fields"
And I should see a link to "Next of Kin Relationship"
And I should see a link to "Registration Profiles"
And I should see a link to "Email Notifications"
And I should see a link to "Email Templates"
And I should see a link to "Email Notifications History"


Scenario: Admin user visits Admin Page
Given I am logged in as admin
When I click the User Dropdown Menu
And I click "Admin Page"
Then I should see a link to "Patient List"
And I should see a link to "Other Clinicians"
And I should see a link to "Doctors"
And I should see a link to "Reports"
And I should see a link to "Users"
And I should see a link to "Genes"
And I should see a link to "Laboratories"
And I should see a link to "Registries"
And I should see a link to "Registry Form"
And I should see a link to "Sections"
And I should see a link to "Data Elements"
And I should see a link to "CDE Policy"
And I should see a link to "Permissible Value Groups"
And I should see a link to "Permissible Values"
And I should see a link to "Consent Sections"
And I should see a link to "Consent Values"
And I should see a link to "Groups"
And I should see a link to "Importer"
And I should see a link to "Explorer"
And I should see a link to "Demographics Fields"
And I should see a link to "Next of Kin Relationship"
And I should see a link to "Registration Profiles"
And I should see a link to "Email Notifications"
And I should see a link to "Email Templates"
And I should see a link to "Email Notifications History"
And I should see a link to "Working Groups"
And I should see a link to "States"
23 changes: 23 additions & 0 deletions rdrf/rdrf/features/base_iprestrict.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Feature: IPRestrict is enabled and working
As a RDRF registry owner
I want to retrict access by IP to all or part of the application

Background:
Given development fixtures
Given a registry named "Sample Registry"

Scenario: Admin user blocks useraudit to localhost
Given I am logged in as admin
When I click "Settings"
And I click "IP Restrict Rules"
Then I should see "Rules"
And I click "Add"
And I fill in "Url pattern" with ".*useraudit.*"
And I select "localhost" from "Ip group"
And I select "DENY" from "Action"
And I save the form
Then I should see "added successfully"
Given I reload iprestrict
When I click "Settings"
And I click "User Login Log"
Then I should see "Looks like you don't have access to this page"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions rdrf/rdrf/features/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ def import_registry(export_name):
subprocess_logging(["django-admin.py", "import", "{0}/{1}".format(exported_data_path(), export_name)])


def django_reloadrules():
logger.info("Reloading iprestrict rules")
subprocess_logging(["django-admin.py", "reloadrules"])


def django_init_dev():
subprocess_logging(["django-admin.py", "init" , "DEV"])
django_reloadrules()


def show_stats(export_name):
"""
show some stats after import
Expand All @@ -103,6 +113,10 @@ def click(element):
element.click()


def debug_links():
for link in world.browser.find_elements_by_xpath('//a'):
logger.debug('link {0} {1}'.format(link.text, link.get_attribute("href")))

# We started from the step definitions from lettuce_webdriver, but
# transitioned to our own (for example looking up form controls by label, not id)
# We still use utils from the lettuce_webdriver but importing them registers
Expand All @@ -111,6 +125,11 @@ def click(element):
STEP_REGISTRY.clear()


@step('development fixtures')
def load_development_fixtures(step):
django_init_dev()


@step('export "(.*)"')
def load_export(step, export_name):
"""
Expand Down Expand Up @@ -214,6 +233,12 @@ def click_save_button(step):
click(save_button)


@step('And I save the form')
def click_save_button(step):
save_button = world.browser.find_element_by_class_name("btn-primary")
click(save_button)


@step('error message is "(.*)"')
def error_message_is(step, error_message):
# <div class="alert alert-alert alert-danger">Patient Fred SMITH not saved due to validation errors</div>
Expand Down Expand Up @@ -430,3 +455,8 @@ def sidebar_click(step, sidebar_link_text):
def click_cancel(step):
link = world.browser.find_element_by_xpath('//a[@class="btn btn-danger" and contains(., "Cancel")]')
click(link)


@step('I reload iprestrict')
def reload_iprestrict(step):
django_reloadrules()

0 comments on commit a63c727

Please sign in to comment.