def test_obj_create(self):
        rr = RadUserResource()
        b = Bundle(data={'username' : 'abc', 'password' : '123445', 'is_active' : True, 'groups' : ['default']})
        ru = rr.obj_create(b)

        self.assertEqual(ru.password, '123445')
        self.assertEqual(ru.is_active, True)
        self.assertEqual(list(ru.groups), ['default'])
Beispiel #2
0
    def test_obj_create_gen_password(self):
        rr = RadUserResource()
        b = Bundle(data={
            'username': '******',
            'is_active': True,
            'groups': ['default']
        })
        ru = rr.obj_create(b)

        self.assertTrue(ru.password)
    def test_obj_update(self):
        ru = RadUser.objects.get(username='******')
        self.assertEqual(ru.password, '31415926')
        self.assertEqual(ru.is_active, True)
        self.assertEqual(list(ru.groups), [u'default'])

        rr = RadUserResource()
        b = Bundle(data={'password' : 'newpassword', 'is_active' : False, 'groups' : ['default2']})
        ru = rr.obj_update(b, username='******')

        self.assertEqual(ru.password, 'newpassword')
        self.assertEqual(ru.is_active, False)
        self.assertEqual(list(ru.groups), [u'default2'])
Beispiel #4
0
    def test_obj_create(self):
        rr = RadUserResource()
        b = Bundle(
            data={
                'username': '******',
                'password': '******',
                'is_active': True,
                'groups': ['default']
            })
        ru = rr.obj_create(b)

        self.assertEqual(ru.password, '123445')
        self.assertEqual(ru.is_active, True)
        self.assertEqual(list(ru.groups), ['default'])
Beispiel #5
0
    def test_obj_update(self):
        ru = RadUser.objects.get(username='******')
        self.assertEqual(ru.password, '31415926')
        self.assertEqual(ru.is_active, True)
        self.assertEqual(list(ru.groups), [u'default'])

        rr = RadUserResource()
        b = Bundle(data={
            'password': '******',
            'is_active': False,
            'groups': ['default2']
        })
        ru = rr.obj_update(b, username='******')

        self.assertEqual(ru.password, 'newpassword')
        self.assertEqual(ru.is_active, False)
        self.assertEqual(list(ru.groups), [u'default2'])
    def test_obj_create_gen_password(self):
        rr = RadUserResource()
        b = Bundle(data={'username' : 'abc', 'is_active' : True, 'groups' : ['default']})
        ru = rr.obj_create(b)

        self.assertTrue(ru.password)