Per review, clean up code

This commit is contained in:
Gaetan Craig-Riou
2024-10-07 11:29:10 +11:00
parent 10c3c53aad
commit 224738e0a1
5 changed files with 10 additions and 12 deletions

View File

@@ -4,8 +4,6 @@
#
module ConnectedApps
class Vine < ConnectedApp
VINE_API_URL = "https://vine-staging.openfoodnetwork.org.au/api/v1/my-team"
def connect(api_key:, vine_api:, **_opts)
response = vine_api.my_team

View File

@@ -9,14 +9,14 @@ http_interactions:
headers:
X-Authorization:
- "<HIDDEN-VINE-TOKEN>"
Accept:
- application/json
User-Agent:
- Faraday v2.9.0
Authorization:
- "<HIDDEN-AUTHORIZATION-HEADER>"
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Accept:
- "*/*"
response:
status:
code: 200
@@ -35,7 +35,7 @@ http_interactions:
Cache-Control:
- no-cache, private
Date:
- Wed, 02 Oct 2024 00:27:30 GMT
- Mon, 07 Oct 2024 04:07:27 GMT
Access-Control-Allow-Origin:
- "*"
X-Frame-Options:
@@ -46,8 +46,8 @@ http_interactions:
- nosniff
body:
encoding: ASCII-8BIT
string: '{"meta":{"responseCode":200,"limit":50,"offset":0,"message":"","cached":true,"cached_at":"2024-10-02
00:27:30","availableRelations":["teamUsers.user","country"]},"data":{"id":1,"name":"OK200
Team","country_id":14,"created_at":"2024-09-12T06:39:07.000000Z","updated_at":"2024-09-12T06:39:07.000000Z","deleted_at":null}}'
recorded_at: Wed, 02 Oct 2024 00:27:30 GMT
string: '{"meta":{"responseCode":200,"limit":50,"offset":0,"message":"","cached":true,"cached_at":"2024-10-07
04:07:27","availableRelations":["teamUsers.user","country"]},"data":{"id":9,"name":"Open
Food Network TEST","country_id":14,"created_at":"2024-10-05T03:39:50.000000Z","updated_at":"2024-10-05T03:39:50.000000Z","deleted_at":null}}'
recorded_at: Mon, 07 Oct 2024 04:07:27 GMT
recorded_with: VCR 6.2.0

View File

@@ -15,7 +15,7 @@ RSpec.describe ConnectedApps::Vine do
connected_app.connect(api_key: vine_api_key, vine_api: )
end
context "when request succeed", :vcr do
context "when request succeed" do
it "store the vine api key" do
allow(vine_api).to receive(:my_team).and_return(mock_api_response(true))

View File

@@ -2,7 +2,7 @@
require "spec_helper"
RSpec.describe Admin::ConnectedAppsController do
RSpec.describe "Admin ConnectedApp" do
let(:user) { create(:admin_user) }
let(:enterprise) { create(:enterprise, owner: user) }
let(:edit_enterprise_url) { "#{edit_admin_enterprise_url(enterprise)}#/connected_apps_panel" }

View File

@@ -52,7 +52,7 @@ RSpec.describe VineApiService do
end
context "when a request succeed", :vcr do
it "returns the response do" do
it "returns the response" do
response = vine_api.my_team
expect(response.success?).to be(true)