Skip to content

Commit

Permalink
fix the issue that prevents user from logging in on staging
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewinsoul committed Jul 31, 2019
2 parents 0320bb3 + 624cfd3 commit 6ca2201
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 18 deletions.
32 changes: 16 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,21 @@ workflows:
jobs:
- test
- deployBackend:
requires:
- test
filters:
branches:
only:
- master
- /release\/v[0-9].[0-9].[0-9]/
- staging
requires:
- test
filters:
branches:
only:
- master
- /release\/v[0-9].[0-9].[0-9]/
- staging

- deployFrontend:
requires:
- test
filters:
branches:
only:
- master
- /release\/v[0-9].[0-9].[0-9]/
- staging
requires:
- test
filters:
branches:
only:
- master
- /release\/v[0-9].[0-9].[0-9]/
- staging
1 change: 0 additions & 1 deletion server/graphql_schemas/tests/utils/test_helpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Module that tests helper methods"""
from unittest.mock import patch
from graphql_schemas.utils.helpers import update_event_status_on_calendar, remove_event_from_all_calendars
from api.models import AndelaUserProfile
from api.tests.base_test_setup import BaseSetup

class HelperTests(BaseSetup):
Expand Down
18 changes: 17 additions & 1 deletion server/graphql_schemas/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,27 @@ def normalize_dates(end_date, start_date, today_date):
else:
return {'status': True, 'message': 'Validation successful'}

def validate_event_dates(input):
"""
Validate date fields
:param input:
"""

event_tz = input.get('start_date').tzinfo
today_date = datetime.datetime.now(event_tz)
start_date = input.get('start_date')
end_date = input.get('end_date')

if start_date < today_date or end_date < today_date:
return {'status': False, 'message': 'Sorry, you cannot enter a past date'}
elif end_date < start_date:
return {'status': False, 'message': 'Sorry, end date must be after start date'}
else:
return {'status': True, 'message': 'Validation successful'}

def not_valid_timezone(timezone):
return timezone not in pytz.all_timezones


def _safe_filename(filename):
"""
Generates a safe filename that is unlikely to collide with existing objects
Expand Down

0 comments on commit 6ca2201

Please sign in to comment.