Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1882/api endpoints without trailing slashes #1899

Merged
merged 5 commits into from Oct 24, 2019

Conversation

@plettich
Copy link
Member

plettich commented Oct 23, 2019

Fixes #1882

@plettich plettich requested a review from cornelinux Oct 23, 2019
plettich added 3 commits Oct 17, 2019
The `event` and `smsprovider` endpoints were missing a trailing slash in
the blueprint, thus calls to `/smsprovider/` would result in a 404.
Adding the trailing slash provides a redirect for endpoints without
trailing slashes.
Also renamed the `id` parameter to `db_id` to avoid shadowing the internal
`id` from python.
This will be handled in a different PR.
@plettich plettich force-pushed the 1882/api_endpoints_without_trailing_slashes branch from 477e705 to ae00723 Oct 23, 2019
@codecov

This comment has been minimized.

Copy link

codecov bot commented Oct 23, 2019

Codecov Report

Merging #1899 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1899      +/-   ##
==========================================
- Coverage   97.13%   97.13%   -0.01%     
==========================================
  Files         151      151              
  Lines       18486    18484       -2     
==========================================
- Hits        17957    17955       -2     
  Misses        529      529
Impacted Files Coverage Δ
privacyidea/api/smsgateway.py 98.14% <100%> (ø) ⬆️
privacyidea/api/event.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e31765a...bcd97ac. Read the comment docs.

@plettich plettich force-pushed the 1882/api_endpoints_without_trailing_slashes branch from 2c67c8b to 6aa8f36 Oct 24, 2019
@cornelinux

This comment has been minimized.

Copy link
Member

cornelinux commented Oct 24, 2019

Rest lgtm. Thanks.

if gwid == "providers":
for classname in SMS_PROVIDERS:
smsclass = get_sms_provider_class(classname.rsplit(".", 1)[0],
classname.rsplit(".", 1)[1])
res[classname] = smsclass.parameters()
else:
res = [gw.as_dict() for gw in get_smsgateway(id=gwid)]
res = [gw.as_dict() for gw in get_smsgateway(db_id=gwid)]

This comment has been minimized.

Copy link
@cornelinux

cornelinux Oct 24, 2019

Member

please revert this.

This comment has been minimized.

Copy link
@plettich

plettich Oct 24, 2019

Author Member

Done in bcd97ac

try:
h_obj = locals()[handlername + 'EventHandler']()
except KeyError as _e:
h_obj = None

This comment has been minimized.

Copy link
@cornelinux

cornelinux Oct 24, 2019

Member

Please move this to another PR

This comment has been minimized.

Copy link
@plettich

plettich Oct 24, 2019

Author Member

Done in bcd97ac

@@ -204,25 +204,25 @@ def delete_smsgateway_option(id, option_key):
return fetch_one_resource(SMSGatewayOption, gateway_id=id, Key=option_key).delete()


def get_smsgateway(identifier=None, id=None, gwtype=None):
def get_smsgateway(identifier=None, db_id=None, gwtype=None):

This comment has been minimized.

Copy link
@cornelinux

This comment has been minimized.

Copy link
@plettich

plettich Oct 24, 2019

Author Member

s.o.

@@ -38,19 +38,19 @@ def test_00_SMSError(self):
self.assertTrue(text == "Some Error", text)

def test_01_get_provider_class(self):
_provider =get_sms_provider_class(
_provider = get_sms_provider_class(

This comment has been minimized.

Copy link
@cornelinux

cornelinux Oct 24, 2019

Member

PLease move this whole file change to another PR (with the change of the signature of the function)

This comment has been minimized.

Copy link
@plettich

plettich Oct 24, 2019

Author Member

Done in bcd97ac

Only add changes belonging to this issue.
Copy link
Member

cornelinux left a comment

Thanks - lgtm.

@cornelinux cornelinux merged commit b947392 into master Oct 24, 2019
5 checks passed
5 checks passed
ci/circleci Your tests passed on CircleCI!
Details
codecov/patch 100% of diff hit (target 97.13%)
Details
codecov/project Absolute coverage decreased by -<.01% but relative coverage increased by +2.86% compared to e31765a
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@cornelinux cornelinux deleted the 1882/api_endpoints_without_trailing_slashes branch Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.