Skip to content
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: 0 additions & 2 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ on:
TEST_API_KEY:
required: true
push:
branches:
- "*"

jobs:
call-unit-tests-coverage:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
python-version: "3.12"

- name: Install build packages
run: pip install coverage build
run: pip install coverage build python-dotenv

- name: Execute Unit Tests
run: |
Expand Down
5 changes: 4 additions & 1 deletion cxone_api/high/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ async def __get_primary_branch_from_repomgr_config(self):
if cfg is not None:
if "branches" in cfg.keys():
for b in cfg['branches']:
if "isDefaultBranch" in b.keys() and bool(b['isDefaultBranch']):
# Select the default branch as specified in the scm or the first branch
# if only one protected branch is specified.
if ("isDefaultBranch" in b.keys() and bool(b['isDefaultBranch'])) \
or len(cfg['branches']) == 1:
if "name" in b.keys():
return b['name']
return ""
Expand Down
4 changes: 4 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import time
from cxone_api.high.scans import ScanLoader
from cxone_api import CxOneClient, AuthRegionEndpoints, ApiRegionEndpoints
from dotenv import load_dotenv

class BaseTest(unittest.IsolatedAsyncioTestCase):
DEFAULT_REPO = "https://github.com/nleach999/SimplyVulnerable.git"
Expand All @@ -12,6 +13,9 @@ class BaseTest(unittest.IsolatedAsyncioTestCase):

@classmethod
def setUpClass(cls):

load_dotenv()

api_endpoint = ApiRegionEndpoints[os.environ['TEST_REGION']]()
iam_endpoint = AuthRegionEndpoints[os.environ['TEST_REGION']](os.environ['TEST_TENANT_ID'])

Expand Down
2 changes: 1 addition & 1 deletion tests/test_low_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async def asyncSetUp(self):
apps_resp = await apps.retrieve_applications_info(self.client_oauth,
name=TestLowApplications.DEFAULT_APP_NAME)

if apps_resp.ok and apps_resp.json()['applications'] is None:
if apps_resp.ok and len(apps_resp.json()['applications']) == 0:
app_create_resp = await apps.create_an_application(self.client_oauth,
name=TestLowApplications.DEFAULT_APP_NAME,
description="regression testing purposes")
Expand Down
Loading