Skip to content

Commit 6087de8

Browse files
Added workflow dispatch for various log levels
1 parent 9e6e512 commit 6087de8

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

.github/workflows/test.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ on:
55
- cron: "0 4 * * *"
66
pull_request:
77
workflow_dispatch:
8+
inputs:
9+
logLevel:
10+
description: 'Log level'
11+
required: true
12+
default: 'WARNING'
13+
type: choice
14+
options:
15+
- WARNING
16+
- DEBUG
817

918
jobs:
1019
deploy:
@@ -50,9 +59,16 @@ jobs:
5059
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
5160
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
5261
BW_NUMBER_PROVIDER: ${{ secrets.BW_NUMBER_PROVIDER }}
62+
LEVEL: ${{ inputs.logLevel }}
5363

5464
run: |
55-
pytest -v
65+
echo "Log level: $LEVEL"
66+
if [$LEVEL -eq DEBUG ]
67+
then
68+
pytest -v --log-cli-level=DEBUG
69+
else
70+
pytest -v --log-cli-level=WARNING
71+
fi
5672
- name: Notify Slack of Failures
5773
uses: Bandwidth/[email protected]
5874
if: failure() && !github.event.pull_request.draft

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
max-line-length=99
33
[tool:pytest]
44
log_cli = True
5-
log_cli_level=DEBUG
65
log_file = logs/pytest-logs.txt
76
junit_logging = system-out

test/integration/test_media_api.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import uuid
66
import filecmp
77
import unittest
8+
import logging
89

910
import bandwidth
1011
from bandwidth.api import media_api
@@ -56,6 +57,7 @@ def uploadMedia(self) -> None:
5657
_return_http_data_only=False
5758
)
5859

60+
logging.debug(api_response_with_http_info)
5961
self.assertEqual(api_response_with_http_info[1], 204)
6062

6163
# reopen the media file
@@ -81,6 +83,7 @@ def listMedia(self) -> None:
8183
self.assertEqual(api_response_with_http_info[1], 200)
8284

8385
api_response = self.api_instance.list_media(self.account_id)
86+
logging.debug("List Media" + str(api_response))
8487

8588
self.assertIs(type(api_response[0]), Media)
8689
pass
@@ -91,6 +94,7 @@ def getMedia(self) -> None:
9194
api_response_with_http_info = self.api_instance.get_media(
9295
self.account_id, self.media_id, _return_http_data_only=False)
9396

97+
logging.debug(api_response_with_http_info)
9498
self.assertEqual(api_response_with_http_info[1], 200)
9599

96100
api_response = self.api_instance.get_media(
@@ -109,6 +113,7 @@ def deleteMedia(self) -> None:
109113
api_response_with_http_info = self.api_instance.delete_media(
110114
self.account_id, self.media_id, _return_http_data_only=False)
111115

116+
logging.debug(api_response_with_http_info)
112117
self.assertEqual(api_response_with_http_info[1], 204)
113118

114119
# returns void
@@ -138,4 +143,4 @@ def testGetMediaWithBandwidthId(self) -> None:
138143
_preload_content=False
139144
)
140145

141-
self.assertEqual(context.exception.status, 404)
146+
self.assertEqual(context.exception.status, 404)

0 commit comments

Comments
 (0)