Beispiel #1
0
    def test_create_on_existing_email(self):
        settings.PASSWORD_LOGIN = True
        email = self.fake.email()
        password = self.fake.password()
        payload = dict(email=email,
                       name=self.fake.name(),
                       password=password,
                       code=Role.SIGNATURE.dumps(email))

        RoleFactory.create(email=email)
        res = self.client.post('/api/2/roles', data=payload)

        self.assertEqual(res.status_code, 409)
Beispiel #2
0
    def test_create_on_existing_email(self):
        settings.PASSWORD_LOGIN = True
        email = self.fake.email()
        password = self.fake.password()
        payload = dict(
            email=email,
            name=self.fake.name(),
            password=password,
            code=Role.SIGNATURE.dumps(email)
        )

        RoleFactory.create(email=email)
        res = self.client.post('/api/2/roles', data=payload)

        self.assertEqual(res.status_code, 409)
Beispiel #3
0
    def test_create_on_existing_email(self):
        email = self.fake.email()
        password = self.fake.password()
        payload = dict(
            email=email,
            name=self.fake.name(),
            password=password,
            code=Role.SIGNATURE_SERIALIZER.dumps(email, salt=email)
        )

        RoleFactory.create(email=email)
        res = self.client.post('/api/1/roles', data=payload)

        self.assertEqual(res.status_code, 200)
        self.assertEqual(res.json['status'], 'ok')
        role = Role.by_email(email).first()
        self.assertIsNotNone(role)
        self.assertFalse(role.check_password(password))
Beispiel #4
0
    def test_password(self):
        password = self.fake.password()

        role = RoleFactory.create()
        self.assertFalse(role.check_password(password))

        role.set_password(password)
        self.assertTrue(role.check_password(password))

        role.set_password(self.fake.password())
        self.assertFalse(role.check_password(password))
Beispiel #5
0
    def test_password(self):
        password = self.fake.password()

        role = RoleFactory.create()
        self.assertFalse(role.check_password(password))

        role.set_password(password)
        self.assertTrue(role.check_password(password))

        role.set_password(self.fake.password())
        self.assertFalse(role.check_password(password))
Beispiel #6
0
    def setUp(self):
        super(RoleModelTest, self).setUp()

        self.role = RoleFactory.create()
        db.session.commit()
Beispiel #7
0
 def setUp(self):
     super(SessionsApiTestCase, self).setUp()
     self.role = RoleFactory.create()
Beispiel #8
0
 def setUp(self):
     super(SessionsApiTestCase, self).setUp()
     self.role = RoleFactory.create()
Beispiel #9
0
    def setUp(self):
        super(RoleModelTest, self).setUp()

        self.role = RoleFactory.create()
        db.session.commit()