Ejemplo n.º 1
0
 def test_unauthenticated(self, app):
     """Methods is called as unautheticated user"""
     logout(app)
     transaction_begin(app)
     app.get("/users/removeaccount/1", status=401)
     app.get("/")
     transaction_rollback(app)
Ejemplo n.º 2
0
 def test_POST_existing_group(self, app):
     # FIXME: https://github.com/ringo-framework/ringo/issues/4 (ti) <2016-01-18 16:46>
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"name": "admins"}
     app.post("/usergroups/create", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 3
0
 def test_POST_existing_group(self, app):
     # FIXME: https://github.com/ringo-framework/ringo/issues/4 (ti) <2016-01-18 16:46> 
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"name": "admins"}
     app.post("/usergroups/create", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 4
0
 def test_update_POST_missing_label_plural(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"name": "modules", "label": "Modul",
               "label_plural": ""}
     app.post("/modules/update/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 5
0
 def test_delete_POST_admin_confirm_yes(self, app):
     # FIXME: https://github.com/ringo-framework/ringo/issues/5 (ti) <2016-01-18 16:46> 
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"confirmed": 1}
     app.post("/usergroups/delete/1", params=values, status=302)
     transaction_rollback(app)
Ejemplo n.º 6
0
 def test_unauthenticated(self, app):
     """Methods is called as unautheticated user"""
     logout(app)
     transaction_begin(app)
     app.get("/users/removeaccount/1", status=401)
     app.get("/")
     transaction_rollback(app)
Ejemplo n.º 7
0
 def test_change_password_tooshort(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"login": "******", "oldpassword": "******",
               "password": "******",
               "_retype_password": "******"}
     result = app.post("/users/changepassword/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 8
0
 def test_change_password_tooshort(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"login": "******", "oldpassword": "******",
               "password": "******",
               "_retype_password": "******"}
     result = app.post("/users/changepassword/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 9
0
 def test_POST(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     create_user(app, "test")
     udata = search_data(app, "users", "login", "test")
     gdata = search_data(app, "usergroups", "name", "test")
     # Check that the default_gid is set to the users usergroup
     assert gdata.get("id") == udata.get("default_gid") 
     transaction_rollback(app)
Ejemplo n.º 10
0
 def test_delete_POST_admin_confirm_yes(self, app):
     """admin user group can not be deleted see
     https://github.com/ringo-framework/ringo/issues/5 for more
     details."""
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"confirmed": 1}
     app.post("/usergroups/delete/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 11
0
 def test_delete_POST_admin_confirm_yes(self, app):
     """admin user group can not be deleted see
     https://github.com/ringo-framework/ringo/issues/5 for more
     details."""
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"confirmed": 1}
     app.post("/usergroups/delete/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 12
0
 def test_POST(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     create_user(app, "test")
     udata = search_data(app, "users", "login", "test")
     gdata = search_data(app, "usergroups", "name", "test")
     # Check that the default_gid is set to the users usergroup
     assert gdata.get("id") == udata.get("default_gid")
     transaction_rollback(app)
Ejemplo n.º 13
0
 def test_update_POST_missing_title(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {
         "title": "",
         "definiton":
         '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
     }
     app.post("/forms/update/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 14
0
 def test_update_POST(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {
         "name": "modules",
         "label": "Modul",
         "label_plural": "Modules"
     }
     app.post("/modules/update/1", params=values, status=302)
     transaction_rollback(app)
Ejemplo n.º 15
0
    def test_setstandin(self, app):
        user = search_data(app, "users", "login", "test123")
        app.get("/usergroups/setstandin/%s" % user["default_gid"])

        admin = search_data(app, "users", "login", "admin")
        app.post("/usergroups/setstandin/%s" % user["default_gid"],
                 params={"members": [admin["id"], user["id"]]}, status=302)

        app.get("/")
        transaction_rollback(app)
Ejemplo n.º 16
0
 def test_POST_existing_user(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"login": "******",
               "password": "******",
               "_retype_password": "******",
               "_first_name": u"Först", "_last_name": "Last",
               "_email": "*****@*****.**"}
     app.post("/users/create", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 17
0
 def test_POST(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {
         "title": "test",
         "definiton":
         '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
     }
     app.post("/forms/create", params=values, status=302)
     transaction_rollback(app)
Ejemplo n.º 18
0
    def test_setstandin(self, app):
        user = search_data(app, "users", "login", "test123")
        app.get("/usergroups/setstandin/%s" % user["default_gid"])

        admin = search_data(app, "users", "login", "admin")
        app.post("/usergroups/setstandin/%s" % user["default_gid"],
                 params={"members": [admin["id"], user["id"]]}, status=302)

        app.get("/")
        transaction_rollback(app)
Ejemplo n.º 19
0
 def test_POST_existing_user(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"login": "******",
               "password": "******",
               "_retype_password": "******",
               "_first_name": u"Först", "_last_name": "Last",
               "_email": "*****@*****.**"}
     app.post("/users/create", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 20
0
 def test_create(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     create_user(app, "test")
     user = search_data(app, "users", "login", "test")
     user["login"] = "******"
     app.post("/users/update/%s" % user["id"], params=user, status=302)
     usergroup = search_data(app, "usergroups", "name", user["login"])
     assert usergroup
     app.get("/")
     transaction_rollback(app)
Ejemplo n.º 21
0
 def test_unauthorized(self, app):
     """Method is called with a different uid than the id uf the
     current user. This is not allowed the users are only allowed to
     delete their own account."""
     login(app, "admin", "secret")
     transaction_begin(app)
     create_user(app, "test")
     user = search_data(app, "users", "login", "test")
     app.get("/users/removeaccount/%s" % user["id"], params=user, status=403)
     app.get("/")
     transaction_rollback(app)
Ejemplo n.º 22
0
 def test_create(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     create_user(app, "test")
     user = search_data(app, "users", "login", "test")
     user["login"] = "******"
     app.post("/users/update/%s" % user["id"], params=user, status=302)
     usergroup = search_data(app, "usergroups", "name", user["login"])
     assert usergroup
     app.get("/")
     transaction_rollback(app)
Ejemplo n.º 23
0
    def test_remove_permission(self, app):
        login(app, "admin", "secret")
        transaction_begin(app)
        values = {"label": "Users", "name": "user", "permissions": [21,30],
                  "admin": "False"}
        app.post("/roles/update/1", params=values, status=302)
        values = {"label": "Users", "name": "user", "permissions": [21],
                  "admin": "False"}
        app.post("/roles/update/1", params=values, status=302)

        transaction_rollback(app)
Ejemplo n.º 24
0
 def test_unauthorized(self, app):
     """Method is called with a different uid than the id uf the
     current user. This is not allowed the users are only allowed to
     delete their own account."""
     login(app, "admin", "secret")
     transaction_begin(app)
     create_user(app, "test")
     user = search_data(app, "users", "login", "test")
     app.get("/users/removeaccount/%s" % user["id"], params=user, status=403)
     app.get("/")
     transaction_rollback(app)
Ejemplo n.º 25
0
 def test_delete(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"login": "******",
               "password": "******",
               "_retype_password": "******",
               "_first_name": u"Först", "_last_name": "Last",
               "_email": "*****@*****.**"}
     result = app.post("/users/create", params=values, status=302)
     id = result.headers["Location"].split("/")[-1]
     app.get("/users/delete/%s" % id)
     app.get("/users/list")
     transaction_rollback(app)
Ejemplo n.º 26
0
 def test_delete(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"login": "******",
               "password": "******",
               "_retype_password": "******",
               "_first_name": u"Först", "_last_name": "Last",
               "_email": "*****@*****.**"}
     result = app.post("/users/create", params=values, status=302)
     id = result.headers["Location"].split("/")[-1]
     app.get("/users/delete/%s" % id)
     app.get("/users/list")
     transaction_rollback(app)
Ejemplo n.º 27
0
    def test_confirmed(self, app):
        """User must confirm the deletion twice"""
        transaction_begin(app)
        login(app, "admin", "secret")
        create_user(app, "test")
        user = search_data(app, "users", "login", "test")
        login(app, "test", "123123123qwe")

        app.get("/users/removeaccount/%s" % user["id"], status=200)
        params = {"_confirm_remove_account2": ["1"], "_confirm_remove_account": ["1"]}
        app.post("/users/removeaccount/%s" % user["id"], params=params, status=302)

        app.get("/")
        transaction_rollback(app)
Ejemplo n.º 28
0
    def test_confirmed(self, app):
        """User must confirm the deletion twice"""
        transaction_begin(app)
        login(app, "admin", "secret")
        create_user(app, "test")
        user = search_data(app, "users", "login", "test")
        login(app, "test", "123123123qwe")

        app.get("/users/removeaccount/%s" % user["id"], status=200)
        params = {"_confirm_remove_account2": ["1"], "_confirm_remove_account": ["1"]}
        app.post("/users/removeaccount/%s" % user["id"], params=params, status=302)

        app.get("/")
        transaction_rollback(app)
Ejemplo n.º 29
0
    def test_remove_permission(self, app):
        login(app, "admin", "secret")
        transaction_begin(app)
        values = {
            "label": "Users",
            "name": "user",
            "permissions": [21, 30],
            "admin": "False"
        }
        app.post("/roles/update/1", params=values, status=302)
        values = {
            "label": "Users",
            "name": "user",
            "permissions": [21],
            "admin": "False"
        }
        app.post("/roles/update/1", params=values, status=302)

        transaction_rollback(app)
Ejemplo n.º 30
0
 def test_POST(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"name": "test"}
     app.post("/usergroups/create", params=values, status=302)
     transaction_rollback(app)
Ejemplo n.º 31
0
 def test_POST(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"title": "test", "definiton": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'}
     app.post("/forms/create", params=values, status=302)
     transaction_rollback(app)
Ejemplo n.º 32
0
 def test_delete(self, app):
     """Deletion of profiles is not supported in the webinterface"""
     login(app, "admin", "secret")
     transaction_begin(app)
     app.get("/profiles/delete/1", status=404)
     transaction_rollback(app)
Ejemplo n.º 33
0
 def test_update_POST(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"email": "*****@*****.**"}
     app.post("/profiles/update/1", params=values, status=302)
     transaction_rollback(app)
Ejemplo n.º 34
0
 def test_delete(self, app):
     """Deleting of modules is not supported in the webinterface"""
     login(app, "admin", "secret")
     transaction_begin(app)
     app.get("/modules/delete/1", status=404)
     transaction_rollback(app)
Ejemplo n.º 35
0
 def test_update_POST(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"login": "******"}
     app.post("/users/update/1", params=values, status=302)
     transaction_rollback(app)
Ejemplo n.º 36
0
 def test_update_POST_notunique(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"name": "admin", "label": "admintest"}
     app.post("/roles/update/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 37
0
 def test_POST_existing_group(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"name": "admin", "label": "admin"}
     app.post("/roles/create", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 38
0
 def test_update_POST_missing_defintion(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"title": "test", "definiton": ''}
     app.post("/forms/update/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 39
0
 def test_update_POST_notunique(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"name": "admin", "label": "admintest"}
     app.post("/roles/update/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 40
0
 def test_update_POST(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"login": "******"}
     app.post("/users/update/1", params=values, status=302)
     transaction_rollback(app)
Ejemplo n.º 41
0
 def test_update_POST_missing_name(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"name": ""}
     app.post("/usergroups/update/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 42
0
 def test_POST(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"name": "test"}
     app.post("/usergroups/create", params=values, status=302)
     transaction_rollback(app)
Ejemplo n.º 43
0
 def test_update_POST(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"email": "*****@*****.**"}
     app.post("/profiles/update/1", params=values, status=302)
     transaction_rollback(app)
Ejemplo n.º 44
0
 def test_update_POST_missing_name(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"name": ""}
     app.post("/usergroups/update/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 45
0
 def test_update_POST_missing_email(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"email": ""}
     app.post("/profiles/update/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 46
0
 def test_delete(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     app.get("/usergroups/delete/2")
     transaction_rollback(app)
Ejemplo n.º 47
0
 def test_update_POST_missing_email(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"email": ""}
     app.post("/profiles/update/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 48
0
 def test_POST_existing_group(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"name": "admin", "label": "admin"}
     app.post("/roles/create", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 49
0
 def test_delete_POST_admin_confirm_yes(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"confirmed": 1}
     app.post("/forms/delete/1", params=values, status=302)
     transaction_rollback(app)
Ejemplo n.º 50
0
 def test_delete_POST_usergroup_confirm_yes(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"confirmed": 1}
     app.post("/usergroups/delete/2", params=values, status=302)
     transaction_rollback(app)
Ejemplo n.º 51
0
 def test_update_POST_missing_title(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"title": "", "definiton": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'}
     app.post("/forms/update/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 52
0
 def test_update_POST_missing_defintion(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     values = {"title": "test", "definiton": ''}
     app.post("/forms/update/1", params=values, status=200)
     transaction_rollback(app)
Ejemplo n.º 53
0
 def test_delete(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     app.get("/forms/delete/2")
     transaction_rollback(app)
Ejemplo n.º 54
0
 def test_POST(self, app):
     login(app, "admin", "secret")
     transaction_begin(app)
     create_user(app, "test")
     transaction_rollback(app)