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

        if errors:
            return errors, 422

        from AccountManager.account_manager import AccountManager
        errors = []
        for group in data['list_of_groups']:
            try:
                AccountManager.delete_group(group)
            except ValueError as e:
                errors.append("Error deleting group " + group + ": " + str(e))
        if errors:
            print(errors)
            return {"success": False, "errors": errors}, 200

        return {"success": True}, 200
Exemplo n.º 2
0
 def tearDown(self):
     AccountManager.delete_group(start_id)
Exemplo n.º 3
0
 def test_group_delete(self):
     AccountManager.delete_group(1000)
     self.assertIsNone(get_group(1000))
Exemplo n.º 4
0
 def test_group_delete(self):
     self.assertTrue(AccountManager.delete_group(1000))
Exemplo n.º 5
0
 def tearDown(self):
     for i in range(group_count):
         AccountManager.delete_group(start_id + i)
Exemplo n.º 6
0
 def tearDown(self):
     for line in file_users:
         current = get_user(line[0]).group_id
         AccountManager.delete_group(current)