Beispiel #1
0
 def test_User_update(self):
     user = User(con=self.con,
                 username='******',
                 email='*****@*****.**',
                 givenName='Wile E.4',
                 familyName='Coyote4',
                 password='******',
                 lang=Languages.EN,
                 status=True,
                 sysadmin=True,
                 in_projects={
                     "http://rdfh.ch/projects/0001": True
                 },
                 in_groups={"http://rdfh.ch/groups/00FF/images-reviewer"
                            }).create()
     user.email = '*****@*****.**'
     user.username = '******'
     user.givenName = 'roadrunner'
     user.familyName = 'Geococcyx'
     user.lang = 'fr'
     user.status = False
     user.sysadmin = False
     nuser = user.update()
     self.assertEqual(nuser.email, '*****@*****.**')
     self.assertEqual(nuser.username, 'roadrunner')
     self.assertEqual(nuser.givenName, 'roadrunner')
     self.assertEqual(nuser.familyName, 'Geococcyx')
     self.assertEqual(nuser.lang, Languages.FR)
     self.assertFalse(nuser.status)
     self.assertFalse(nuser.sysadmin)
Beispiel #2
0
 def test_User_read2(self):
     user = User(con=self.con,
                 username='******',
                 email='*****@*****.**',
                 givenName='Wile E.2',
                 familyName='Coyote2',
                 password='******',
                 lang=Languages.EN,
                 status=True,
                 sysadmin=True,
                 in_projects={
                     "http://rdfh.ch/projects/0001": True
                 },
                 in_groups={"http://rdfh.ch/groups/00FF/images-reviewer"
                            }).create()
     user = User(con=self.con, email='*****@*****.**').read()
     self.assertEqual(user.username, 'wilee2')
     self.assertEqual(user.familyName, 'Coyote2')
     self.assertEqual(user.givenName, 'Wile E.2')
     self.assertEqual(user.lang, Languages.EN)
     self.assertTrue(user.status)
     self.assertTrue(user.sysadmin)
     self.assertEqual(user.in_projects,
                      {"http://rdfh.ch/projects/0001": True})
     self.assertEqual(user.in_groups,
                      {"http://rdfh.ch/groups/00FF/images-reviewer"})
Beispiel #3
0
 def test_User_makeProjectAdmin(self):
     user = User(con=self.con,
                 username='******',
                 email='*****@*****.**',
                 givenName='Wile E.A',
                 familyName='CoyoteA',
                 password='******',
                 lang=Languages.EN,
                 status=True,
                 sysadmin=True,
                 in_projects={
                     "http://rdfh.ch/projects/0001": True
                 },
                 in_groups={"http://rdfh.ch/groups/00FF/images-reviewer"
                            }).create()
     user.addToProject('http://rdfh.ch/projects/00FF', False)
     user = user.update()
     user.makeProjectAdmin('http://rdfh.ch/projects/00FF')
     nuser = user.update()
     self.assertIsNotNone(nuser)
     self.assertEqual(
         nuser.in_projects, {
             'http://rdfh.ch/projects/0001': True,
             'http://rdfh.ch/projects/00FF': True
         })
Beispiel #4
0
 def test_User_rmFromGroup(self):
     user = User(con=self.con,
                 username='******',
                 email='*****@*****.**',
                 givenName='Wile E.6',
                 familyName='Coyote6',
                 password='******',
                 lang=Languages.EN,
                 status=True,
                 sysadmin=True,
                 in_projects={
                     "http://rdfh.ch/projects/0001": True
                 },
                 in_groups={"http://rdfh.ch/groups/00FF/images-reviewer"
                            }).create()
     user.rmFromGroup('http://rdfh.ch/groups/00FF/images-reviewer')
     nuser = user.update()
     self.assertIsNotNone(nuser)
Beispiel #5
0
 def test_User_delete(self):
     user = User(con=self.con,
                 username='******',
                 email='*****@*****.**',
                 givenName='Wile E.3',
                 familyName='Coyote3',
                 password='******',
                 lang=Languages.EN,
                 status=True,
                 sysadmin=True,
                 in_projects={
                     "http://rdfh.ch/projects/0001": True
                 },
                 in_groups={"http://rdfh.ch/groups/00FF/images-reviewer"
                            }).create()
     nuser = user.delete()
     self.assertIsNotNone(nuser)
     self.assertFalse(nuser.status)
Beispiel #6
0
 def test_User_read(self):
     user = User(con=self.con, id='http://rdfh.ch/users/91e19f1e01').read()
     self.assertEqual(user.id, 'http://rdfh.ch/users/91e19f1e01')
     self.assertEqual(user.username, 'root-alt')
     self.assertEqual(user.familyName, 'Admin-alt')
     self.assertEqual(user.givenName, 'Administrator-alt')
     self.assertEqual(user.lang, Languages.DE)
     self.assertTrue(user.status)
     self.assertFalse(user.sysadmin)
     self.assertEqual(user.in_projects,
                      {"http://rdfh.ch/projects/0803": False})
Beispiel #7
0
 def test_getAllUsers(self):
     con = Connection('http://0.0.0.0:3333')
     con.login('*****@*****.**', 'test')
     all_users = User.getAllUsers(con)
     for u in all_users:
         self.assertIsNotNone(u.id)