Beispiel #1
0
    def test_bare_save_new_password(self):
        """
        just calling save should be enough to generate a random password
        on a user model
        """
        with mock.patch(
            PACKAGE_BASE + '.utils.random.get_random_string',
            mock.Mock(return_value='thisisrandom')
        ):
            ad = VidyoAdmin()
            ad.secret_key = 'pizzatime'
            ad.password = '******'
            ad.save()

            model = TestVidyoMock(_admin_model=ad)
            model.secret_key = 'pizzatime'
            model.save()
            self.assertEqual(model.password, 'thisisrandom')
Beispiel #2
0
def create_test_admin(ssl=False, dj_auth_user=None, password=VIDYO_PORTAL_PASSWORD, admin='admin'):
    ad = VidyoAdmin(
        portal_user=admin,
        portal_host='myhost.example.com',
        replay_host='myhost.example.com',
        portal_prefix='431',
        ssl=ssl
    )
    if dj_auth_user:
        ad.dj_auth_user = dj_auth_user
    ad.set_password(password, VIDYO_PORTAL_PASSWORD)
    ad.save()
    return ad