Esempio n. 1
0
    def test_replace_user(self):
        self.arango.create_user(username=self.username,
                                password="******",
                                change_password=True,
                                extra={"key": "val"}),
        self.assertEqual(
            self.arango.replace_user(
                username=self.username,
                password="******",
            ), {
                "active": True,
                "change_password": False,
                "extra": {}
            })
        self.assertEqual(self.arango.user(username=self.username), {
            "active": True,
            "change_password": False,
            "extra": {}
        })

        # Updating non-existing user should fail
        self.assertRaises(UserReplaceError,
                          self.arango.replace_user,
                          username=generate_user_name(self.arango),
                          password="******")
Esempio n. 2
0
 def test_update_user(self):
     self.assertEqual(
         self.arango.create_user(self.username, "password"),
         {"active": True, "change_password": False, "extra": {}}
     )
     self.assertEqual(
         self.arango.update_user(
             username=self.username,
             password="******",
             change_password=True,
             extra={"key": "val"}
         ),
         {
             "active": True,
             "change_password": True,
             "extra": {"key": "val"}
         }
     )
     self.assertEqual(
         self.arango.user(username=self.username),
         {
             "active": True,
             "change_password": True,
             "extra": {"key": "val"}
         }
     )
     # Updating a non-existing user should fail
     self.assertRaises(
         UserUpdateError,
         self.arango.update_user,
         username=generate_user_name(self.arango),
         password="******"
     )
Esempio n. 3
0
    def setUp(self):
        self.arango = Arango()
        self.username = generate_user_name(self.arango)

        # Test user cleanup
        self.addCleanup(self.arango.delete_user,
                        username=self.username, safe_delete=True)
Esempio n. 4
0
    def setUp(self):
        self.arango = Arango()
        self.username = generate_user_name(self.arango)

        # Test user cleanup
        self.addCleanup(self.arango.delete_user,
                        username=self.username,
                        safe_delete=True)
Esempio n. 5
0
    def test_delete_user(self):
        self.assertEqual(self.arango.create_user(self.username, "password"), {
            "active": True,
            "change_password": False,
            "extra": {}
        })
        self.assertIn(self.username, self.arango.users)
        self.arango.delete_user(self.username)
        self.assertNotIn(self.username, self.arango.users)

        # Deleting non-existing user should fail
        self.assertRaises(UserDeleteError,
                          self.arango.delete_user,
                          username=generate_user_name(self.arango))
Esempio n. 6
0
 def test_get_user(self):
     self.assertEqual(self.arango.create_user(self.username, "password"), {
         "active": True,
         "change_password": False,
         "extra": {}
     })
     self.assertEqual(self.arango.user(self.username), {
         "active": True,
         "change_password": False,
         "extra": {}
     })
     # Retrieving a non-existing user should fail
     self.assertRaises(UserNotFoundError,
                       self.arango.user,
                       username=generate_user_name(self.arango))
Esempio n. 7
0
 def test_get_user(self):
     self.assertEqual(
         self.arango.create_user(self.username, "password"),
         {"active": True, "change_password": False, "extra": {}}
     )
     self.assertEqual(
         self.arango.user(self.username),
         {"active": True, "change_password": False, "extra": {}}
     )
     # Retrieving a non-existing user should fail
     self.assertRaises(
         UserNotFoundError,
         self.arango.user,
         username=generate_user_name(self.arango)
     )
Esempio n. 8
0
    def test_delete_user(self):
        self.assertEqual(
            self.arango.create_user(self.username, "password"),
            {"active": True, "change_password": False, "extra": {}}
        )
        self.assertIn(self.username, self.arango.users)
        self.arango.delete_user(self.username)
        self.assertNotIn(self.username, self.arango.users)

        # Deleting non-existing user should fail
        self.assertRaises(
            UserDeleteError,
            self.arango.delete_user,
            username=generate_user_name(self.arango)
        )