Exemplo n.º 1
0
    def test_doesnt_change_builtin_groups(self):
        current_name = self.factory.default_group.name

        response = self.make_request('post', '/api/groups/{}'.format(self.factory.default_group.id),
                                     user=self.factory.create_admin(),
                                     data={'name': 'Another Name'})

        self.assertEqual(response.status_code, 400)
        self.assertEqual(current_name, Group.get_by_id(self.factory.default_group.id).name)
Exemplo n.º 2
0
    def test_doesnt_change_builtin_groups(self):
        current_name = self.factory.default_group.name

        response = self.make_request('post',
                                     '/api/groups/{}'.format(
                                         self.factory.default_group.id),
                                     user=self.factory.create_admin(),
                                     data={'name': 'Another Name'})

        self.assertEqual(response.status_code, 400)
        self.assertEqual(current_name,
                         Group.get_by_id(self.factory.default_group.id).name)
Exemplo n.º 3
0
def setup_test_admin():
    from redash.models import Group, Organization, User, db

    _wait_for_db_connection(db)

    user_name = "test1"
    email = "*****@*****.**"
    password = "******"

    default_org = Organization.get_by_id(1)
    admin_group = Group.get_by_id(1)
    default_group = Group.get_by_id(2)

    user = User(
        org=default_org,
        name=user_name,
        email=email,
        group_ids=[admin_group.id, default_group.id],
    )
    user.hash_password(password)
    db.session.add(user)
    db.session.commit()