Ejemplo n.º 1
0
    def test_begin_password_reset_fail(self):
        """ Begin reset failure due to using a non-existent account. """
        user = {'identity': '*****@*****.**'}
        response = self.client.post(url_for('user.begin_password_reset'),
                                    data=user, follow_redirects=True)

        assert_status_with_message(200, response, 'Unable to locate account.')
Ejemplo n.º 2
0
    def test_betting_history_details(self):
        """ Betting history should render successfully. """
        self.login()
        response = self.client.get(url_for('bet.history'))

        assert_status_with_message(200, response,
                                   'Betting history')
Ejemplo n.º 3
0
    def test_geo(self):
        """ Edit page renders successfully. """
        self.login()
        geo = {
            'lat': 10,
            'lng': 50,
        }
        response_post = self.client.post(url_for('onsell.geo_lot_geo', _id=1), data=geo, follow_redirects=True)
        assert_status_with_message(200, response_post, 'message', 'Geo location for lot #1 was added')

        response_get = self.client.get(url_for('onsell.geo_lot_geo', _id=1), follow_redirects=True)
        assert_status_with_message(200, response_get, 'lat', 10)

        geo_changed = {
            'lat': 20,
            'lng': 50,
        }

        response_put = self.client.put(url_for('onsell.geo_lot_geo', _id=1), data=geo_changed, follow_redirects=True)
        assert_status_with_message(200, response_put, 'message', 'Geo location for lot #1 was changed')

        response_get = self.client.get(url_for('onsell.geo_lot_geo', _id=1), follow_redirects=True)
        assert_status_with_message(200, response_get, 'lat', 20)

        response_delete = self.client.delete(url_for('onsell.geo_lot_geo', _id=1), follow_redirects=True)
        assert_status_with_message(200, response_delete, 'message', 'Geo location for lot #1 was removed successfully')
Ejemplo n.º 4
0
    def test_subscription_billing_details(self, subscriptions, mock_stripe):
        """ Subscription billing history should render successfully. """
        self.login(identity='*****@*****.**')
        response = self.client.get(url_for('billing.billing_details'))

        assert_status_with_message(200, response,
                                   'Billing details and history')
Ejemplo n.º 5
0
    def test_subscription_billing_details_without_sub(self, mock_stripe):
        """ Subscription billing history without sub should still work. """
        self.login()
        response = self.client.get(url_for('billing.billing_details'))

        assert_status_with_message(200, response,
                                   'Billing details and history')
Ejemplo n.º 6
0
    def test_begin_signup_fail(self):
        """ Signup failure due to using an account that exists. """
        user = {'email': '*****@*****.**', 'password': '******'}
        response = self.client.post(url_for('user.signup'), data=user,
                                    follow_redirects=True)

        assert_status_with_message(200, response, 'Already exists.')
Ejemplo n.º 7
0
 def test_subscription_update_payment_method_without_card(self):
     """ Subscription update method without card should fail. """
     self.login()
     response = self.client.post(url_for('billing.update_payment_method'),
                                 data={}, follow_redirects=True)
     assert_status_with_message(200, response,
                                'You do not have a payment method on file.')
Ejemplo n.º 8
0
    def test_subscription_update_page_without_subscription(self):
        """ Subscription update page redirects to pricing page. """
        self.login()

        response = self.client.get(url_for('billing.update'),
                                   follow_redirects=True)

        assert_status_with_message(200, response, 'Ready to start winning?')
Ejemplo n.º 9
0
    def test_pricing_page_as_subscriber(self, subscriptions):
        """ Pricing page for subscribers should redirect to update. """
        self.login(identity='*****@*****.**')

        response = self.client.get(url_for('billing.pricing'),
                                   follow_redirects=True)

        assert_status_with_message(200, response, 'Change plan')
Ejemplo n.º 10
0
    def test_subscription_update_page(self, subscriptions):
        """ Subscription update page renders successfully. """
        self.login(identity='*****@*****.**')

        response = self.client.get(url_for('billing.update'),
                                   follow_redirects=True)

        assert_status_with_message(200, response, 'about to change plans')
Ejemplo n.º 11
0
 def test_photos(self):
     """ Edit page renders successfully. """
     self.login()
     response_get = self.client.get(url_for('onsell.photos_lot_photos',
                                            _id=2),
                                    follow_redirects=True)
     assert_status_with_message(200, response_get, 'message',
                                'Lot #2 does not have loaded photos yet.')
Ejemplo n.º 12
0
 def test_register_page(self):
     user = {
         'username': '******',
         'password': '******',
         'email': '*****@*****.**'
     }
     response = self.client.post('/api/auth/users/register', data=user)
     assert_status_with_message(200, response, 'register', 'True')
Ejemplo n.º 13
0
 def test_contact_page(self):
     """ Contact page should respond with a success 200. """
     self.login()
     mail = {
         'email': '*****@*****.**',
         'message': 'Test'
     }
     response = self.client.post('/api/contact/mail', data=mail, follow_redirects=True)
     assert_status_with_message(200, response, 'message', 'Mail was sent successfully')
 def test_no_active_subscription(self):
     """
     A user with no active subscription should not be able to access the
     delete resource
     """
     self.authenticate()
     response = self.client.delete(url_for('SubscriptionsView:delete'))
     msg = 'You need an active subscription to access this resource.'
     assert_status_with_message(403, response, msg)
Ejemplo n.º 15
0
 def test_photo(self):
     """ Edit page renders successfully. """
     self.login()
     response_get = self.client.get(url_for('onsell.photos_lot_photo',
                                            _id=2,
                                            photo_id=1),
                                    follow_redirects=True)
     assert_status_with_message(200, response_get, 'message',
                                'Photo does not exist')
