From 36cc3f5e3e2213905aea0fe8ce9e37097ed3ff1e Mon Sep 17 00:00:00 2001 From: Frank Bertsch Date: Wed, 7 Nov 2018 15:38:26 -0600 Subject: [PATCH] Flake8 cleanup --- mozaggregator/service.py | 6 +----- tests/dataset.py | 1 - tests/test_service.py | 4 ---- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/mozaggregator/service.py b/mozaggregator/service.py index b2a2830..3c72628 100644 --- a/mozaggregator/service.py +++ b/mozaggregator/service.py @@ -78,15 +78,13 @@ AUTH0_DOMAIN = "auth.mozilla.auth0.com" AUTH0_API_AUDIENCE = "https://aggregates.telemetry.mozilla.org/" AUTH0_ALGORITHMS = ["RS256"] AUTH0_REQUIRED_SCOPE = "read:aggregates" -auth0_cache = ExpiringDict(max_len=1000, max_age_seconds=15*60) +auth0_cache = ExpiringDict(max_len=1000, max_age_seconds=15 * 60) # CSP Headers DEFAULT_CSP_POLICY = "frame-ancestors 'none'; default-src 'self'" DEFAULT_X_FRAME_POLICY = "DENY" - - # Error handler class AuthError(Exception): def __init__(self, error, status_code): @@ -199,7 +197,6 @@ def check_auth(): raise AuthError({"code": "access_denied", "description": "Access not allowed"}, 403) - def is_authed(): try: @@ -485,7 +482,6 @@ def get_dates_metrics(prefix, channel): mapping = {"true": True, "false": False} dimensions = {k: mapping.get(v, v) for k, v in request.args.iteritems()} - extra_dimensions = dimensions.viewkeys() - ALLOWED_DIMENSIONS if extra_dimensions: # We received an unsupported query string to filter by, return 405. diff --git a/tests/dataset.py b/tests/dataset.py index 7816179..cb14767 100644 --- a/tests/dataset.py +++ b/tests/dataset.py @@ -169,7 +169,6 @@ private_keyed_scalars_template = { "telemetry.dynamic_event_counts": { "some#dynamic#event": SCALAR_VALUE } - } diff --git a/tests/test_service.py b/tests/test_service.py index b8a768d..fedc05d 100644 --- a/tests/test_service.py +++ b/tests/test_service.py @@ -150,7 +150,6 @@ class ServiceTestCase(unittest.TestCase): set(qs.keys()) ) - # Test response content. def test_cached_auth(self): token = "cached-token" @@ -191,7 +190,6 @@ class ServiceTestCase(unittest.TestCase): assert cache.get((url, False)).data != cache.get((url, True)).data - def test_response_cache_auth_first(self): token = 'cached-token' route = '/aggregates_by/build_id/channels/' @@ -222,7 +220,6 @@ class ServiceTestCase(unittest.TestCase): assert cache.get((url, False)).data != cache.get((url, True)).data - def test_clear_cache(self): route = '/aggregates_by/build_id/channels/' url = 'http://localhost' + route @@ -238,7 +235,6 @@ class ServiceTestCase(unittest.TestCase): assert cache.get((url, False)) is None - def test_auth_header(self): for metric in histograms_template.keys(): resp = self.app.get(