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

fix: updates to testing related to v4.60 changes #61

Merged
merged 3 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def api_env():

@pytest.fixture(scope="session")
def random_text():
return "".join(random.choice(string.ascii_uppercase + string.digits) for _ in range(8))
return "".join(random.choice(string.ascii_uppercase) for _ in range(8))


@pytest.fixture(scope="session")
Expand Down
2 changes: 1 addition & 1 deletion tests/api/v2/test_activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TestActivitiesEndpoint(SearchEndpoint):
OBJECT_TYPE = ActivitiesAPI
OBJECT_MAP = {
"changed_files": ChangedFilesAPI,
"connections": ConnectionsAPI,
# "connections": ConnectionsAPI,
"dns": DnsAPI,
"user_logins": UserLoginsAPI
}
5 changes: 2 additions & 3 deletions tests/api/v2/test_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def api_object_create_body(random_text, query):
"remediation": "Policy remediation",
"severity": "high",
"alert_enabled": True,
"alert_profile": "LW_CloudTrail_Alerts",
"evaluator_id": query["evaluatorId"]
"alert_profile": "LW_CloudTrail_Alerts"
}


Expand All @@ -44,7 +43,7 @@ def api_object_update_body():
@pytest.fixture(scope="module")
def query(api):
queries = api.queries.get()
queries = list(filter(lambda elem: elem["owner"] == "Lacework", queries["data"]))
queries = list(filter(lambda elem: elem["owner"] == "Lacework" and "LW_Global_AWS_CTA" in elem["queryId"], queries["data"]))
query = random.choice(queries)
return query

Expand Down
5 changes: 2 additions & 3 deletions tests/api/v2/test_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def api_object(api):
@pytest.fixture(scope="module")
def api_object_create_body(random_text):
return {
"evaluator_id": "Cloudtrail",
"query_id": random_text,
"query_text": f"""{random_text} {{
source {{CloudTrailRawEvents e}}
Expand All @@ -45,7 +44,7 @@ def api_object_update_body(random_text):
@pytest.fixture(scope="module")
def query(api):
queries = api.queries.get()
queries = list(filter(lambda elem: elem["owner"] == "Lacework", queries["data"]))
queries = list(filter(lambda elem: elem["owner"] == "Lacework" and "LW_Global_AWS_CTA" in elem["queryId"], queries["data"]))
query = random.choice(queries)
return query

Expand All @@ -70,7 +69,7 @@ def test_queries_api_execute_by_id(self, api_object, query):
assert "data" in response.keys()

def test_queries_api_validate(self, api_object, query):
response = api_object.validate(evaluator_id=query["evaluatorId"], query_text=query["queryText"])
response = api_object.validate(query_text=query["queryText"])
assert "data" in response.keys()

def test_api_search(self):
Expand Down