Skip to content

Commit

Permalink
Fixed pipeline for test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Subhransu Das committed May 31, 2024
1 parent 0b901df commit 3630f45
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
export FCM_TEST_API_KEY=AAA
export FCM_TEST_PROJECT_ID=test
pytest
8 changes: 7 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
requests>=2.6.0
aiohttp>=3.6.2
cachetools==5.3.3
google-auth==2.29.0
pyasn1==0.6.0
pyasn1-modules==0.4.0
rsa==4.9
requests>=2.6.0
urllib3==1.26.5

19 changes: 5 additions & 14 deletions tests/test_v1_baseapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ def base_api():
return BaseAPI(service_account_file_path=service_account_file_path, project_id=project_id)


def test_init_baseapi():
try:
BaseAPI()
assert False, "Should raise AuthenticationError"
except errors.AuthenticationError:
pass


def test_parse_payload(base_api):
json_string = base_api.parse_payload(
registration_ids=["Test"],
Expand Down Expand Up @@ -53,21 +45,20 @@ def test_parse_payload(base_api):
)

data = json.loads(json_string.decode("utf-8"))

assert data["notification"] == {
assert data["message"]["notification"] == {
"android_channel_id": "Test",
"body": "Test",
"badge": "Test", "body": "Test",
"click_action": "Test",
"color": "Test",
"extra_kwargs": {},
"extra_notification_kwargs": {},
"icon": "Test",
"sound": "Test",
"tag": "Test",
"timeout": 5,
"title": "Test"
}

assert 'time_to_live' in data
assert data['time_to_live'] == 0


def test_parse_responses(base_api):
response = base_api.parse_responses()
Expand Down

0 comments on commit 3630f45

Please sign in to comment.