shopify-mock icon indicating copy to clipboard operation
shopify-mock copied to clipboard

Give unauthorized access

Open Aru1 opened this issue 12 years ago • 6 comments

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

Aru1 avatar Nov 28 '12 06:11 Aru1

This occur because when internet is on, it tries to authenticate with live shopify and when off, it give error for fakeweb NetConnectNotAllowed error

Aru1 avatar Nov 28 '12 10:11 Aru1

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?

cannikin avatar Mar 23 '15 18:03 cannikin

It seems like this project might not be active anymore, this problem is fixed over on this fork: https://github.com/reverbdev/shopify-mock

jasonbuehler avatar Apr 16 '15 14:04 jasonbuehler

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.

travishaynes avatar Apr 16 '15 15:04 travishaynes

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.

cannikin avatar Apr 16 '15 20:04 cannikin

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

travishaynes avatar Apr 21 '15 23:04 travishaynes