Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #38 from skoudoro/update-ci
Browse files Browse the repository at this point in the history
Update CI and improve some tests
  • Loading branch information
skoudoro authored Jan 9, 2022
2 parents 28167ce + cb56394 commit dc273d4
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, '3.10']
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, '3.10']
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
Expand Down
2 changes: 2 additions & 0 deletions mailerlite/tests/test_campaign.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def test_cancel_send_campaign(header):

if campaign_obj.count('outbox'):
res = campaign_obj.all(status='outbox', limit=5)
if not res:
pytest.skip("No campaign found with outbox status")
assert res[0].status == 'outbox'
code, res_2 = campaign_obj.cancel(res[0].id)
assert code == 200
Expand Down
41 changes: 31 additions & 10 deletions mailerlite/tests/test_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,26 @@ def test_groups_subscriber(header):
groups = Groups(header)

n_groups = groups.all()
assert len(n_groups) > 0
group_1 = n_groups[0]

if not len(n_groups):
pytest.skip("No groups found")

group_ix = random.randint(0, len(n_groups))
try:
group_1 = n_groups[group_ix]
except IndexError:
pytest.skip("Group index not found. Maybe deleted by another thread")

subs_in_group_1 = groups.subscribers(group_1.id)
assert len(subs_in_group_1) > 0

sub1 = subs_in_group_1[0]
if not len(subs_in_group_1):
pytest.skip("No subscriber found in this group.")

try:
sub1 = subs_in_group_1[0]
except IndexError:
pytest.skip("Subscriber not found. Maybe deleted by another thread")

tmp_sub = groups.subscriber(group_1.id, sub1.id)

assert sub1.email == tmp_sub.email
Expand All @@ -102,7 +115,6 @@ def test_groups_subscriber(header):
else:
break

print(new_subs)
if new_subs:
assert new_subs[0].email == mail

Expand All @@ -121,13 +133,23 @@ def test_groups_single_subscriber(header):
groups = Groups(header)

n_groups = groups.all()
assert len(n_groups) > 0
group_1 = n_groups[0]
if not len(n_groups):
pytest.skip("No groups found")

try:
group_1 = n_groups[0]
except IndexError:
pytest.skip("Group index not found. Maybe deleted by another thread")

subs_in_group_1 = groups.subscribers(group_1.id)
assert len(subs_in_group_1) > 0
if not len(subs_in_group_1):
pytest.skip("No subscriber found in this group.")

try:
sub1 = subs_in_group_1[0]
except IndexError:
pytest.skip("Subscriber not found. Maybe deleted by another thread")

sub1 = subs_in_group_1[0]
tmp_sub = groups.subscriber(group_1.id, sub1.id)

assert sub1.email == tmp_sub.email
Expand All @@ -146,7 +168,6 @@ def test_groups_single_subscriber(header):
else:
break

print(new_sub)
if new_sub:
assert new_sub.email == mail

Expand Down

0 comments on commit dc273d4

Please sign in to comment.