예제 #1
0
    def test_page_success(self):
        db_user = DBDiscussionSession.query(User).filter_by(
            nickname='Tobias').first()
        db_user.password = get_hashed_password('tobias')
        transaction.commit()

        request = testing.DummyRequest(
            params={
                'form.passwordchange.submitted': '',
                'passwordold': 'tobias',
                'password': '******',
                'passwordconfirm': 'tobiass'
            })
        response = settings(request)
        verify_dictionary_of_view(response)

        # check settings
        self.assertTrue(len(response['settings']['passwordold']) == 0)
        self.assertTrue(len(response['settings']['password']) == 0)
        self.assertTrue(len(response['settings']['passwordconfirm']) == 0)

        db_user = DBDiscussionSession.query(User).filter_by(
            nickname='Tobias').first()
        db_user.password = get_hashed_password('tobias')
        transaction.commit()
예제 #2
0
    def test_page(self):
        request = construct_dummy_request()
        response = settings(request)
        verify_dictionary_of_view(response)

        # check settings
        self.assertIn('send_notifications', response['settings'])
        self.assertIn('send_mails', response['settings'])
        self.assertIn('public_nick', response['settings'])
예제 #3
0
    def test_page_failure(self):
        request = construct_dummy_request(params={
            'form.passwordchange.submitted': '',
            'passwordold': 'tobia',
            'password': '******',
            'passwordconfirm': 'tobias'
        })
        response = settings(request)
        verify_dictionary_of_view(response)

        # check settings
        self.assertTrue(len(response['settings']['passwordold']) != 0)
        self.assertTrue(len(response['settings']['password']) != 0)
        self.assertTrue(len(response['settings']['passwordconfirm']) != 0)
예제 #4
0
 def test_page(self):
     request = construct_dummy_request()
     self.assertEqual(400, settings(request).status_code)
예제 #5
0
 def test_page(self):
     request = testing.DummyRequest()
     self.assertEqual(400, settings(request).status_code)