-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete initial reports implementation
- Loading branch information
1 parent
752d434
commit 9a8f83a
Showing
6 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ The logic Package | |
status_schemes | ||
status_ratings | ||
species_status_ratings | ||
reports | ||
job_statuses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
reports.py | ||
========== | ||
|
||
.. automodule:: naturerec_model.logic.reports | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
reports_blueprint.py | ||
==================== | ||
|
||
.. automodule:: naturerec_web.reports.reports_blueprint | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Feature: Reporting | ||
Scenario: Report on numbers of individuals by location | ||
Given A set of sightings | ||
| Date | Location | Category | Species | Number | Gender | WithYoung | | ||
| TODAY | Test Location | Birds | Woodpigeon | 1 | Unknown | No | | ||
| TODAY | Test Location | Birds | Blackbird | 1 | Male | No | | ||
| TODAY | Test Location | Birds | Robin | 1 | Unknown | No | | ||
| TODAY | Test Location | Mammals | Grey Squirrel | 1 | Unknown | No | | ||
|
||
When I navigate to the individuals by location report page | ||
And I fill in the individuals by location report details | ||
| Location | Category | From | | ||
| Test Location | Birds | TODAY | | ||
|
||
And I click on the "Generate Report" button | ||
Then There will be 3 results in the report table | ||
|
||
Scenario: Report on numbers of individuals by location | ||
Given A set of sightings | ||
| Date | Location | Category | Species | Number | Gender | WithYoung | | ||
| TODAY | Test Location | Birds | Woodpigeon | 1 | Unknown | No | | ||
| TODAY | Test Location | Mammals | Grey Squirrel | 1 | Unknown | No | | ||
|
||
When I navigate to the sightings by location report page | ||
And I fill in the sightings by location report details | ||
| Location | Category | From | | ||
| Test Location | Birds | TODAY | | ||
|
||
And I click on the "Generate Report" button | ||
Then There will be 1 result in the report table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from behave import when, then | ||
from selenium.webdriver.common.by import By | ||
|
||
from features.steps.helpers import select_option, get_date_from_string, confirm_table_row_count | ||
from naturerec_model.model import Sighting | ||
|
||
|
||
@when("I navigate to the individuals by location report page") | ||
def _(context): | ||
url = context.flask_runner.make_url("reports/location/individuals") | ||
context.browser.get(url) | ||
assert "Individuals by Species & Location" in context.browser.title | ||
|
||
|
||
@when("I navigate to the sightings by location report page") | ||
def _(context): | ||
url = context.flask_runner.make_url("reports/location/sightings") | ||
context.browser.get(url) | ||
assert "Sightings by Species & Location" in context.browser.title | ||
|
||
|
||
@when("I fill in the individuals by location report details") | ||
@when("I fill in the sightings by location report details") | ||
def _(context): | ||
row = context.table.rows[0] | ||
select_option(context, "location", row["Location"], None) | ||
select_option(context, "category", row["Category"], None) | ||
from_date = get_date_from_string(row["From"]).strftime(Sighting.DATE_DISPLAY_FORMAT) | ||
context.browser.find_element(By.NAME, "from_date").send_keys(from_date) | ||
|
||
|
||
@then("There will be {number} results in the report table") | ||
@then("There will be {number} result in the report table") | ||
def _(context, number): | ||
confirm_table_row_count(context, number, 1) |