Skip to content

Commit

Permalink
Fix all flake8 errors found in current code
Browse files Browse the repository at this point in the history
  • Loading branch information
floatingatoll committed Jul 22, 2021
1 parent 4f765c3 commit 27f57e2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
8 changes: 4 additions & 4 deletions e2e/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def get_url_dict(self):

def get_secure_parameter(self, parameter_name):
"""Gets the desired secret for secureStrings only from AWS Parameter Store.
Arguments:
parameter_name {string} -- The name of the parameter not including the path
to retrieve from parameter store.
Returns:
[type] -- string literal decrypted value.
"""
Expand Down Expand Up @@ -83,11 +83,11 @@ def get_complex_structures(self):
def ensure_appropriate_publishers_and_sign(self, fake_profile, condition):
"""Workaround the fact the FakerUser generator does not always generate valid profiles.
Iterates over the attributes and ensures the profile will pass publisher rule validation.
Arguments:
fake_profile {object} -- A fake user object of cis_profile.profile.User() type.
condition {string} -- Takes update for create as a condition.
Returns:
[type] -- A user object of type cis_profile.profile.User() with valid publishers and signatures.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def get_all_by_page():

logger.debug("Total records retrieved: {}".format(len(results)))


def get_all_by_any():
setup_environment()
u = user.Profile(
Expand Down Expand Up @@ -72,6 +73,7 @@ def get_all_by_any():
logger.info("Total records retrieved: {}".format(len(results)))
logger.info("Total records retrieved: {}".format(len(results)))


def test_filtered_scan(benchmark):
#get_all_by_any()
# get_all_by_any()
benchmark.pedantic(get_all_by_any, iterations=1, rounds=1)
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def filtered_scan_wrapper():

logger.debug("Total records retrieved: {}".format(len(results)))


def filtered_scan_wrapper_inactive():
setup_environment()
u = user.Profile(
Expand All @@ -63,8 +64,10 @@ def filtered_scan_wrapper_inactive():

logger.debug("Total records retrieved: {}".format(len(results)))


def test_filtered_scan(benchmark):
benchmark.pedantic(filtered_scan_wrapper, iterations=1, rounds=1)


def test_filtered_scan_inactive(benchmark):
benchmark.pedantic(filtered_scan_wrapper_inactive, iterations=1, rounds=1)
benchmark.pedantic(filtered_scan_wrapper_inactive, iterations=1, rounds=1)
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def get(self, primary_email):
vault_profile = result["Items"][0]["profile"]
exists_in_cis = True
exists_in_ldap = User(user_structure_json=json.loads(vault_profile)) \
.as_dict()["access_information"]["ldap"]["values"] is not None
.as_dict()["access_information"]["ldap"]["values"] is not None

return jsonify({
"exists": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ def test_metadata_by_primary_email(self, fake_jwks):
follow_redirects=True,
)

assert query.json.get("exists").get("cis") == True
assert query.json.get("exists").get("ldap") == True
assert query.json.get("exists").get("cis") is True
assert query.json.get("exists").get("ldap") is True

@patch("cis_profile_retrieval_service.idp.get_jwks")
def test_find_by_x_active_true(self, fake_jwks):
Expand Down
4 changes: 2 additions & 2 deletions serverless-functions/identity_vault_curator/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ def handle(event=None, context={}):
v.connect()
v.find_or_create()
# XXX TBD if found. Call create backup. Support a backup and restore across tables.
v.tag_vault() # Vault tagging is critical to the service discovery layer. Probably should raise and alert if it fails.
v.tag_vault() # Vault tagging is critical to the service discovery layer. Probably should raise and alert if it fails.
v.setup_stream()
return 200
return 200

0 comments on commit 27f57e2

Please sign in to comment.