diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f16ae2be3..20a87769b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ##### v1.8.0 (Unreleased): -- No Changes +- Run `python manage.py fix_digit_identifier` to correct all digit identifiers ##### v1.7.0 (2019-10-19): diff --git a/README.md b/README.md index 7fcc69f2ca..1ca1c03aa1 100644 --- a/README.md +++ b/README.md @@ -51,9 +51,9 @@ The Open Event Server can be easily deployed on a variety of platforms. Detailed 1. [Deployment on Heroku](/docs/installation/heroku.md) -One-click Heroku and Docker deployments are also available: +One-click Heroku deployment is also available: -[![Deploy to Docker Cloud](https://files.cloud.docker.com/images/deploy-to-dockercloud.svg)](https://cloud.docker.com/stack/deploy/?repo=https://github.com/fossasia/open-event-server) [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) ## Technology Stack diff --git a/app/api/helpers/jwt.py b/app/api/helpers/jwt.py index 239f52879f..324a3e86eb 100644 --- a/app/api/helpers/jwt.py +++ b/app/api/helpers/jwt.py @@ -39,7 +39,7 @@ def get_identity(): """ token = None try: - token = _decode_jwt_from_request('access') + token, header = _decode_jwt_from_request('access') except (JWTExtendedException, PyJWTError): token = getattr(ctx_stack.top, 'expired_jwt', None) diff --git a/app/api/schema/tickets.py b/app/api/schema/tickets.py index c39d3fdecd..62183a2c8d 100644 --- a/app/api/schema/tickets.py +++ b/app/api/schema/tickets.py @@ -67,6 +67,12 @@ def validate_quantity(self, data): raise UnprocessableEntity({'pointer': '/data/attributes/quantity'}, "quantity should be greater than or equal to max-order") + @validates_schema + def validate_price(self, data): + if data['type'] == 'paid' and ('price' not in data or data['price'] <= 0): + raise UnprocessableEntity({'pointer': 'data/attributes/price'}, + "paid ticket price should be greater than 0") + @validates_schema(pass_original=True) def validate_discount_code(self, data, original_data): if 'relationships' in original_data and 'discount-codes' in original_data['data']['relationships']: diff --git a/app/api/server_version.py b/app/api/server_version.py index dc7a67f28c..33908ef728 100644 --- a/app/api/server_version.py +++ b/app/api/server_version.py @@ -1,6 +1,6 @@ from flask import jsonify, Blueprint -SERVER_VERSION = '1.7.0' +SERVER_VERSION = '1.8.0' info_route = Blueprint('info', __name__) _build = {'version': SERVER_VERSION} diff --git a/app/api/speakers.py b/app/api/speakers.py index b4465df13f..e8b41d65e4 100644 --- a/app/api/speakers.py +++ b/app/api/speakers.py @@ -47,10 +47,10 @@ def before_post(self, args, kwargs, data=None): deleted_at=None)) > 0: raise ForbiddenException({'pointer': ''}, 'Speaker with this Email ID already exists') - if data.get('is_email_overriden') and not has_access('is_organizer', event_id=data['event']): - raise ForbiddenException({'pointer': 'data/attributes/is_email_overriden'}, + if data.get('is_email_overridden') and not has_access('is_organizer', event_id=data['event']): + raise ForbiddenException({'pointer': 'data/attributes/is_email_overridden'}, 'Organizer access required to override email') - elif data.get('is_email_overriden') and has_access('is_organizer', event_id=data['event']) and \ + elif data.get('is_email_overridden') and has_access('is_organizer', event_id=data['event']) and \ not data.get('email'): data['email'] = current_user.email @@ -135,10 +135,10 @@ def before_update_object(self, speaker, data, view_kwargs): if data.get('photo_url') and data['photo_url'] != speaker.photo_url: start_image_resizing_tasks(speaker, data['photo_url']) - if data.get('is_email_overriden') and not has_access('is_organizer', event_id=speaker.event_id): - raise ForbiddenException({'pointer': 'data/attributes/is_email_overriden'}, + if data.get('is_email_overridden') and not has_access('is_organizer', event_id=speaker.event_id): + raise ForbiddenException({'pointer': 'data/attributes/is_email_overridden'}, 'Organizer access required to override email') - elif data.get('is_email_overriden') and has_access('is_organizer', event_id=speaker.event_id) and \ + elif data.get('is_email_overridden') and has_access('is_organizer', event_id=speaker.event_id) and \ not data.get('email'): data['email'] = current_user.email diff --git a/app/models/event.py b/app/models/event.py index 50aa222658..d30e5bea32 100644 --- a/app/models/event.py +++ b/app/models/event.py @@ -28,8 +28,7 @@ def get_new_event_identifier(length=8): identifier = str(binascii.b2a_hex(os.urandom(int(length / 2))), 'utf-8') - count = get_count(Event.query.filter_by(identifier=identifier)) - if count == 0: + if not identifier.isdigit() and get_count(Event.query.filter_by(identifier=identifier)) == 0: return identifier else: return get_new_event_identifier(length) @@ -364,7 +363,7 @@ def get_average_rating(self): def is_payment_enabled(self): return self.can_pay_by_paypal or self.can_pay_by_stripe or self.can_pay_by_omise or self.can_pay_by_alipay \ - or self.can_pay_by_cheque or self.can_pay_by_bank or self.can_pay_onsite or self.can_pay_by_paytm + or self.can_pay_by_cheque or self.can_pay_by_bank or self.can_pay_onsite or self.can_pay_by_paytm @property def average_rating(self): @@ -455,7 +454,6 @@ def has_speakers(self): return Speaker.query.filter_by(event_id=self.id).count() > 0 - @event.listens_for(Event, 'after_update') @event.listens_for(Event, 'after_insert') def receive_init(mapper, connection, target): diff --git a/app/models/ticket.py b/app/models/ticket.py index 9e5bdb59a8..da91b9c6a7 100644 --- a/app/models/ticket.py +++ b/app/models/ticket.py @@ -14,7 +14,7 @@ db.Column('ticket_id', db.Integer, db.ForeignKey('tickets.id', ondelete='CASCADE')), db.PrimaryKeyConstraint('discount_code_id', 'ticket_id')) -ticket_tags_table = db.Table('association', db.Model.metadata, +ticket_tags_table = db.Table('ticket_tagging', db.Model.metadata, db.Column('ticket_id', db.Integer, db.ForeignKey('tickets.id', ondelete='CASCADE')), db.Column('ticket_tag_id', db.Integer, db.ForeignKey('ticket_tag.id', ondelete='CASCADE')) ) diff --git a/docs/api/blueprint/attendees.apib b/docs/api/blueprint/attendees.apib index 2103ea6975..2dbd1498ab 100644 --- a/docs/api/blueprint/attendees.apib +++ b/docs/api/blueprint/attendees.apib @@ -261,6 +261,200 @@ Get a list of attendees of an order. "self": "/v1/orders/7201904e-c695-4251-a30a-61765a37ff24/attendees" } } + +## List Attendees under an event [/v1/events/{event_id}/attendees] ++ Parameters + + event_id: 1 (integer) - Identifier of the event + +### List All Attendees under an event [GET] +Get a list of attendees of an event. + ++ Request + + + Headers + + Accept: application/vnd.api+json + + Authorization: JWT + ++ Response 200 (application/vnd.api+json) + + { + "meta": { + "count": 1 + }, + "data": [ + { + "relationships": { + "ticket": { + "links": { + "self": "/v1/attendees/1/relationships/ticket", + "related": "/v1/attendees/1/ticket" + } + }, + "order": { + "links": { + "self": "/v1/attendees/1/relationships/order", + "related": "/v1/attendees/1/order" + } + }, + "event": { + "links": { + "self": "/v1/attendees/1/relationships/event", + "related": "/v1/attendees/1/event" + } + }, + "user": { + "links": { + "self": "/v1/attendees/1/relationships/user", + "related": "/v1/attendees/1/user" + } + } + }, + "attributes": { + "facebook": null, + "address": "address", + "ticket-id": "31", + "is-checked-out": null, + "checkout-times": null, + "job-title": null, + "deleted-at": null, + "work-address": null, + "checkin-times": null, + "state": "example", + "country": "IN", + "lastname": "UnDoe", + "city": "example", + "phone": null, + "company": null, + "is-checked-in": false, + "gender": null, + "shipping-address": null, + "blog": null, + "firstname": "John", + "website": null, + "billing-address": null, + "pdf-url": null, + "tax-business-info": null, + "home-address": null, + "work-phone": null, + "birth-date": null, + "github": null, + "twitter": null, + "email": "johndoe@example.com", + "attendee-notes": null + }, + "type": "attendee", + "id": "1", + "links": { + "self": "/v1/attendees/1" + } + } + ], + "jsonapi": { + "version": "1.0" + }, + "links": { + "self": "/v1/events/1/attendees" + } + } + +## List Attendees under a ticket [/v1/tickets/{ticket_id}/attendees] ++ Parameters + + ticket_id: 1 (integer) - Identifier of the event + +### List All Attendees under a ticket [GET] +Get a list of attendees of a ticket. + ++ Request + + + Headers + + Accept: application/vnd.api+json + + Authorization: JWT + ++ Response 200 (application/vnd.api+json) + + { + "meta": { + "count": 1 + }, + "data": [ + { + "relationships": { + "ticket": { + "links": { + "self": "/v1/attendees/1/relationships/ticket", + "related": "/v1/attendees/1/ticket" + } + }, + "order": { + "links": { + "self": "/v1/attendees/1/relationships/order", + "related": "/v1/attendees/1/order" + } + }, + "event": { + "links": { + "self": "/v1/attendees/1/relationships/event", + "related": "/v1/attendees/1/event" + } + }, + "user": { + "links": { + "self": "/v1/attendees/1/relationships/user", + "related": "/v1/attendees/1/user" + } + } + }, + "attributes": { + "facebook": null, + "address": "address", + "ticket-id": "1", + "is-checked-out": null, + "checkout-times": null, + "job-title": null, + "deleted-at": null, + "work-address": null, + "checkin-times": null, + "state": "example", + "country": "IN", + "lastname": "UnDoe", + "city": "example", + "phone": null, + "company": null, + "is-checked-in": false, + "gender": null, + "shipping-address": null, + "blog": null, + "firstname": "John", + "website": null, + "billing-address": null, + "pdf-url": null, + "tax-business-info": null, + "home-address": null, + "work-phone": null, + "birth-date": null, + "github": null, + "twitter": null, + "email": "johndoe@example.com", + "attendee-notes": null + }, + "type": "attendee", + "id": "1", + "links": { + "self": "/v1/attendees/1" + } + } + ], + "jsonapi": { + "version": "1.0" + }, + "links": { + "self": "/v1/tickets/1/attendees" + } + } ## Attendee Details [/v1/attendees/{attendee_id}] + Parameters diff --git a/docs/api/blueprint/auth/email_verification.apib b/docs/api/blueprint/auth/email_verification.apib index 63fd2bca96..791d190ea1 100644 --- a/docs/api/blueprint/auth/email_verification.apib +++ b/docs/api/blueprint/auth/email_verification.apib @@ -27,3 +27,28 @@ Sends the token to verify the account associated with the provided email id via { "message": "Verification email resent" } + +## Verify Email [/v1/auth/verify-email] + +### Verify the email via auth token [POST] +Verifies the user email via token. + ++ Request + + + Headers + + Content-Type: application/json + + + Body + + { + "data": { + "token": "your token" + } + } + ++ Response 200 (application/json) + + { + "message": "Email Verified" + } diff --git a/docs/api/blueprint/order/orders.apib b/docs/api/blueprint/order/orders.apib index 7f3f99ae66..049d17b973 100644 --- a/docs/api/blueprint/order/orders.apib +++ b/docs/api/blueprint/order/orders.apib @@ -329,7 +329,7 @@ Update a single custom form with `id`. "order-notes": "example" }, "type": "order", - "id": "ab25a170-f36d-4dd6-b99c-9c202e693afc" + "id": "1" } } diff --git a/docs/installation/local.md b/docs/installation/local.md index 73a789ddf8..9837aa4f76 100644 --- a/docs/installation/local.md +++ b/docs/installation/local.md @@ -93,7 +93,7 @@ pipenv shell ``` -* **Step 2** - Create the database. For that we first open the psql shell. Go the directory where your postgres file is stored. +* **Step 2** - Create the database. For that we first open the psql shell. Go to the directory where your postgres file is stored. ```sh # For linux users diff --git a/manage.py b/manage.py index e823f8aefa..9593e05e23 100644 --- a/manage.py +++ b/manage.py @@ -21,7 +21,7 @@ def list_routes(): output = [] for rule in app.url_map.iter_rules(): methods = ','.join(rule.methods) - line = urllib.unquote("{:50s} {:20s} {}".format( + line = urllib.parse.unquote("{:50s} {:20s} {}".format( rule.endpoint, methods, rule)) output.append(line) @@ -37,6 +37,15 @@ def add_event_identifier(): save_to_db(event) +@manager.command +def fix_digit_identifier(): + events = Event.query.filter(Event.identifier.op('~')('^[0-9\.]+$')).all() + for event in events: + event.identifier = get_new_event_identifier() + db.session.add(event) + db.session.commit() + + @manager.option('-n', '--name', dest='name', default='all') @manager.option('-s', '--switch', dest='switch', default='off') def module(name, switch): diff --git a/migrations/versions/rev-2019-10-18-15:36:50-9effd270a6ae_association_table_name_change.py b/migrations/versions/rev-2019-10-18-15:36:50-9effd270a6ae_association_table_name_change.py new file mode 100644 index 0000000000..2eaee5915d --- /dev/null +++ b/migrations/versions/rev-2019-10-18-15:36:50-9effd270a6ae_association_table_name_change.py @@ -0,0 +1,24 @@ +"""association table name change + +Revision ID: 9effd270a6ae +Revises: 7c32ba647a18 +Create Date: 2019-10-18 15:36:50.302138 + +""" + +from alembic import op +import sqlalchemy as sa +import sqlalchemy_utils + + +# revision identifiers, used by Alembic. +revision = '9effd270a6ae' +down_revision = '7c32ba647a18' + + +def upgrade(): + op.rename_table('association', 'ticket_tagging') + + +def downgrade(): + op.rename_table('ticket_tagging', 'association') diff --git a/requirements/common.txt b/requirements/common.txt index f55568ecf5..eed89e4ec6 100644 --- a/requirements/common.txt +++ b/requirements/common.txt @@ -6,32 +6,32 @@ Flask-SQLAlchemy~=2.4 Flask-Migrate~=2.5 Flask-Login~=0.4 Flask-Scrypt~=0.1.3 -flask-jwt-extended~=3.23.0 +flask-jwt-extended~=3.24.1 flask-celeryext~=0.3 omise~=0.8.1 -requests-oauthlib~=1.2 +requests-oauthlib~=1.3 icalendar~=4.0.3 requests[security]~=2.22 -psycopg2-binary~=2.8.3 -SQLAlchemy-Utils~=0.34.2 +psycopg2-binary~=2.8.4 +SQLAlchemy-Utils~=0.35.0 itsdangerous~=1.1 humanize~=0.5.1 celery~=4.3 redis~=3.3 -apscheduler~=3.6.1 -pillow~=6.2.0 -gunicorn~=19.9 +apscheduler~=3.6.3 +pillow~=6.2.1 +gunicorn~=20.0 boto~=2.49 geoip2~=2.9.0 SQLAlchemy-Continuum~=1.3.9 -arrow~=0.15.2 +arrow~=0.15.4 unicode-slugify~=0.1 bleach~=3.1 -stripe~=2.37.2 +stripe~=2.40.0 xhtml2pdf~=0.2 flask-caching~=1.4 forex-python~=1.5 -pycryptodome~=3.9.0 +pycryptodome~=3.9.4 oauth2~=1.9 qrcode~=6.1 python-magic~=0.4 @@ -39,7 +39,7 @@ python-dotenv~=0.10.3 python-geoip~=1.2 marrow.mailer~=4.0 flask-cors~=3.0.8 -python-pentabarf-xml==0.19 # leave versions untouched. +python-pentabarf-xml==0.20 # leave versions untouched. python-geoip-geolite2 pycountry pytz @@ -53,9 +53,9 @@ google-compute-engine~=2.8 factory_boy~=2.12 sentry-sdk[flask]~=0.13 healthcheck~=1.3 -elasticsearch-dsl~=7.0 +elasticsearch-dsl~=7.0.0 flask-redis~=0.4 -SQLAlchemy~=1.3.10 +SQLAlchemy~=1.3.11 Flask-Elasticsearch~=0.2 paypalrestsdk~=1.13 eventlet~=0.25 diff --git a/tests/all/integration/api/helpers/test_auth.py b/tests/all/integration/api/helpers/test_auth.py index 5fb2978835..cf0e04931b 100644 --- a/tests/all/integration/api/helpers/test_auth.py +++ b/tests/all/integration/api/helpers/test_auth.py @@ -11,8 +11,6 @@ class TestAuthentication(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_load_user(self): """Method to test the registered user details""" diff --git a/tests/all/integration/api/helpers/test_csv_jobs_util.py b/tests/all/integration/api/helpers/test_csv_jobs_util.py index 1602816931..58661c1bd9 100644 --- a/tests/all/integration/api/helpers/test_csv_jobs_util.py +++ b/tests/all/integration/api/helpers/test_csv_jobs_util.py @@ -15,8 +15,6 @@ class TestExportCSV(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_export_orders_csv(self): """Method to check the orders data export""" diff --git a/tests/all/integration/api/helpers/test_db.py b/tests/all/integration/api/helpers/test_db.py index 4c46f8a446..c0d8bf0719 100644 --- a/tests/all/integration/api/helpers/test_db.py +++ b/tests/all/integration/api/helpers/test_db.py @@ -13,8 +13,6 @@ class TestDBHelperValidation(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_save_to_db(self): """Method to test the function save_to_db""" diff --git a/tests/all/integration/api/helpers/test_errors.py b/tests/all/integration/api/helpers/test_errors.py index 333cd1b31f..8eb3abcfca 100644 --- a/tests/all/integration/api/helpers/test_errors.py +++ b/tests/all/integration/api/helpers/test_errors.py @@ -11,8 +11,6 @@ class TestErrorsHelperValidation(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_error_response_base_respond(self): """Method to test base error response methods""" diff --git a/tests/all/integration/api/helpers/test_events.py b/tests/all/integration/api/helpers/test_events.py index ce4404960d..41c139ea77 100644 --- a/tests/all/integration/api/helpers/test_events.py +++ b/tests/all/integration/api/helpers/test_events.py @@ -10,8 +10,6 @@ class TestEventUtilities(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_should_create_attendee_forms(self): """Method to test custom forms for attendees of an event.""" diff --git a/tests/all/integration/api/helpers/test_exceptions.py b/tests/all/integration/api/helpers/test_exceptions.py index bb47780d73..8dcd99a31c 100644 --- a/tests/all/integration/api/helpers/test_exceptions.py +++ b/tests/all/integration/api/helpers/test_exceptions.py @@ -6,8 +6,6 @@ class TestExceptionsHelperValidation(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_exceptions(self): """Method to test all exceptions.""" diff --git a/tests/all/integration/api/helpers/test_export_helpers.py b/tests/all/integration/api/helpers/test_export_helpers.py index aadaca11ae..34ef4fbbf5 100644 --- a/tests/all/integration/api/helpers/test_export_helpers.py +++ b/tests/all/integration/api/helpers/test_export_helpers.py @@ -14,8 +14,6 @@ class TestExportJobHelpers(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_create_export_job(self): """Method to test export job before creation""" diff --git a/tests/all/integration/api/helpers/test_files.py b/tests/all/integration/api/helpers/test_files.py index 65ee9893c2..42f10c1139 100644 --- a/tests/all/integration/api/helpers/test_files.py +++ b/tests/all/integration/api/helpers/test_files.py @@ -15,8 +15,6 @@ from app.api.helpers.utilities import image_link class TestFilesHelperValidation(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def getsizes(self, file): # get file size *and* image size (None if not known) diff --git a/tests/all/integration/api/helpers/test_filters.py b/tests/all/integration/api/helpers/test_filters.py index 834bfb35aa..214988b8a1 100644 --- a/tests/all/integration/api/helpers/test_filters.py +++ b/tests/all/integration/api/helpers/test_filters.py @@ -9,8 +9,6 @@ class TestFiltersHelperValidation(OpenEventTestCase): """Contains tests for filters helpers""" - def setUp(self): - self.app = Setup.create_app() def test_json_to_rest_filter_list(self): """ diff --git a/tests/all/integration/api/helpers/test_jwt.py b/tests/all/integration/api/helpers/test_jwt.py index 5459e29fc4..e6c147b639 100644 --- a/tests/all/integration/api/helpers/test_jwt.py +++ b/tests/all/integration/api/helpers/test_jwt.py @@ -13,8 +13,6 @@ class TestJWTHelperValidation(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_jwt_authenticate(self): """Method to test jwt authentication""" diff --git a/tests/all/integration/api/helpers/test_log.py b/tests/all/integration/api/helpers/test_log.py index dc10f5f358..7c48a5e51f 100644 --- a/tests/all/integration/api/helpers/test_log.py +++ b/tests/all/integration/api/helpers/test_log.py @@ -10,8 +10,6 @@ class TestLogging(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_record_activity_valid_template(self): """Test to record activity for valid template""" diff --git a/tests/all/integration/api/helpers/test_order.py b/tests/all/integration/api/helpers/test_order.py index d530a5e7e2..6c32567696 100644 --- a/tests/all/integration/api/helpers/test_order.py +++ b/tests/all/integration/api/helpers/test_order.py @@ -15,8 +15,6 @@ class TestOrderUtilities(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_should_expire_outdated_order(self): """Method to test expiration of outdated orders""" diff --git a/tests/all/integration/api/helpers/test_storage.py b/tests/all/integration/api/helpers/test_storage.py index b0a2f35cb5..58af05668b 100644 --- a/tests/all/integration/api/helpers/test_storage.py +++ b/tests/all/integration/api/helpers/test_storage.py @@ -10,8 +10,6 @@ class TestStorage(OpenEventTestCase): """Contains test for Storage Helpers""" - def Setup(self): - self.app = Setup.create_app() """Test local file upload.""" @patch('app.api.helpers.storage.upload_local') diff --git a/tests/all/integration/api/helpers/test_systemnotifications.py b/tests/all/integration/api/helpers/test_systemnotifications.py index c26314aa4e..67d8a3b9c7 100644 --- a/tests/all/integration/api/helpers/test_systemnotifications.py +++ b/tests/all/integration/api/helpers/test_systemnotifications.py @@ -23,8 +23,6 @@ class TestSystemNotificationHelperValidation(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_event_exported(self): """Method to test the actions associated with a notification about an event being successfully exported.""" diff --git a/tests/all/integration/api/helpers/test_user.py b/tests/all/integration/api/helpers/test_user.py index fc08e05453..5fa0352e53 100644 --- a/tests/all/integration/api/helpers/test_user.py +++ b/tests/all/integration/api/helpers/test_user.py @@ -11,8 +11,6 @@ class TestUserUtilitiesHelper(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_modify_email_for_user_to_be_deleted(self): """Method to test modification of email for user to be deleted""" diff --git a/tests/all/integration/api/helpers/test_xcal.py b/tests/all/integration/api/helpers/test_xcal.py index e6da9cb236..8a28204d85 100644 --- a/tests/all/integration/api/helpers/test_xcal.py +++ b/tests/all/integration/api/helpers/test_xcal.py @@ -11,8 +11,6 @@ class TestXCalExport(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_export(self): """Test to check event contents in xCal format""" diff --git a/tests/all/integration/api/validation/test_access_codes.py b/tests/all/integration/api/validation/test_access_codes.py index 41771f4df0..47bbc5c8a8 100644 --- a/tests/all/integration/api/validation/test_access_codes.py +++ b/tests/all/integration/api/validation/test_access_codes.py @@ -10,8 +10,6 @@ import datetime class TestAccessCodeValidation(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_quantity_pass(self): """ diff --git a/tests/all/integration/api/validation/test_discount_codes.py b/tests/all/integration/api/validation/test_discount_codes.py index bcfdd9566a..9ad3afc2de 100644 --- a/tests/all/integration/api/validation/test_discount_codes.py +++ b/tests/all/integration/api/validation/test_discount_codes.py @@ -11,8 +11,6 @@ class TestDiscountCodeValidation(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_quantity_pass(self): """ diff --git a/tests/all/integration/api/validation/test_sessions.py b/tests/all/integration/api/validation/test_sessions.py index e779f37f3f..72d4fb4fc5 100644 --- a/tests/all/integration/api/validation/test_sessions.py +++ b/tests/all/integration/api/validation/test_sessions.py @@ -13,8 +13,6 @@ class TestSessionValidation(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_date_pass(self): """ diff --git a/tests/all/integration/api/validation/test_speakers_call.py b/tests/all/integration/api/validation/test_speakers_call.py index 13dcec5e9d..6b119e5d38 100644 --- a/tests/all/integration/api/validation/test_speakers_call.py +++ b/tests/all/integration/api/validation/test_speakers_call.py @@ -13,8 +13,6 @@ class TestSpeakersCallValidation(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_date_pass(self): """ diff --git a/tests/all/integration/api/validation/test_tickets.py b/tests/all/integration/api/validation/test_tickets.py index 488eb9fe82..db2fd03a3f 100644 --- a/tests/all/integration/api/validation/test_tickets.py +++ b/tests/all/integration/api/validation/test_tickets.py @@ -13,8 +13,6 @@ class TestTicketValidation(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_date_pass(self): """ diff --git a/tests/all/integration/test_migrations.py b/tests/all/integration/test_migrations.py index d5b4e4c946..1f74e04cfa 100644 --- a/tests/all/integration/test_migrations.py +++ b/tests/all/integration/test_migrations.py @@ -6,8 +6,6 @@ class TestMigrations(OpenEventTestCase): - def setUp(self): - self.app = Setup.create_app() def test_migrations(self): """Method to test the database migrations""" diff --git a/tests/hook_main.py b/tests/hook_main.py index b100f283c2..672498956d 100644 --- a/tests/hook_main.py +++ b/tests/hook_main.py @@ -1913,6 +1913,46 @@ def attendee_receipts(transaction): db.session.commit() +@hooks.before("Attendees > List Attendees under an order > List All Attendees under an order") +def get_attendees_from_order(transaction): + """ + GET /v1/orders/{identifier}/attendees + :param transaction: + :return: + """ + with stash['app'].app_context(): + order = OrderFactory() + order.identifier = "7201904e" + db.session.add(order) + db.session.commit() + + +@hooks.before("Attendees > List Attendees under an event > List All Attendees under an event") +def get_attendees_from_event(transaction): + """ + GET /v1/events/{event_id}/attendees + :param transaction: + :return: + """ + with stash['app'].app_context(): + event = EventFactoryBasic() + db.session.add(event) + db.session.commit() + + +@hooks.before("Attendees > List Attendees under a ticket > List All Attendees under a ticket") +def get_attendees_from_ticket(transaction): + """ + GET /v1/tickets/{ticket_id}/attendees + :param transaction: + :return: + """ + with stash['app'].app_context(): + ticket = TicketFactory() + db.session.add(ticket) + db.session.commit() + + # ------------------------- Tracks ------------------------- @hooks.before("Tracks > Tracks Collection > Create Track") def track_post(transaction): @@ -4145,20 +4185,6 @@ def get_event_from_order(transaction): db.session.commit() -@hooks.before("Attendees > List Attendees under an order > List All Attendees under an order") -def get_attendees_from_order(transaction): - """ - GET /v1/orders/{identifier}/attendees - :param transaction: - :return: - """ - with stash['app'].app_context(): - order = OrderFactory() - order.identifier = "7201904e" - db.session.add(order) - db.session.commit() - - @hooks.before("Change Password > Reset Forgotten Password > Reset Password from Token") def reset_password_patch(transaction): """ @@ -4173,6 +4199,15 @@ def reset_password_patch(transaction): db.session.commit() +@hooks.before("Email Verification > Verify Email > Verify the email via auth token") +def verify_email_from_token(transaction): + """ + POST /v1/auth/verify-email + :param transaction: + :return: + """ + transaction['skip'] = True + # ------------------------- Custom System Role ------------------------- @hooks.before("Custom System Roles > Custom System Roles Collections > List All Custom System Roles")