def test_event_copy(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event saved")
         url = url_for('events.copy_event', event_id=event.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("Copy of event1" in rv.data, msg=rv.data)
 def test_should_create_attendee_forms(self):
     """Method to test custom forms for attendees of an event."""
     with app.test_request_context():
         event = EventFactoryBasic()
         save_to_db(event)
         create_custom_forms_for_attendees(event)
         self.assertEqual(get_count(CustomForms.query), 3)
 def test_event_delete(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event saved")
         url = url_for('events.trash_view', event_id=event.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("Your event has been deleted" in rv.data, msg=rv.data)
 def test_events_edit(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event saved")
         custom_forms = ObjectMother.get_custom_form(event.id)
         save_to_db(custom_forms, "Custom forms saved")
         url = url_for('events.edit_view', event_id=event.id)
         data = POST_EVENT_DATA.copy()
         del data['copyright']
         data['sponsors_state'] = 'on'
         data['sponsors[name]'] = ['Sponsor 1', 'Sponsor 2']
         data['sponsors[type]'] = ['Gold', 'Silver']
         data['sponsors[url]'] = ["", ""]
         data['sponsors[description]'] = ["", ""]
         data['sponsors[level]'] = ["", ""]
         data['name'] = 'EditTestName'
         data['start_date'] = '07/04/2016'
         data['start_time'] = '19:00'
         data['has_session_speakers'] = 'yes'
         data['end_date'] = '07/04/2016'
         data['end_time'] = '22:00'
         data['has_session_speakers'] = 'no'
         data['custom_form[name]'] = ['session_form', 'speaker_form']
         data['custom_form[value]'] = [custom_forms.session_form, custom_forms.speaker_form]
         data = ImmutableMultiDict(data)
         rv = self.app.post(url, follow_redirects=True, buffered=True, content_type='multipart/form-data',
                            data=data)
         self.assertTrue('EditTestName' in rv.data, msg=rv.data)
         self.assertTrue(data['sponsors[name]'] in rv.data, msg=rv.data)
    def test_events_create_post(self):
        with app.test_request_context():
            custom_forms = ObjectMother.get_custom_form()
            url = url_for('events.create_view')
            data = POST_EVENT_DATA.copy()
            del data['copyright']
            data['sponsors_state'] = 'on'
            data['sponsors[name]'] = ['Sponsor 1', 'Sponsor 2']
            data['sponsors[type]'] = ['Gold', 'Silver']
            data['sponsors[url]'] = ["", ""]
            data['sponsors[description]'] = ["", ""]
            data['sponsors[level]'] = ["", ""]
            data['start_date'] = '07/04/2016'
            data['start_time'] = '19:00'
            data['end_date'] = '07/04/2016'
            data['end_time'] = '22:00'
            data['has_session_speakers'] = 'no'
            data['custom_form[name]'] = ['session_form', 'speaker_form']
            data['custom_form[value]'] = [custom_forms.session_form, custom_forms.speaker_form]
            data = ImmutableMultiDict(data)
            rv = self.app.post(url, follow_redirects=True, buffered=True, content_type='multipart/form-data',
                               data=data)
            self.assertTrue(POST_EVENT_DATA['name'] in rv.data, msg=rv.data)

            rv2 = self.app.get(url_for('events.details_view', event_id=1))
            self.assertTrue(data['sponsors[name]'] in rv2.data, msg=rv2.data)
 def test_order_payment_paypal_success(self):
     with app.test_request_context():
         event, ticket, identifier = create_order(self)
         response = self.app.get(
             url_for('ticketing.paypal_callback', order_identifier=identifier, function="success"),
             follow_redirects=True)
         self.assertTrue("error" in response.data, msg=response.data)
Esempio n. 7
0
    def test_get_identity(self):
        with app.test_request_context():
            user = UserFactory()
            db.session.add(user)
            db.session.commit()

            event = EventFactoryBasic()
            event.user_id = user.id
            db.session.add(event)
            db.session.commit()

            # Authenticate User
            self.auth = {'Authorization': "JWT " + _default_jwt_encode_handler(user)}

        with app.test_request_context(headers=self.auth):
            self.assertEquals(get_identity().id, user.id)
 def _test_model(self, name):
     """
     Tests -
     1. When just one item, check if next and prev urls are empty
     2. When one more item added, limit results to 1 and see if
         next is not empty
     3. start from position 2 and see if prev is not empty
     """
     login(self.app, u'*****@*****.**', u'test')
     if name == 'event':
         path = get_path('page')
     else:
         path = get_path(1, name + 's', 'page')
     data = self._json_from_url(path)
     self.assertEqual(data['next'], '')
     self.assertEqual(data['previous'], '')
     # add second service
     with app.test_request_context():
         create_event(name='TestEvent2')
         create_services(1)
     data = self._json_from_url(path + '?limit=1')
     self.assertIn('start=2', data['next'])
     self.assertEqual(data['previous'], '')
     # check from start=2
     data = self._json_from_url(path + '?start=2')
     self.assertIn('limit=1', data['previous'])
     self.assertEqual(data['next'], '')
     self.assertIn('http', data['previous'])  # check absolute link
 def test_unpublished_event_view_attempt(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event Saved")
         rv = self.app.get(url_for('event_detail.display_event_detail_home', identifier=event.identifier),
                           follow_redirects=True)
         self.assertEqual(rv.status_code, 404)
 def test_unpublished_event_view_coc(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         event.state = "Published"
         save_to_db(event, "Event Saved")
         rv = self.app.get(url_for("event_detail.display_event_coc", event_id=event.id), follow_redirects=True)
         self.assertEqual(rv.status_code, 404)
Esempio n. 11
0
 def test_safe_query(self):
     with app.test_request_context():
         event = EventFactoryBasic()
         db.session.add(event)
         db.session.commit()
         obj = safe_query(db, Event, 'id', event.id, 'event_id')
         self.assertEqual(obj.name, event.name)
 def test_invoice_payment_paypal_success(self):
     with app.test_request_context():
         event, invoice = get_event_invoice()
         response = self.app.get(
             url_for('event_invoicing.paypal_callback', invoice_identifier=invoice.identifier, function="success"),
             follow_redirects=True)
         self.assertTrue("error" in response.data, msg=response.data)
 def test_speaker_name(self):
     """Unicode handling for Speaker model"""
     with app.test_request_context():
         try:
             str(Speaker.query.get(1))
         except UnicodeEncodeError:
             self.fail('UnicodeEncodeError for speaker')
    def test_event_name(self):
        """Tests all urls with GET method"""
        with app.test_request_context():

            for rule in app.url_map.iter_rules():
                methods = ','.join(rule.methods)
                if "<" not in str(rule) and\
                        "favicon" not in str(rule) and\
                        "check_email" not in str(rule) and \
                        "set_role" not in str(rule) and \
                        "GET" in methods:
                    try:
                        response = self.app.get(request.url[:-1] + str(rule).replace('//', '/'),
                                                follow_redirects=True)
                        print str(rule), response.status_code, rule.endpoint
                        if 'api' in str(rule):
                            self.assertTrue(response.status_code in [200, 302, 401, 404], msg=response.data)
                        else:
                            self.assertTrue(response.status_code in [200, 302, 401], msg=response.data)
                    except TemplateNotFound:
                        pass
                    except AttributeError:
                        pass
                    except ValueError:
                        pass
    def _test_path(self, path, *strings):
        """Helper function.
        Test response for 200 status code. Also test if response body
        contains event/service name.
        """
        with app.test_request_context():
            login(self.app, u'*****@*****.**', u'test')
            response = self.app.get(path, follow_redirects=True)

            # Check GET APIs normally
            self.assertEqual(response.status_code, 200)
            for string in strings:
                self.assertIn(string, response.data)

            headers_keys = [key.lower() for key in response.headers.keys()]

            # Check if ETag header was returned
            self.assertIn('etag', headers_keys)

            # Check if ETag value is not empty
            etag = response.headers.get('etag')
            self.assertNotEqual(etag, '')

            # Send new request with If-None-Match header set
            response = self.app.get(path, headers={'If-None-Match': etag},
                follow_redirects=True)

            # Check if response was 304 Not Modified
            self.assertEqual(response.status_code, 304)
            self.assertEqual(response.data, '')
 def test_microlocation_name(self):
     """Unicode handling for Microlocation model"""
     with app.test_request_context():
         try:
             str(Microlocation.query.get(1))
         except UnicodeEncodeError:
             self.fail('UnicodeEncodeError for microlocation')
 def test_session_delete(self):
     with app.test_request_context():
         session = ObjectMother.get_session()
         save_to_db(session, "Session Saved")
         url = url_for('event_sessions.delete_session', event_id=1, session_id=session.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("deleted" in rv.data, msg=rv.data)
 def test_wrong_form_config(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event saved")
         url = url_for('event_sessions.create_view', event_id=event.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertFalse("incorrectly configured" in rv.data, msg=rv.data)
 def test_get_list(self):
     with app.test_request_context():
         self._login_user()
         path = get_path()
         resp = self.app.get(path)
         self.assertEqual(resp.status_code, 200)
         self.assertIn('gmail', resp.data)
 def test_discounts_toggle(self):
     with app.test_request_context():
         event, discount_code = create_discount_code(self)
         response = self.app.get(url_for('event_ticket_sales.discount_codes_toggle', event_id=event.id,
                                         discount_code_id=discount_code.id), follow_redirects=True)
         self.assertFalse(TicketingManager.get_discount_code(event.id, discount_code.id).is_active,
                          msg=response.data)
 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'*****@*****.**', u'test')
         update_role_to_admin({'admin_perm': 'isAdmin'}, user_id=1)
         event_id = create_event(creator_email='*****@*****.**')
         create_services(event_id)
 def test_speakers_list(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event saved")
         url = url_for('event_speakers.index_view', event_id=event.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("Speakers" in rv.data, msg=rv.data)
    def test_has_access(self):
        """Method to test whether user has access to different roles"""

        with app.test_request_context(headers=self.auth):
            self.assertTrue(has_access('is_admin'))
            self.assertFalse(has_access('is_super_admin'))
            self.assertTrue(has_access('is_organizer', event_id=1))
 def test_event_name(self):
     """Unicode handling for Event model"""
     with app.test_request_context():
         try:
             str(Event.query.get(1))
         except UnicodeEncodeError:
             self.fail('UnicodeEncodeError for event')
 def test_scheduler_publish(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event saved")
         rv = self.app.get(url_for('event_scheduler.publish', event_id=event.id), follow_redirects=True)
         event = DataGetter.get_event(event.id)
         self.assertTrue(event.schedule_published_on is not None, msg=rv.data)
 def test_session_title(self):
     """Unicode handling for Session model"""
     with app.test_request_context():
         try:
             str(Session.query.get(1))
         except UnicodeEncodeError:
             self.fail('UnicodeEncodeError for session')
 def test_admin_dashboard_attempt(self):
     with app.test_request_context():
         logout(self.app)
         register(self.app, "*****@*****.**", "SomeRandomPassword")
         login(self.app, "*****@*****.**", "SomeRandomPassword")
         rv = self.app.get(url_for('sadmin.index_view'), follow_redirects=True)
         self.assertEqual(rv.status_code, 403)
 def test_add_user_to_trash(self):
     user = User(password="******",
                 email="*****@*****.**",
                 in_trash=False)
     with app.test_request_context():
         save_to_db(user, "User saved")
         trash_user(1)
         self.assertEqual(user.in_trash, True)
 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'*****@*****.**', u'test')
         logout(self.app)
         event_id = create_event(
             name='TestEvent_1', creator_email=u'*****@*****.**')
         create_services(event_id)
 def setUp(self):
     """Create Event but don't define services for it.
     """
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'*****@*****.**', u'test')
         # Created event will have id=1
         create_event(creator_email=u'*****@*****.**')
Esempio n. 31
0
 def test_get_single(self):
     with app.test_request_context():
         self._login_user()
         path = get_path(1)
         resp = self.app.get(get_path(3))
         self.assertEqual(resp.status_code, 404)
         resp = self.app.get(path)
         self.assertEqual(resp.status_code, 200)
         self.assertIn('gmail', resp.data)
 def test_event_unpublish(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         event.state = "Published"
         save_to_db(event, "Event saved")
         url = url_for('events.unpublish_event', event_id=event.id)
         rv = self.app.get(url, follow_redirects=True)
         event = DataGetter.get_event(event.id)
         self.assertEqual("Draft", event.state, msg=event.state)
Esempio n. 33
0
    def test_upload_local(self, uploadedfile_object, settings, generated_hash,
                          uploadlocal):
        expected_response = 'https://next.eventyay.com/media/upload_key/hash/test.pdf'
        uploadedfile_object.filename = 'test.pdf'

        with app.test_request_context():
            app.config['BASE_DIR'] = 'testdir'
            actual_response = upload_local(uploadedfile_object, 'upload_key')
            self.assertEqual(expected_response, actual_response)
Esempio n. 34
0
 def test_order_payment_paypal_cancel(self):
     with app.test_request_context():
         event, ticket, identifier = create_order(self)
         self.app.get(url_for('ticketing.paypal_callback',
                              order_identifier=identifier,
                              function="cancel"),
                      follow_redirects=True)
         order = TicketingManager.get_order_by_identifier(identifier)
         self.assertTrue(order.status == 'expired', msg=order.status)
Esempio n. 35
0
    def test_should_not_expire_valid_orders(self):
        """Method to test to not mark valid orders as expired"""

        with app.test_request_context():
            obj = OrderFactory()
            event = EventFactoryBasic()
            obj.event = event
            set_expiry_for_order(obj)
            self.assertEqual(obj.status, 'pending')
 def test_session_delete(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event Saved")
         session = ObjectMother.get_session()
         save_to_db(session, "Session Saved")
         url = url_for('event_sessions.delete_session', event_id=1, session_id=session.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("deleted" in rv.data, msg=rv.data)
 def test_invoice_payment_paypal_success(self):
     with app.test_request_context():
         event, invoice = get_event_invoice()
         response = self.app.get(url_for(
             'event_invoicing.paypal_callback',
             invoice_identifier=invoice.identifier,
             function="success"),
                                 follow_redirects=True)
         self.assertTrue("error" in response.data, msg=response.data)
Esempio n. 38
0
    def test_get_geokrety_types_unexistent(self):
        """ Check GeokretyType: GET geokrety-types unexistent"""
        with app.test_request_context():
            self._blend()

            self._send_get('/v1/geokrety-types/666', code=404)
            self._send_get('/v1/geokrety-types/666', code=404, user=self.admin)
            self._send_get('/v1/geokrety-types/666', code=404, user=self.user1)
            self._send_get('/v1/geokrety-types/666', code=404, user=self.user2)
 def test_record_activity_invalid_template(self):
     """Test to record activity for invalid template"""
     with app.test_request_context():
         test_user = create_user(email="*****@*****.**", password="******")
         record_activity('invalid_template', login_user=test_user, user=test_user)
         user_id_format = ' (' + str(test_user.id) + ')'
         test_actor = test_user.email + user_id_format
         self.assertTrue('[ERROR LOGGING] invalid_template',
                         db.session.query(Activity).filter_by(actor=test_actor).first().action)
Esempio n. 40
0
 def _post_news(self, payload, code=201, expected_count=1, user=None):
     """Check News: POST request minimal informations"""
     with app.test_request_context():
         response = self._send_post("/v1/news",
                                    payload=payload,
                                    code=code,
                                    user=user)
         self.assertEqual(len(News.query.all()), expected_count)
         return response
Esempio n. 41
0
 def test_update_version_function(self):
     with app.test_request_context():
         update_version(1, False, "tracks_ver")
         self.assertEqual(Version.query.get(1).id, 1)
         # tracks_ver was 0 at start
         self.assertEqual(Version.query.get(1).tracks_ver, 1)
         update_version(1, False, "tracks_ver")
         self.assertEqual(Version.query.get(1).tracks_ver, 2)
         self.assertEqual(Version.query.get(2), None)
 def test_published_event_view_coc(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         event.state = 'Published'
         event.code_of_conduct = 'Test Code of Conduct'
         save_to_db(event, "Event Saved")
         rv = self.app.get(url_for('event_detail.display_event_coc', identifier=event.identifier),
                           follow_redirects=True)
         self.assertTrue("Code of Conduct" in rv.data, msg=rv.data)
Esempio n. 43
0
 def test_img_upload(self):
     with app.test_request_context():
         data = dict(slides=(StringIO(b'my file contents'), "file1.png"),
                     photo=(StringIO(b'my photo contents'), "file2.png"))
         response = self.app.post('events/1/session/create/',
                                  content_type='multipart/form-data',
                                  data=data,
                                  follow_redirects=True)
         self.assertTrue(response.status_code, 200)
    def test_add_user_to_trash(self):
        with app.test_request_context():
            user = User(password="******",
                        email="*****@*****.**",
                        in_trash=False)

            save_to_db(user, "User saved")
            trash_user(1)
            self.assertEqual(user.in_trash, True)
Esempio n. 45
0
    def create_app():
        app.config.from_object('config.TestingConfig')
        app.secret_key = 'super secret key'
        app.logger.addHandler(logging.StreamHandler(sys.stdout))
        app.logger.setLevel(logging.ERROR)
        with app.test_request_context():
            db.create_all()

        return app.test_client()
Esempio n. 46
0
    def test_patch_geokret_readonly_fields_ignored(self):
        """
        Check Geokret: PATCH geokret read only fields are ignored
        """
        with app.test_request_context():
            self._blend()

            payload = {
                "data": {
                    "id": "1",
                    "type": "geokret",
                    "attributes": {
                        "tracking-code": "NOLUCK",
                        "missing": False,
                        "distance": 42,
                        "caches-count": 12,
                        "pictures-count": 8,
                        "average-rating": 82,
                        "created-on-date-time": "2007-10-26T20:36:00",
                        "updated-on-date-time": "2017-11-25T13:45:18"
                    }
                }
            }
            response = self._send_patch("/v1/geokrety/1",
                                        payload=payload,
                                        code=200,
                                        user=self.admin)
            self._check_geokret(response['data'],
                                self.geokret1,
                                skip_check=['times'],
                                with_private=True)

            payload["data"]["id"] = "2"
            response = self._send_patch("/v1/geokrety/2",
                                        payload=payload,
                                        code=200,
                                        user=self.admin)
            self._check_geokret(response['data'],
                                self.geokret2,
                                skip_check=['times'],
                                with_private=True)

            payload["data"]["id"] = "3"
            response = self._send_patch("/v1/geokrety/3",
                                        payload=payload,
                                        code=200,
                                        user=self.admin)
            self._check_geokret(response['data'],
                                self.geokret3,
                                skip_check=['times'],
                                with_private=True)

            payload["data"]["id"] = "4"
            self._send_patch("/v1/geokrety/4",
                             payload=payload,
                             code=404,
                             user=self.admin)
 def test_session_create(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event saved")
         custom_form = ObjectMother.get_custom_form(event.id)
         save_to_db(custom_form, "Custom form saved")
         url = url_for('event_sessions.create_view', event_id=event.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("Create Session" in rv.data, msg=rv.data)
Esempio n. 48
0
 def test_create_incomplete(self):
     """Check Geokret: POST incomplete request"""
     with app.test_request_context():
         admin = mixer.blend(User)
         payload = {"data": {"type": "geokret"}}
         self._send_post("/v1/geokrety",
                         payload=payload,
                         code=422,
                         user=admin)
Esempio n. 49
0
 def test_get_news_comments(self):
     """Check NewsRelationships: GET news_comment"""
     with app.test_request_context():
         self._blend_users()
         self._blend()
         self._send_get('/v1/news/1/relationship/news-comments', code=200)
         self._send_get('/v1/news/1/relationship/news-comments', code=200, user=self.admin)
         self._send_get('/v1/news/1/relationship/news-comments', code=200, user=self.user1)
         self._send_get('/v1/news/1/relationship/news-comments', code=200, user=self.user2)
Esempio n. 50
0
 def test_published_event_view(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         event.state = 'Published'
         save_to_db(event, "Event Saved")
         rv = self.app.get(url_for('event_detail.display_event_detail_home',
                                   identifier=event.identifier),
                           follow_redirects=True)
         self.assertTrue("Open Event" in rv.data, msg=rv.data)
Esempio n. 51
0
 def test_ticket_display(self):
     with app.test_request_context():
         event, ticket = get_event_ticket()
         response = self.app.get(url_for(
             'event_detail.display_event_detail_home',
             identifier=event.identifier),
                                 follow_redirects=True)
         self.assertTrue(str(ticket.name) in response.data,
                         msg=response.data)
Esempio n. 52
0
 def test_unpublished_event_view_coc(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         event.state = 'Published'
         save_to_db(event, "Event Saved")
         rv = self.app.get(url_for('event_detail.display_event_coc',
                                   identifier=event.identifier),
                           follow_redirects=True)
         self.assertEqual(rv.status_code, 404)
    def setUp(self):
        self.app = Setup.create_app()
        with app.test_request_context():
            register(self.app, u'*****@*****.**', u'test')
            # User must be part of the staff to access listed events
            update_role_to_admin({'admin_perm': 'isAdmin'}, user_id=1)

            event_id = create_event(creator_email=u'*****@*****.**')
            create_services(event_id)
 def test_basic_page(self):
     with app.test_request_context():
         page = Page(name='abc', url='abc')
         save_to_db(page)
         page2 = Page(name='def', url='http://def.com')
         save_to_db(page2)
     resp = self.app.get('/sitemaps/pages.xml.gz')
     #self.assertIn('localhost/abc', resp.data)
     self.assertIn('<loc>http://def.com', resp.data)
 def setUp(self):
     self.app = Setup.create_app()
     app.config['TESTING'] = True
     app.secret_key = 'super secret key'
     app.config['PROFILE'] = True
     app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[30])
     with app.test_request_context():
         db.create_all()
         populate()
Esempio n. 56
0
    def test_get_news_orphan(self):
        """Check User: GET author details from an orphan news"""
        with app.test_request_context():
            self._blend()
            orphan_url = '/v1/news/%d/author' % self.orphan_news.id

            self._send_get(orphan_url, code=404, user=self.admin)
            self._send_get(orphan_url, code=404, user=self.user1)
            self._send_get(orphan_url, code=404, user=self.user2)
Esempio n. 57
0
 def test_delete_user2(self):
     """
     Check News: DELETE User2
     """
     with app.test_request_context():
         self._blend_users()
         self._blend()
         self._send_delete("/v1/news/1", code=403, user=self.user2)
         self._send_delete("/v1/news/2", code=404, user=self.user2)
Esempio n. 58
0
    def _test_export_session_csv(self, test_session=None):
        with app.test_request_context():
            if not test_session:
                test_session = SessionFactory()
            field_data = export_sessions_csv([test_session])
            session_row = field_data[1]

            self.assertEqual(session_row[0], 'example (accepted)')
            self.assertEqual(session_row[7], 'accepted')
Esempio n. 59
0
 def test_get_list_paginated(self):
     with app.test_request_context():
         self._login_user()
         path = get_path('page')
         resp = self.app.get(path)
         self.assertEqual(resp.status_code, 200)
         self.assertIn('gmail', resp.data)
         resp = self.app.get(path + '?start=3')
         self.assertEqual(resp.status_code, 404)
    def test_export_orders_csv(self):
        """Method to check the orders data export"""

        with app.test_request_context():
            test_order = OrderFactory()
            test_order.amount = 2
            field_data = export_orders_csv([test_order])
            self.assertEqual(field_data[1][2], 'pending')
            self.assertEqual(field_data[1][4], '2')