mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-29 16:16:22 +00:00
cad881db1c
habia un monton de inconsistencias que hacian que los posts se guardaran en cualquier lado, que empezaron a saltar apenas introdujimos la gestión de licencias
40 lines
1.1 KiB
Ruby
40 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'test_helper'
|
|
|
|
module Api
|
|
module V1
|
|
class SitesControllerTest < ActionDispatch::IntegrationTest
|
|
setup do
|
|
@rol = create :rol
|
|
@site = @rol.site
|
|
@usuarie = @rol.usuarie
|
|
|
|
@authorization = {
|
|
Authorization: ActionController::HttpAuthentication::Basic
|
|
.encode_credentials(ENV['HTTP_BASIC_USER'],
|
|
ENV['HTTP_BASIC_PASSWORD'])
|
|
}
|
|
end
|
|
|
|
teardown do
|
|
@site.destroy
|
|
end
|
|
|
|
test 'se puede generar un certificado' do
|
|
get v1_sites_allowed_url, headers: @authorization,
|
|
params: { domain: @site.name }
|
|
assert_response :ok
|
|
|
|
get v1_sites_allowed_url, headers: @authorization,
|
|
params: { domain: SecureRandom.hex }
|
|
assert_response :not_found
|
|
end
|
|
|
|
test 'se puede obtener un listado de todos' do
|
|
get v1_sites_url, headers: @authorization, as: :json
|
|
assert_equal Site.all.pluck(:name), JSON.parse(response.body)
|
|
end
|
|
end
|
|
end
|
|
end
|