acvetkov / sinon-chrome

Testing chrome extensions with Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to mock test user authentication (hello.js and google+)

kaidatavis opened this issue · comments

Hi,

I am working on a chrome extension that requires user to sign in and using hello.js to handle the authentication with different oauth services. So far I am only using google+ authentication because this is a chrome extension and user should have a google account.

I want to 'mock' the google+ authentication service using sinon-chrome, so the extension does not have to communicate with google+ during the test. I can see two problems:

  1. The authentication communication is meant to be secure, so I am not sure how to capture the response from google+ oauth service and use it in the test;
  2. Currently I treat hello.js as a black box, and would like to keep it that way for the testing: ideally no change of the code is needed for anything inside hello.js.

Thanks,