Ejemplo n.º 16
0
    def test_contato_form(self, client):
        """ Contact form should redirect with a message. """
        form = {
          'email': '*****@*****.**',
          'message': 'Mensagem de teste do FORM do SCA validando a funcionalidade de envio de email no formulario de contato.'
        }

        response = client.post(url_for('contato.index'), data=form, follow_redirects=True)
        assert_status_with_message(200, response, 'Obrigado')
Ejemplo n.º 17
0
    def test_password_reset_invalid_token(self):
        """ Reset failure due to tampered reset token. """
        reset = {'password': '******', 'token': '123'}
        response = self.client.post(url_for('user.password_reset'), data=reset,
                                    follow_redirects=True)

        assert_status_with_message(200, response,
                                   'Your reset token has expired or was '
                                   'tampered with.')
Ejemplo n.º 18
0
    def test_subscription_create_as_subscriber(self, subscriptions):
        """ Subscribers should not be allowed to create a subscription. """
        self.login(identity='*****@*****.**')

        response = self.client.get(url_for('billing.create'),
                                   follow_redirects=True)

        assert_status_with_message(200, response,
                                   'You already have an active subscription.')
Ejemplo n.º 19
0
    def test_begin_update_credentials_invalid_current(self):
        """ Update credentials failure due to invalid current password. """
        self.login()

        user = {'current_password': '******', 'email': '*****@*****.**'}
        response = self.client.post(url_for('user.update_credentials'),
                                    data=user, follow_redirects=True)

        assert_status_with_message(200, response, 'Does not match.')
Ejemplo n.º 20
0
    def test_subscription_cancel_page_without_subscription(self):
        """ Subscription cancel page redirects to settings. """
        self.login()

        response = self.client.get(url_for('billing.cancel'),
                                   follow_redirects=True)

        assert_status_with_message(200, response,
                                   'You do not have an active subscription.')
Ejemplo n.º 21
0
    def test_begin_password_reset(self):
        """ Begin password reset successfully. """
        user = {'identity': '*****@*****.**'}
        response = self.client.post(url_for('user.begin_password_reset'),
                                    data=user, follow_redirects=True)

        assert_status_with_message(200, response,
                                   'An email has been sent to {0}.'.format(
                                     '*****@*****.**'))
Ejemplo n.º 22
0
 def test_edit_user_page(self):
     self.login()
     user = {
         'username': '******',
         'email': '*****@*****.**',
         'password': '******'
     }
     response = self.client.put('/api/auth/users/edit', data=user)
     assert_status_with_message(200, response, 'message',
                                'User was edited successfully')
    def test_contact_form(self, client):
        """ Contact form should redirect with message. """
        form = {
          'email': '*****@*****.**',
          'message': 'Test message from Snake Eyes.'
        }

        response = client.post(url_for('contact.index'), data=form,
                               follow_redirects=True)
        assert_status_with_message(200, response, 'Thanks')
Ejemplo n.º 24
0
    def test_locale(self, users):
        """ Locale works successfully. """
        self.login()

        user = {'locale': 'kl'}
        response = self.client.post(url_for('user.update_locale'), data=user,
                                    follow_redirects=True)

        assert_status_with_message(200, response,
                                   'Your locale settings have been updated.')
Ejemplo n.º 25
0
    def test_subscription_update_payment_method(self, subscriptions,
                                                mock_stripe):
        """ Subscription update payment requires JavaScript. """
        self.login(identity='*****@*****.**')
        response = self.client.post(url_for('billing.update_payment_method'),
                                    data={}, follow_redirects=True)

        assert_status_with_message(200, response,
                                   'You must enable JavaScript'
                                   ' for this request.')
Ejemplo n.º 26
0
    def test_subscription_cancel(self, subscriptions, mock_stripe):
        """ Subscription cancel is successful. """
        self.login(identity='*****@*****.**')

        response = self.client.post(url_for('billing.cancel'),
                                    data={}, follow_redirects=True)

        assert_status_with_message(200, response,
                                   'Sorry to see you go, your subscription'
                                   ' has been cancelled.')
    def test_contact_form(self, client):
        """ Contact form should redirect with a message. """
        form = {
          'email': '*****@*****.**',
          'message': 'Test message from Snake Eyes.'
        }

        response = client.post(url_for('contact.index'), data=form,
                               follow_redirects=True)
        assert_status_with_message(200, response, 'Thanks')
Ejemplo n.º 28
0
    def test_welcome(self, users):
        """ Create username successfully. """
        self.login()

        user = {'username': '******'}
        response = self.client.post(url_for('user.welcome'), data=user,
                                    follow_redirects=True)

        assert_status_with_message(200, response,
                                   'Sign up is complete, enjoy our services.')
Ejemplo n.º 29
0
    def test_begin_update_credentials_existing_email(self):
        """ Update credentials failure due to existing account w/ email. """
        self.login()

        user = {'current_password': '******', 'email': '*****@*****.**'}
        response = self.client.post(url_for('user.update_credentials'),
                                    data=user,
                                    follow_redirects=True)

        assert_status_with_message(200, response, 'Already exists.')
Ejemplo n.º 30
0
    def test_contact_form(self, client):
        """ Contact form should redierect with a message."""
        form = {
            "email": "*****@*****.**",
            "message": "Test message from flashcard app."
        }

        response = client.post(url_for('contact.index'), data=form,
                                follow_redirects=True)
        assert_status_with_message(200, response, 'form sucessfully submitted')
Ejemplo n.º 31
0
    def test_edit_resource(self):
        """ Edit this resource successfully. """
        params = {'role': 'admin', 'username': '******', 'active': True}

        self.login()
        response = self.client.post(url_for('admin.users_edit', id=1),
                                    data=params,
                                    follow_redirects=True)

        assert_status_with_message(200, response,
                                   'User has been saved successfully.')