class UserTest(TestCase): def setUp(self): self.user1 = User() self.user1.first_name = u'Max' self.user1.last_name = u'Mustermann' self.user1.username = gen_username(self.user1.first_name, self.user1.last_name) self.user1.default_password = gen_password() self.user1.save() self.django_user1 = self.user1.django_user def test_participant_user(self): self.assertEqual(self.django_user1.user, self.user1) self.assertEqual(self.django_user1, self.user1.django_user) def test_repr(self): self.assertEqual(unicode(self.user1), 'Max Mustermann') def test_name_suffix(self): self.user1.structure_level = u'München' self.user1.save() self.assertEqual(unicode(self.user1), u'Max Mustermann (München)') def test_reset_password(self): self.assertIsInstance(self.user1.default_password, basestring) self.assertEqual(len(self.user1.default_password), 8) self.user1.set_unusable_password() self.assertFalse(self.user1.check_password( self.user1.default_password)) self.user1.reset_password() self.assertTrue(self.user1.check_password(self.user1.default_password)) def test_person_api(self): self.assertTrue(hasattr(self.user1, 'person_id')) self.assertEqual(self.user1.person_id, 'user:2') self.assertEqual(get_person('user:2'), self.user1) self.assertEqual(len(Persons(person_prefix_filter='user')), 2) def test_get_absolute_url(self): urls = (('detail', '/participant/2/'), ('update', '/participant/2/edit/'), ('delete', '/participant/2/del/')) for link, url in urls: self.assertEqual(self.user1.get_absolute_url(link), url)
class UserTest(TestCase): def setUp(self): self.user1 = User() self.user1.first_name = u'Max' self.user1.last_name = u'Mustermann' self.user1.username = gen_username( self.user1.first_name, self.user1.last_name) self.user1.default_password = gen_password() self.user1.save() self.django_user1 = self.user1.django_user def test_participant_user(self): self.assertEqual(self.django_user1.user, self.user1) self.assertEqual(self.django_user1, self.user1.django_user) def test_repr(self): self.assertEqual(unicode(self.user1), 'Max Mustermann') def test_name_suffix(self): self.user1.structure_level = u'München' self.user1.save() self.assertEqual(unicode(self.user1), u'Max Mustermann (München)') def test_reset_password(self): self.assertIsInstance(self.user1.default_password, basestring) self.assertEqual(len(self.user1.default_password), 8) self.user1.set_unusable_password() self.assertFalse(self.user1.check_password(self.user1.default_password)) self.user1.reset_password() self.assertTrue(self.user1.check_password(self.user1.default_password)) def test_person_api(self): self.assertTrue(hasattr(self.user1, 'person_id')) self.assertEqual(self.user1.person_id, 'user:2') self.assertEqual(get_person('user:2'), self.user1) self.assertEqual(len(Persons(person_prefix_filter='user')), 2) def test_get_absolute_url(self): urls = (('detail', '/participant/2/'), ('update', '/participant/2/edit/'), ('delete', '/participant/2/del/')) for link, url in urls: self.assertEqual(self.user1.get_absolute_url(link), url)
class UserTest(TestCase): def setUp(self): self.user1 = User() self.user1.first_name = u'Max' self.user1.last_name = u'Mustermann' self.user1.username = gen_username(self.user1.first_name, self.user1.last_name) self.user1.default_password = gen_password() self.user1.save() self.django_user1 = self.user1.django_user def test_participant_user(self): self.assertEqual(self.django_user1.user, self.user1) self.assertEqual(self.django_user1, self.user1.django_user) def test_repr(self): self.assertEqual(unicode(self.user1), 'Max Mustermann') def test_name_suffix(self): self.user1.structure_level = u'München' self.user1.save() self.assertEqual(unicode(self.user1), u'Max Mustermann (München)') def test_reset_password(self): self.assertIsInstance(self.user1.default_password, basestring) self.assertEqual(len(self.user1.default_password), 8) self.user1.set_unusable_password() self.assertFalse(self.user1.check_password( self.user1.default_password)) self.user1.reset_password() self.assertTrue(self.user1.check_password(self.user1.default_password)) def test_person_api(self): self.assertTrue(hasattr(self.user1, 'person_id')) self.assertEqual(self.user1.person_id, 'user:1') self.assertEqual(get_person('user:1'), self.user1) self.assertEqual(len(Persons(person_prefix_filter='user')), 1)
class UserTest(TestCase): def setUp(self): self.user1 = User() self.user1.first_name = u'Max' self.user1.last_name = u'Mustermann' self.user1.username = gen_username( self.user1.first_name, self.user1.last_name) self.user1.default_password = gen_password() self.user1.save() self.django_user1 = self.user1.django_user def test_participant_user(self): self.assertEqual(self.django_user1.user, self.user1) self.assertEqual(self.django_user1, self.user1.django_user) def test_repr(self): self.assertEqual(unicode(self.user1), 'Max Mustermann') def test_name_suffix(self): self.user1.structure_level = 'München' self.user1.save() self.assertEqual(unicode(self.user1), 'Max Mustermann (München)') def test_reset_password(self): self.assertIsInstance(self.user1.default_password, basestring) self.assertEqual(len(self.user1.default_password), 8) self.user1.set_unusable_password() self.assertFalse(self.user1.check_password(self.user1.default_password)) self.user1.reset_password() self.assertTrue(self.user1.check_password(self.user1.default_password)) def test_person_api(self): self.assertTrue(hasattr(self.user1, 'person_id')) self.assertEqual(self.user1.person_id, 'user:1') self.assertEqual(get_person('user:1'), self.user1) self.assertEqual(len(Persons(person_prefix_filter='user')), 1)