Beispiel #1
0
    def delete():
        json_data = request.get_json(force=True)
        if not json_data:
            return {'message': 'No input data provided'}, 400
        data, errors = user_delete_request_schema.load(json_data)

        if errors:
            return errors, 422

        from AccountManager.account_manager import AccountManager

        errors = []
        for user in data['list_of_users']:
            # try:
            #     AccountManager.delete_user(user)
            # except ValueError as e:
            #     errors.append("Error deleting user " + user + ": " + str(e))
            AccountManager.delete_user(user)
        if errors:
            print(errors)
            return {"success": False, "errors": errors}, 200

        return {"success": True}, 200
Beispiel #2
0
 def test_delete_user(self):
     AccountManager.delete_user(user1['username'])
     self.assertIsNone(get_user(user1['username']))
Beispiel #3
0
 def tearDown(self):
     AccountManager.delete_user('updated_username')
     AccountManager.delete_user(user2['username'])
     AccountManager.delete_user(user1['username'])
Beispiel #4
0
 def tearDown(self):
     self.assertTrue(AccountManager.delete_user(user1['username']))
     self.assertTrue(AccountManager.delete_user(user2['username']))