Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing collection security. #137

Open
ghost opened this issue Mar 16, 2015 · 0 comments
Open

Testing collection security. #137

ghost opened this issue Mar 16, 2015 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 16, 2015

Hello everybody.

I'm trying to have tested my collection security, for that I have the following:

if (!(typeof MochaWeb === 'undefined')) {
MochaWeb.testOnly(function () {

            before(function(done) {
                    Meteor.logout(function(error) {
                        if(error) {
                            testLog.error('problem trying to logout', error.toString());
                        }
                        done();
                    });
            });

           describe("guest user cannot perform collection operations", function() {

                it("guest users cannot insert any data", function() {

                    // this is an object that complains with Parts SimpleSchema
                    var newPart = wolfSettings.dataset.partNotInserted;

                    try {
                        var result = Parts.insert(newPart);
                        chai.expect(result).is.not.ok;

                    } catch(e) {
                        chai.assert.isTrue(false, "exception was thrown " + e.message);
                    }

                });

          });

});
}

The problem is the tests is always failing, Part seems to be inserted into the database.
"exception was thrown expected 'yGu4Nu3G6N9MisAkC' to be falsy: expected false to be true"

Is the meteor mirror copying the collections without the allow security defined on the main collection?

Many thanks,

Diego B.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants