Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Remove write api feature test helpers
Browse files Browse the repository at this point in the history
They are now all being handled by the admin app.
  • Loading branch information
robyoung committed Jan 2, 2014
1 parent a51353e commit dc1f67b
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 50 deletions.
6 changes: 3 additions & 3 deletions features/admin/csv_upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Feature: CSV Upload
Scenario: Upload CSV data
Given I have a bucket named "my_bucket"
And bucket setting upload_format is "csv"
And admin I am logged in
And I am logged in
And I can upload to "my_bucket"
And a file named "data.csv"
"""
Expand All @@ -30,7 +30,7 @@ Feature: CSV Upload
"""
And I have a bucket named "my_bucket"
And bucket setting upload_format is "csv"
And admin I am logged in
And I am logged in
And I can upload to "my_bucket"
When I go to "/my_bucket/upload"
And I enter "data.csv" into the file upload field
Expand Down Expand Up @@ -61,7 +61,7 @@ Feature: CSV Upload
"""
And I have a bucket named "bucket_with_auto_id"
And bucket setting upload_format is "csv"
And admin I am logged in
And I am logged in
And I can upload to "bucket_with_auto_id"
When I go to "/bucket_with_auto_id/upload"
And I enter "data.csv" into the file upload field
Expand Down
10 changes: 5 additions & 5 deletions features/admin/csv_upload_validation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: csv upload validation
"""
And I have a bucket named "foo"
And bucket setting upload_format is "csv"
And admin I am logged in
And I am logged in
And I can upload to "foo"
When I go to "/foo/upload"
And I enter "data.csv" into the file upload field
Expand All @@ -27,7 +27,7 @@ Feature: csv upload validation
"""
And I have a bucket named "foo"
And bucket setting upload_format is "csv"
And admin I am logged in
And I am logged in
And I can upload to "foo"
When I go to "/foo/upload"
And I enter "data.csv" into the file upload field
Expand All @@ -39,7 +39,7 @@ Feature: csv upload validation
Given a file named "data.csv" of size "1000000" bytes
And I have a bucket named "foo"
And bucket setting upload_format is "csv"
And admin I am logged in
And I am logged in
And I can upload to "foo"
When I go to "/foo/upload"
And I enter "data.csv" into the file upload field
Expand All @@ -51,7 +51,7 @@ Feature: csv upload validation
Given a file named "data.csv" with fixture "bad-characters.csv"
And I have a bucket named "foo"
And bucket setting upload_format is "csv"
And admin I am logged in
And I am logged in
And I can upload to "foo"
When I go to "/foo/upload"
And I enter "data.csv" into the file upload field
Expand All @@ -60,7 +60,7 @@ Feature: csv upload validation
And the platform should have "0" items stored in "foo"

Scenario: no file is provided
Given admin I am logged in
Given I am logged in
And I have a bucket named "foo"
And I can upload to "foo"
When I go to "/foo/upload"
Expand Down
4 changes: 2 additions & 2 deletions features/admin/excel_upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Feature: excel upload
Given a file named "data.xlsx" with fixture "data.xlsx"
And I have a bucket named "my_xlsx_bucket"
And bucket setting upload_format is "excel"
And admin I am logged in
And I am logged in
And I can upload to "my_xlsx_bucket"
When I go to "/my_xlsx_bucket/upload"
And I enter "data.xlsx" into the file upload field
Expand All @@ -20,7 +20,7 @@ Feature: excel upload
Given a file named "LPA_MI_EXAMPLE.xls" with fixture "LPA_MI_EXAMPLE.xls"
And I have a bucket named "bucket_with_timestamp_auto_id"
And bucket setting upload_format is "excel"
And admin I am logged in
And I am logged in
And I can upload to "bucket_with_timestamp_auto_id"
When I go to "/bucket_with_timestamp_auto_id/upload"
And I enter "LPA_MI_EXAMPLE.xls" into the file upload field
Expand Down
4 changes: 2 additions & 2 deletions features/admin/signin.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
Feature: Sign in

Scenario: Show signed in user name
Given admin I am logged in as "Max" with email "test@example.com"
Given I am logged in as "Max" with email "test@example.com"
When I go to "/"
Then I should get a "cache-control" header of "private, must-revalidate"
And I should see the text "Signed in as Max"

Scenario: Show signed in list of actions
Given admin I am logged in as "Alex" with email "test@example.com"
Given I am logged in as "Alex" with email "test@example.com"
And I can upload to "my_bucket"
When I go to "/"
Then I should see the text "Upload a CSV to the my_bucket bucket"
Expand Down
12 changes: 6 additions & 6 deletions features/contrib/evl_upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Feature: EVL Upload
and I have a bucket named "evl_ceg_data"
and bucket setting upload_format is "excel"
and bucket setting upload_filters is ["backdrop.core.upload.filters.first_sheet_filter","backdrop.contrib.evl_upload_filters.ceg_volumes"]
and admin I am logged in
and I am logged in
and I can upload to "evl_ceg_data"
when I go to "/evl_ceg_data/upload"
and I enter "CEG Data.xlsx" into the file upload field
Expand All @@ -22,7 +22,7 @@ Feature: EVL Upload
and I have a bucket named "evl_services_volumetrics"
and bucket setting upload_format is "excel"
and bucket setting upload_filters is ["backdrop.core.upload.filters.first_sheet_filter","backdrop.contrib.evl_upload_filters.service_volumetrics"]
and admin I am logged in
and I am logged in
and I can upload to "evl_services_volumetrics"
when I go to "/evl_services_volumetrics/upload"
and I enter "EVL Volumetrics.xlsx" into the file upload field
Expand All @@ -38,7 +38,7 @@ Feature: EVL Upload
and I have a bucket named "evl_services_failures"
and bucket setting upload_format is "excel"
and bucket setting upload_filters is ["backdrop.contrib.evl_upload_filters.service_failures"]
and admin I am logged in
and I am logged in
and I can upload to "evl_services_failures"
when I go to "/evl_services_failures/upload"
and I enter "EVL Volumetrics.xlsx" into the file upload field
Expand All @@ -56,7 +56,7 @@ Feature: EVL Upload
and I have a bucket named "evl_channel_volumetrics"
and bucket setting upload_format is "excel"
and bucket setting upload_filters is ["backdrop.core.upload.filters.first_sheet_filter","backdrop.contrib.evl_upload_filters.channel_volumetrics"]
and admin I am logged in
and I am logged in
and I can upload to "evl_channel_volumetrics"
when I go to "/evl_channel_volumetrics/upload"
and I enter "EVL Volumetrics.xlsx" into the file upload field
Expand All @@ -73,7 +73,7 @@ Feature: EVL Upload
and I have a bucket named "evl_customer_satisfaction"
and bucket setting upload_format is "excel"
and bucket setting upload_filters is ["backdrop.core.upload.filters.first_sheet_filter","backdrop.contrib.evl_upload_filters.customer_satisfaction"]
and admin I am logged in
and I am logged in
and I can upload to "evl_customer_satisfaction"
when I go to "/evl_customer_satisfaction/upload"
and I enter "EVL Satisfaction.xlsx" into the file upload field
Expand All @@ -90,7 +90,7 @@ Feature: EVL Upload
and I have a bucket named "evl_volumetrics"
and bucket setting upload_format is "excel"
and bucket setting upload_filters is ["backdrop.contrib.evl_upload_filters.volumetrics"]
and admin I am logged in
and I am logged in
and I can upload to "evl_volumetrics"
when I go to "/evl_volumetrics/upload"
and I enter "evl-volumetrics.xls" into the file upload field
Expand Down
2 changes: 0 additions & 2 deletions features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ def create_client(feature):
return FlaskTestClient(write_api)
if 'use_http_client' in feature.tags:
return HTTPTestClient(config.DATABASE_NAME)
if 'use_splinter_client' in feature.tags:
return SplinterClient(config.DATABASE_NAME, 'write', '5001')
if 'use_admin_client' in feature.tags:
return SplinterClient(config.DATABASE_NAME, 'admin', '5002')

Expand Down
15 changes: 0 additions & 15 deletions features/steps/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,3 @@ def step(context, filename):
with open(filepath, "w") as stream:
stream.write(content)
context.after_handlers.append(lambda: os.remove(filepath))


# TODO: remove admin prefix
@given(u'admin I am logged in')
def step(context):
context.execute_steps(u'given admin I am logged in as "testuser" with email "test@example.com"')


# TODO: remove admin prefix
@given(u'admin I am logged in as "{name}" with email "{email}"')
def step(context, name, email):
testuser = (name, email)
ensure_user_exists(context, email)
context.user_email = email
context.client.get("/sign-in/test?user=%s&email=%s" % testuser)
14 changes: 6 additions & 8 deletions features/steps/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
ensure_user_has_permissions, ensure_user_exists


# TODO: remove this step
@given('I can upload to "{bucket}"')
def step(context, bucket):
ensure_user_has_permissions(context, context.user_email, [bucket])


@given(u'I am logged in')
def step(context):
context.execute_steps(u'given I am logged in as "testuser" with email "test@example.com"')


# TODO: remove this step
@given(u'I am logged in as "{name}" with email "{email}"')
def step(context, name, email):
testuser = (name, email)
ensure_user_exists(context, email)
context.user_email = email
context.client.get("/_user/sign_in/test?user=%s&email=%s" % testuser)


@given('I can upload to "{bucket}"')
def step(context, bucket):
ensure_user_has_permissions(context, context.user_email, [bucket])
context.client.get("/sign-in/test?user=%s&email=%s" % testuser)
8 changes: 1 addition & 7 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,7 @@ display_result $? 1 "Unit tests"
python -m coverage.__main__ xml --include=backdrop*

# run feature tests
if [[ -z "$SKIP_SPLINTER_TESTS" ]]; then
echo "Not skipping splinter tests"
behave --stop --tags=~@wip
else
echo "Skipping splinter tests"
behave --stop --tags=~@wip --tags=~@use_splinter_client
fi
behave --stop --tags=~@wip
display_result $? 2 "Feature tests"

# run style checks
Expand Down

0 comments on commit dc1f67b

Please sign in to comment.