Skip to content

Commit

Permalink
Expand the integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rwood-moz committed Jan 15, 2025
1 parent 0a71d46 commit f49e8df
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
16 changes: 16 additions & 0 deletions backend/test/integration/test_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,22 @@ def test_connect_more_calendars_than_tier_allows(
response = with_client.post(f'/cal/{cal[2].id}/connect', headers=auth_headers)
assert response.status_code == 403, response.text

def test_create_connection_failure(self, with_client, make_google_calendar, request):
"""Attempt to create google calendar connection without having external connection, expect failure"""
response = with_client.post(
'/cal',
json={
'title': 'A google calendar',
'color': '#123456',
'provider': CalendarProvider.google.value,
'url': 'test',
'user': 'test',
'password': 'test',
},
headers=auth_headers,
)
assert response.status_code == 400, response.text


class TestCaldav:
"""Tests for caldav specific functionality"""
Expand Down
36 changes: 36 additions & 0 deletions backend/test/integration/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def test_health_for_locale(self, with_client):
def test_access_without_authentication_token(self, with_client):
# response = client.get("/login")
# assert response.status_code == 401
response = with_client.get('/me')
assert response.status_code == 401
response = with_client.put('/me')
assert response.status_code == 401
response = with_client.get('/me/calendars')
Expand All @@ -52,18 +54,52 @@ def test_access_without_authentication_token(self, with_client):
assert response.status_code == 401
response = with_client.delete('/cal/1')
assert response.status_code == 401
response = with_client.post('/caldav/auth')
assert response.status_code == 401
response = with_client.post('/caldav/disconnect')
assert response.status_code == 401
response = with_client.post('/rmt/calendars')
assert response.status_code == 401
response = with_client.get('/rmt/cal/1/' + DAY1 + '/' + DAY5)
assert response.status_code == 401
response = with_client.post('/rmt/sync')
assert response.status_code == 401
response = with_client.get('/account/available-emails')
assert response.status_code == 401
response = with_client.get('/account/download')
assert response.status_code == 401
response = with_client.get('/account/external-connections/')
assert response.status_code == 401
response = with_client.delete('/account/delete')
assert response.status_code == 401
response = with_client.get('/google/auth')
assert response.status_code == 401
response = with_client.post('/google/disconnect')
assert response.status_code == 401
response = with_client.post('/schedule')
assert response.status_code == 401
response = with_client.get('/schedule')
assert response.status_code == 401
response = with_client.get('/schedule/0')
assert response.status_code == 401
response = with_client.put('/schedule/0')
assert response.status_code == 401
response = with_client.get('/invite')
assert response.status_code == 401
response = with_client.post('/invite/generate/1')
assert response.status_code == 401
response = with_client.put('/invite/revoke/1')
assert response.status_code == 401
response = with_client.get('/subscriber')
assert response.status_code == 401
response = with_client.put('/subscriber/enable/[email protected]')
assert response.status_code == 401
response = with_client.put('/subscriber/disable/[email protected]')
assert response.status_code == 401
response = with_client.post('/subscriber/setup')
assert response.status_code == 401
response = with_client.post('/waiting-list/invite')
assert response.status_code == 401

def test_send_feedback(self, with_client):
response = with_client.post(
Expand Down
15 changes: 15 additions & 0 deletions backend/test/integration/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,18 @@ def test_signed_short_link_refresh(self, with_client):
assert response.status_code == 200, response.text
url_new = response.json()['url']
assert url_old != url_new

def test_update_me_username_taken(self, with_db, with_client, make_pro_subscriber):
"""Attempt to update current subscriber's profile with already existing username"""
other_subscriber = make_pro_subscriber(username='thunderbird1')

response = with_client.put(
'/me',
json={
'username': 'thunderbird1',
'name': 'Changed Name',
'secondary_email': '[email protected]',
},
headers=auth_headers,
)
assert response.status_code == 403, response.text

0 comments on commit f49e8df

Please sign in to comment.