shopify-mock
shopify-mock copied to clipboard
Give unauthorized access
Hi, I installed the gem. It didn't create any fixture folder. when i run the example give by you, it gave me unauthorized access error
This occur because when internet is on, it tries to authenticate with live shopify and when off, it give error for fakeweb NetConnectNotAllowed error
This original issue is from > 2 years ago, but I'm seeing something similar today:
rails c test
ShopifyAPI::Mock.enabled?
=> true
ShopifyAPI::Mock.allow_internet?
=> true
order = ShopifyAPI::Session.temp("test", "randomtoken") { ShopifyAPI::Order.first }
=> ActiveResource::UnauthorizedAccess: Failed. Response code = 401. Response message = Unauthorized.
ShopifyAPI::Mock.allow_internet = false
=> false
order = ShopifyAPI::Session.temp("test", "randomtoken") { ShopifyAPI::Order.first }
=> FakeWeb::NetConnectNotAllowedError: Real HTTP connections are disabled. Unregistered request: GET https://test.myshopify.com/admin/orders.json
Did something change in Rails 4.2?
It seems like this project might not be active anymore, this problem is fixed over on this fork: https://github.com/reverbdev/shopify-mock
Yeah, this project hasn't been worked on in a long time. Shortly after I wrote this gem I discovered ActiveResource::HttpMock and have been using that ever since. I have been considering updating this gem to use that instead of FakeWeb, but I'm pretty busy with other projects at the moment and don't know when I can get to it. But I will be updating this gem eventually. I just don't know when.
Neat, I didn't know about HttpMock, that's pretty handy. Looks like a little more manual setup than this gem, but should do the same job.
I've started a new branch for implemented the HttpMock version of the gem. I'm still working on setting up all the fixtures, but I've got a pretty good start on it.
https://github.com/travishaynes/shopify-mock/tree/httpmock