Sounds about right. I cheat though. I use NANO_ENV=testing and just run the tests with nocks off. Then i create my own mocks cause i can ignore most of the headers stuff and even some parts of the body for the sake of tests.
The ability to run mocked and un-mocked tests is critical. On pull requests you will get pepple still learning about all of this and they will commit stuff that 1) only works on their system or b) works only as a result of stuff they did in between and didnt realize wont work for anyone else. Ideally nock would do all of this for you, even though i like not having magic in nock (COC). I would like nock to record json like the one i create. That would be nice. Nuno On May 24, 2012, at 8:50 AM, Oliver Leics <[email protected]> wrote: > First, thanks for the replies. > > Right now I'm thinking about how Nock works and if Nock can be used to > test this: > > * Create a user and configure its security (rights, wrongs, etc) > * Create a database and let only that user read and write to this > database (per _security-doc) > * Create another user > * Test what the other user is able to do with the previously created > and hopefully "secured" database > > Right now I would it do like this: > > * Run the above tests against a real couch while recording with Nock. > * If the tests pass, save the records and use them for the tests with > Nock enabled. > * When I run the tests with Nock enabled, what I'll see is a _replay_ > of the real test. > * With that replay I can test if the request is correct > * With that replay I can not test if the response is still correct if > the configuration of the security for the users and the databases > differs from the real test-run. > > Am I in the right picture? > > On Thu, May 24, 2012 at 1:11 AM, Nuno Job <[email protected]> wrote: >> Also >> >> Nock does recording. >> Check the docs. >> >> Nuno >> >> On Thu, May 24, 2012 at 12:06 AM, Nuno Job <[email protected]> wrote: >>> Oliver -- nano does this perfectly. >>> >>> It is the best way. I have tried them all, for lots of time, and there >>> are reasons why I choose the tools I did: >>> >>> * Blogpost - >>> http://writings.nunojob.com/2012/05/Mock-HTTP-Integration-Testing-in-Node.js-using-Nock-and-Specify.html >>> * Example of _exactly_ what you described - >>> https://github.com/dscape/nano/blob/master/tests/shared/cookie.js#L15 >>> * Nocks for those tests - >>> https://github.com/dscape/nano/blob/master/tests/fixtures/shared/cookie.json#L1 >>> >>> I have used node-tap, mocha, and vows on nano. I have built a DSL to >>> remove the DSL from all of them. I have times and times again >>> refactored those tests. Right now it's perfect. >>> >>> The only problem (as you know) is that I did the bin to run the tests >>> that works exclusively on windows. Solving that however is a matter of >>> seconds. And if you find a better way than nano, do let me know. >>> >>> Nuno >>> >>> On Wed, May 23, 2012 at 9:41 PM, Oliver Leics <[email protected]> >>> wrote: >>>> Hallo, >>>> >>>> as the Subject already suggests, I would like to run tests on >>>> travis-ci and those tests need full admin rights on a couch. >>>> >>>> I think there is no way right now but maybe someone knows better. Anyone? >>>> >>>> Thanks in advance, Oliver. >>>> >>>> -- >>>> Job Board: http://jobs.nodejs.org/ >>>> Posting guidelines: >>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >>>> You received this message because you are subscribed to the Google >>>> Groups "nodejs" group. >>>> To post to this group, send email to [email protected] >>>> To unsubscribe from this group, send email to >>>> [email protected] >>>> For more options, visit this group at >>>> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en > > > > -- > Oliver Leics @ G+ > https://plus.google.com/112912441146721682527 > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
