Repository: mozilla-iam/cis (language: python)

Issue:
Replace travis-ci.org with GitHub Actions
The old CI system went away a week or so ago, and per team discussion and in order to unblock #528, we're going to switch this specific repository to GitHub Actions and get CI working again.

Hi, reviewers. This pull request is complicated, as in order to prove that I've repaired the CI system, I also need to incorporate several changes to both the Dockerfile and the CIS code itself.

In this PR, please review _only_ the one unique commit in this PR, 44c79a2, which is not present in any other pull request; it simply removes the Travis CI config and adds the GitHub Actions config. The final push of this pull request will contain only that one unique commit; everything else below is _temporarily_ included from the following pull requests, to demonstrate (as seen below) that CI passes once it's all put together; it's all general repair work that isn't specific to Travis CI or GitHub Actions:

- #534 
- #529 
- #530 


Discussion / hints:

Fix patch:
diff --git a/python-modules/cis_profile_retrieval_service/cis_profile_retrieval_service/v2_api.py b/python-modules/cis_profile_retrieval_service/cis_profile_retrieval_service/v2_api.py
index 3f58c2c1..e16761a4 100644
--- a/python-modules/cis_profile_retrieval_service/cis_profile_retrieval_service/v2_api.py
+++ b/python-modules/cis_profile_retrieval_service/cis_profile_retrieval_service/v2_api.py
@@ -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": {
diff --git a/serverless-functions/identity_vault_curator/handler.py b/serverless-functions/identity_vault_curator/handler.py
index 0e0b0de9..f9a4e7fc 100644
--- a/serverless-functions/identity_vault_curator/handler.py
+++ b/serverless-functions/identity_vault_curator/handler.py
@@ -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
\ No newline at end of file
+    return 200


Test patch:
diff --git a/e2e/helpers.py b/e2e/helpers.py
index 0d732d70..118003e0 100644
--- a/e2e/helpers.py
+++ b/e2e/helpers.py
@@ -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.
         """
@@ -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.
         """
diff --git a/python-modules/cis_identity_vault/integration_tests/test_all_users.py b/python-modules/cis_identity_vault/integration_tests/test_all_users.py
index 04602e47..0236db11 100644
--- a/python-modules/cis_identity_vault/integration_tests/test_all_users.py
+++ b/python-modules/cis_identity_vault/integration_tests/test_all_users.py
@@ -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(
@@ -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)
diff --git a/python-modules/cis_identity_vault/integration_tests/test_scan_speed.py b/python-modules/cis_identity_vault/integration_tests/test_scan_speed.py
index 04d7b4d6..32ad843e 100644
--- a/python-modules/cis_identity_vault/integration_tests/test_scan_speed.py
+++ b/python-modules/cis_identity_vault/integration_tests/test_scan_speed.py
@@ -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(
@@ -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)
\ No newline at end of file
+    benchmark.pedantic(filtered_scan_wrapper_inactive, iterations=1, rounds=1)
diff --git a/python-modules/cis_profile_retrieval_service/tests/test_v2_api.py b/python-modules/cis_profile_retrieval_service/tests/test_v2_api.py
index e539aa48..b7aba0e0 100644
--- a/python-modules/cis_profile_retrieval_service/tests/test_v2_api.py
+++ b/python-modules/cis_profile_retrieval_service/tests/test_v2_api.py
@@ -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):