Refactor EPP users to API users

This commit is contained in:
Martin Lensment 2015-01-29 14:13:49 +02:00
parent b8494993ea
commit c91c9c8ebf
44 changed files with 154 additions and 150 deletions

View file

@ -1,22 +1,22 @@
require 'rails_helper'
describe Repp::DomainV1 do
let(:epp_user) { Fabricate(:epp_user) }
let(:api_user) { Fabricate(:api_user) }
before(:each) { create_settings }
describe 'GET /repp/v1/domains' do
it 'returns domains of the current registrar' do
Fabricate.times(2, :domain, registrar: epp_user.registrar)
Fabricate.times(2, :domain, registrar: api_user.registrar)
get_with_auth '/repp/v1/domains', {}, epp_user
get_with_auth '/repp/v1/domains', {}, api_user
expect(response.status).to eq(200)
body = JSON.parse(response.body)
expect(body['total_pages']).to eq(1)
# TODO: Maybe there is a way not to convert from and to json again
expect(body['domains'].to_json).to eq(epp_user.registrar.domains.to_json)
expect(body['domains'].to_json).to eq(api_user.registrar.domains.to_json)
log = ApiLog::ReppLog.last
expect(log[:request_path]).to eq('/repp/v1/domains')