mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
Rename Message to Notification
This commit is contained in:
parent
5ba2170324
commit
8765baf319
32 changed files with 243 additions and 229 deletions
|
@ -6,7 +6,8 @@ module Admin
|
||||||
|
|
||||||
domain.transaction do
|
domain.transaction do
|
||||||
domain.schedule_force_delete
|
domain.schedule_force_delete
|
||||||
domain.registrar.messages.create!(body: t('force_delete_set_on_domain', domain_name: domain.name))
|
domain.registrar.notifications.create!(body: t('force_delete_set_on_domain',
|
||||||
|
domain_name: domain.name))
|
||||||
|
|
||||||
if notify_by_email?
|
if notify_by_email?
|
||||||
DomainDeleteMailer.forced(domain: domain,
|
DomainDeleteMailer.forced(domain: domain,
|
||||||
|
|
|
@ -9,12 +9,12 @@ class Epp::PollsController < EppController
|
||||||
private
|
private
|
||||||
|
|
||||||
def req_poll
|
def req_poll
|
||||||
@message = current_user.queued_messages.last
|
@notification = current_user.queued_notifications.last
|
||||||
|
|
||||||
render_epp_response 'epp/poll/poll_no_messages' and return unless @message
|
render_epp_response 'epp/poll/poll_no_messages' and return unless @notification
|
||||||
if @message.attached_obj_type && @message.attached_obj_id
|
if @notification.attached_obj_type && @notification.attached_obj_id
|
||||||
begin
|
begin
|
||||||
@object = Object.const_get(@message.attached_obj_type).find(@message.attached_obj_id)
|
@object = Object.const_get(@notification.attached_obj_type).find(@notification.attached_obj_id)
|
||||||
rescue => problem
|
rescue => problem
|
||||||
# the data model might be inconsistent; or ...
|
# the data model might be inconsistent; or ...
|
||||||
# this could happen if the registrar does not dequeue messages, and then the domain was deleted
|
# this could happen if the registrar does not dequeue messages, and then the domain was deleted
|
||||||
|
@ -28,7 +28,7 @@ class Epp::PollsController < EppController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if @message.attached_obj_type == 'Keyrelay'
|
if @notification.attached_obj_type == 'Keyrelay'
|
||||||
render_epp_response 'epp/poll/poll_keyrelay'
|
render_epp_response 'epp/poll/poll_keyrelay'
|
||||||
else
|
else
|
||||||
render_epp_response 'epp/poll/poll_req'
|
render_epp_response 'epp/poll/poll_req'
|
||||||
|
@ -36,9 +36,9 @@ class Epp::PollsController < EppController
|
||||||
end
|
end
|
||||||
|
|
||||||
def ack_poll
|
def ack_poll
|
||||||
@message = current_user.queued_messages.find_by(id: params[:parsed_frame].css('poll').first['msgID'])
|
@notification = current_user.queued_notifications.find_by(id: params[:parsed_frame].css('poll').first['msgID'])
|
||||||
|
|
||||||
unless @message
|
unless @notification
|
||||||
epp_errors << {
|
epp_errors << {
|
||||||
code: '2303',
|
code: '2303',
|
||||||
msg: I18n.t('message_was_not_found'),
|
msg: I18n.t('message_was_not_found'),
|
||||||
|
@ -47,7 +47,7 @@ class Epp::PollsController < EppController
|
||||||
handle_errors and return
|
handle_errors and return
|
||||||
end
|
end
|
||||||
|
|
||||||
handle_errors(@message) and return unless @message.dequeue
|
handle_errors(@notification) and return unless @notification.dequeue
|
||||||
render_epp_response 'epp/poll/poll_ack'
|
render_epp_response 'epp/poll/poll_ack'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -56,6 +56,6 @@ class Epp::PollsController < EppController
|
||||||
end
|
end
|
||||||
|
|
||||||
def resource
|
def resource
|
||||||
@message
|
@notification
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,13 +7,13 @@ class DomainDeleteConfirmJob < Que::Job
|
||||||
|
|
||||||
case action
|
case action
|
||||||
when RegistrantVerification::CONFIRMED
|
when RegistrantVerification::CONFIRMED
|
||||||
domain.poll_message!(:poll_pending_delete_confirmed_by_registrant)
|
domain.notify_registrar(:poll_pending_delete_confirmed_by_registrant)
|
||||||
domain.apply_pending_delete!
|
domain.apply_pending_delete!
|
||||||
raise_errors!(domain)
|
raise_errors!(domain)
|
||||||
|
|
||||||
when RegistrantVerification::REJECTED
|
when RegistrantVerification::REJECTED
|
||||||
domain.statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
domain.statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||||
domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
|
domain.notify_registrar(:poll_pending_delete_rejected_by_registrant)
|
||||||
|
|
||||||
domain.cancel_pending_delete
|
domain.cancel_pending_delete
|
||||||
domain.save(validate: false)
|
domain.save(validate: false)
|
||||||
|
|
|
@ -8,7 +8,7 @@ class DomainDeleteJob < Que::Job
|
||||||
|
|
||||||
domain.destroy
|
domain.destroy
|
||||||
bye_bye = domain.versions.last
|
bye_bye = domain.versions.last
|
||||||
domain.registrar.messages.create!(
|
domain.registrar.notifications.create!(
|
||||||
body: "#{I18n.t(:domain_deleted)}: #{domain.name}",
|
body: "#{I18n.t(:domain_deleted)}: #{domain.name}",
|
||||||
attached_obj_id: bye_bye.id,
|
attached_obj_id: bye_bye.id,
|
||||||
attached_obj_type: bye_bye.class.to_s
|
attached_obj_type: bye_bye.class.to_s
|
||||||
|
|
|
@ -8,7 +8,7 @@ class DomainUpdateConfirmJob < Que::Job
|
||||||
case action
|
case action
|
||||||
when RegistrantVerification::CONFIRMED
|
when RegistrantVerification::CONFIRMED
|
||||||
old_registrant = domain.registrant
|
old_registrant = domain.registrant
|
||||||
domain.poll_message!(:poll_pending_update_confirmed_by_registrant)
|
domain.notify_registrar(:poll_pending_update_confirmed_by_registrant)
|
||||||
raise_errors!(domain)
|
raise_errors!(domain)
|
||||||
|
|
||||||
domain.apply_pending_update!
|
domain.apply_pending_update!
|
||||||
|
@ -22,7 +22,7 @@ class DomainUpdateConfirmJob < Que::Job
|
||||||
registrar: domain.registrar,
|
registrar: domain.registrar,
|
||||||
registrant: domain.registrant).deliver_now
|
registrant: domain.registrant).deliver_now
|
||||||
|
|
||||||
domain.poll_message!(:poll_pending_update_rejected_by_registrant)
|
domain.notify_registrar(:poll_pending_update_rejected_by_registrant)
|
||||||
|
|
||||||
domain.preclean_pendings
|
domain.preclean_pendings
|
||||||
domain.clean_pendings!
|
domain.clean_pendings!
|
||||||
|
|
|
@ -79,8 +79,8 @@ class ApiUser < User
|
||||||
username
|
username
|
||||||
end
|
end
|
||||||
|
|
||||||
def queued_messages
|
def queued_notifications
|
||||||
registrar.messages.queued
|
registrar.notifications.queued
|
||||||
end
|
end
|
||||||
|
|
||||||
def registrar_pki_ok?(crt, cn)
|
def registrar_pki_ok?(crt, cn)
|
||||||
|
|
|
@ -270,8 +270,8 @@ class Domain < ActiveRecord::Base
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def poll_message!(message_key)
|
def notify_registrar(message_key)
|
||||||
registrar.messages.create!(
|
registrar.notifications.create!(
|
||||||
body: "#{I18n.t(message_key)}: #{name}",
|
body: "#{I18n.t(message_key)}: #{name}",
|
||||||
attached_obj_id: id,
|
attached_obj_id: id,
|
||||||
attached_obj_type: self.class.to_s
|
attached_obj_type: self.class.to_s
|
||||||
|
|
|
@ -73,8 +73,8 @@ class DomainTransfer < ActiveRecord::Base
|
||||||
old_contacts_codes = domain.contacts.pluck(:code).sort.uniq.join(', ')
|
old_contacts_codes = domain.contacts.pluck(:code).sort.uniq.join(', ')
|
||||||
old_registrant_code = domain.registrant.code
|
old_registrant_code = domain.registrant.code
|
||||||
|
|
||||||
old_registrar.messages.create!(
|
old_registrar.notifications.create!(
|
||||||
body: I18n.t('messages.texts.domain_transfer',
|
body: I18n.t('notifications.texts.domain_transfer',
|
||||||
domain_name: domain.name,
|
domain_name: domain.name,
|
||||||
old_contacts_codes: old_contacts_codes,
|
old_contacts_codes: old_contacts_codes,
|
||||||
old_registrant_code: old_registrant_code),
|
old_registrant_code: old_registrant_code),
|
||||||
|
|
|
@ -625,7 +625,7 @@ class Epp::Domain < Domain
|
||||||
)
|
)
|
||||||
|
|
||||||
if dt.pending?
|
if dt.pending?
|
||||||
registrar.messages.create!(
|
registrar.notifications.create!(
|
||||||
body: I18n.t('transfer_requested'),
|
body: I18n.t('transfer_requested'),
|
||||||
attached_obj_id: dt.id,
|
attached_obj_id: dt.id,
|
||||||
attached_obj_type: dt.class.to_s
|
attached_obj_type: dt.class.to_s
|
||||||
|
@ -727,7 +727,7 @@ class Epp::Domain < Domain
|
||||||
|
|
||||||
return false unless valid?
|
return false unless valid?
|
||||||
|
|
||||||
registrar.messages.create!(
|
registrar.notifications.create!(
|
||||||
body: 'Key Relay action completed successfully.',
|
body: 'Key Relay action completed successfully.',
|
||||||
attached_obj_type: kr.class.to_s,
|
attached_obj_type: kr.class.to_s,
|
||||||
attached_obj_id: kr.id
|
attached_obj_id: kr.id
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class Message < ActiveRecord::Base
|
class Notification < ActiveRecord::Base
|
||||||
include Versions # version/message_version.rb
|
include Versions # version/notification_version.rb
|
||||||
belongs_to :registrar, required: true
|
belongs_to :registrar, required: true
|
||||||
|
|
||||||
before_create -> { self.queued = true }
|
before_create -> { self.queued = true }
|
|
@ -4,7 +4,7 @@ class Registrar < ActiveRecord::Base
|
||||||
has_many :domains, dependent: :restrict_with_error
|
has_many :domains, dependent: :restrict_with_error
|
||||||
has_many :contacts, dependent: :restrict_with_error
|
has_many :contacts, dependent: :restrict_with_error
|
||||||
has_many :api_users, dependent: :restrict_with_error
|
has_many :api_users, dependent: :restrict_with_error
|
||||||
has_many :messages
|
has_many :notifications
|
||||||
has_many :invoices, foreign_key: 'buyer_id'
|
has_many :invoices, foreign_key: 'buyer_id'
|
||||||
has_many :accounts, dependent: :destroy
|
has_many :accounts, dependent: :destroy
|
||||||
has_many :nameservers, through: :domains
|
has_many :nameservers, through: :domains
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
class MessageVersion < PaperTrail::Version
|
|
||||||
include VersionSession
|
|
||||||
self.table_name = :log_messages
|
|
||||||
self.sequence_name = :log_messages_id_seq
|
|
||||||
end
|
|
5
app/models/version/notification_version.rb
Normal file
5
app/models/version/notification_version.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class NotificationVersion < PaperTrail::Version
|
||||||
|
include VersionSession
|
||||||
|
self.table_name = :log_notifications
|
||||||
|
self.sequence_name = :log_notifications_id_seq
|
||||||
|
end
|
|
@ -4,7 +4,7 @@ xml.epp_head do
|
||||||
xml.msg 'Command completed successfully'
|
xml.msg 'Command completed successfully'
|
||||||
end
|
end
|
||||||
|
|
||||||
xml.tag!('msgQ', 'count' => current_user.queued_messages.count, 'id' => @message.id)
|
xml.tag!('msgQ', 'count' => current_user.queued_notifications.count, 'id' => @notification.id)
|
||||||
|
|
||||||
render('epp/shared/trID', builder: xml)
|
render('epp/shared/trID', builder: xml)
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,9 +10,9 @@ xml.epp(
|
||||||
xml.msg 'Command completed successfully; ack to dequeue'
|
xml.msg 'Command completed successfully; ack to dequeue'
|
||||||
end
|
end
|
||||||
|
|
||||||
xml.tag!('msgQ', 'count' => current_user.queued_messages.count, 'id' => @message.id) do
|
xml.tag!('msgQ', 'count' => current_user.queued_notifications.count, 'id' => @notification.id) do
|
||||||
xml.qDate @message.created_at.try(:iso8601)
|
xml.qDate @notification.created_at.try(:iso8601)
|
||||||
xml.msg @message.body
|
xml.msg @notification.body
|
||||||
end
|
end
|
||||||
|
|
||||||
xml.resData do
|
xml.resData do
|
||||||
|
|
|
@ -4,12 +4,12 @@ xml.epp_head do
|
||||||
xml.msg 'Command completed successfully; ack to dequeue'
|
xml.msg 'Command completed successfully; ack to dequeue'
|
||||||
end
|
end
|
||||||
|
|
||||||
xml.tag!('msgQ', 'count' => current_user.queued_messages.count, 'id' => @message.id) do
|
xml.tag!('msgQ', 'count' => current_user.queued_notifications.count, 'id' => @notification.id) do
|
||||||
xml.qDate @message.created_at.try(:iso8601)
|
xml.qDate @notification.created_at.try(:iso8601)
|
||||||
xml.msg @message.body
|
xml.msg @notification.body
|
||||||
end
|
end
|
||||||
|
|
||||||
if @message.attached_obj_type == 'DomainTransfer'
|
if @notification.attached_obj_type == 'DomainTransfer'
|
||||||
xml.resData do
|
xml.resData do
|
||||||
xml << render('epp/domains/partials/transfer', builder: xml, dt: @object)
|
xml << render('epp/domains/partials/transfer', builder: xml, dt: @object)
|
||||||
end if @object
|
end if @object
|
||||||
|
|
|
@ -486,7 +486,6 @@ en:
|
||||||
message: 'Message'
|
message: 'Message'
|
||||||
message_no: 'Message #%{id}'
|
message_no: 'Message #%{id}'
|
||||||
queue_date: 'Queue date'
|
queue_date: 'Queue date'
|
||||||
messages_in_queue: 'Messages in queue'
|
|
||||||
you_have_no_new_messages: 'You have no new messages'
|
you_have_no_new_messages: 'You have no new messages'
|
||||||
message_id: 'Message ID'
|
message_id: 'Message ID'
|
||||||
trStatus: 'Status'
|
trStatus: 'Status'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
en:
|
en:
|
||||||
messages:
|
notifications:
|
||||||
texts:
|
texts:
|
||||||
domain_transfer: >-
|
domain_transfer: >-
|
||||||
Transfer of domain %{domain_name} has been approved.
|
Transfer of domain %{domain_name} has been approved.
|
|
@ -0,0 +1,5 @@
|
||||||
|
class RenameMessagesToNotifications < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
rename_table :messages, :notifications
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class RenameLogMessagesToLogNotifications < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
rename_table :log_messages, :log_notifications
|
||||||
|
end
|
||||||
|
end
|
238
db/structure.sql
238
db/structure.sql
|
@ -1651,44 +1651,6 @@ CREATE SEQUENCE public.log_keyrelays_id_seq
|
||||||
ALTER SEQUENCE public.log_keyrelays_id_seq OWNED BY public.log_keyrelays.id;
|
ALTER SEQUENCE public.log_keyrelays_id_seq OWNED BY public.log_keyrelays.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: log_messages; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE public.log_messages (
|
|
||||||
id integer NOT NULL,
|
|
||||||
item_type character varying NOT NULL,
|
|
||||||
item_id integer NOT NULL,
|
|
||||||
event character varying NOT NULL,
|
|
||||||
whodunnit character varying,
|
|
||||||
object json,
|
|
||||||
object_changes json,
|
|
||||||
created_at timestamp without time zone,
|
|
||||||
session character varying,
|
|
||||||
children json,
|
|
||||||
uuid character varying
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: log_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE SEQUENCE public.log_messages_id_seq
|
|
||||||
START WITH 1
|
|
||||||
INCREMENT BY 1
|
|
||||||
NO MINVALUE
|
|
||||||
NO MAXVALUE
|
|
||||||
CACHE 1;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: log_messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER SEQUENCE public.log_messages_id_seq OWNED BY public.log_messages.id;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: log_nameservers; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: log_nameservers; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -1727,6 +1689,44 @@ CREATE SEQUENCE public.log_nameservers_id_seq
|
||||||
ALTER SEQUENCE public.log_nameservers_id_seq OWNED BY public.log_nameservers.id;
|
ALTER SEQUENCE public.log_nameservers_id_seq OWNED BY public.log_nameservers.id;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_notifications; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE public.log_notifications (
|
||||||
|
id integer NOT NULL,
|
||||||
|
item_type character varying NOT NULL,
|
||||||
|
item_id integer NOT NULL,
|
||||||
|
event character varying NOT NULL,
|
||||||
|
whodunnit character varying,
|
||||||
|
object json,
|
||||||
|
object_changes json,
|
||||||
|
created_at timestamp without time zone,
|
||||||
|
session character varying,
|
||||||
|
children json,
|
||||||
|
uuid character varying
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.log_notifications_id_seq
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER SEQUENCE public.log_notifications_id_seq OWNED BY public.log_notifications.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: log_registrars; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: log_registrars; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -1954,43 +1954,6 @@ CREATE SEQUENCE public.mail_templates_id_seq
|
||||||
ALTER SEQUENCE public.mail_templates_id_seq OWNED BY public.mail_templates.id;
|
ALTER SEQUENCE public.mail_templates_id_seq OWNED BY public.mail_templates.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: messages; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE TABLE public.messages (
|
|
||||||
id integer NOT NULL,
|
|
||||||
registrar_id integer NOT NULL,
|
|
||||||
body character varying NOT NULL,
|
|
||||||
attached_obj_type character varying,
|
|
||||||
attached_obj_id integer,
|
|
||||||
queued boolean,
|
|
||||||
created_at timestamp without time zone,
|
|
||||||
updated_at timestamp without time zone,
|
|
||||||
creator_str character varying,
|
|
||||||
updator_str character varying
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE SEQUENCE public.messages_id_seq
|
|
||||||
START WITH 1
|
|
||||||
INCREMENT BY 1
|
|
||||||
NO MINVALUE
|
|
||||||
NO MAXVALUE
|
|
||||||
CACHE 1;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER SEQUENCE public.messages_id_seq OWNED BY public.messages.id;
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: nameservers; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: nameservers; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -2029,6 +1992,43 @@ CREATE SEQUENCE public.nameservers_id_seq
|
||||||
ALTER SEQUENCE public.nameservers_id_seq OWNED BY public.nameservers.id;
|
ALTER SEQUENCE public.nameservers_id_seq OWNED BY public.nameservers.id;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: notifications; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE public.notifications (
|
||||||
|
id integer NOT NULL,
|
||||||
|
registrar_id integer NOT NULL,
|
||||||
|
body character varying NOT NULL,
|
||||||
|
attached_obj_type character varying,
|
||||||
|
attached_obj_id integer,
|
||||||
|
queued boolean,
|
||||||
|
created_at timestamp without time zone,
|
||||||
|
updated_at timestamp without time zone,
|
||||||
|
creator_str character varying,
|
||||||
|
updator_str character varying
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE SEQUENCE public.notifications_id_seq
|
||||||
|
START WITH 1
|
||||||
|
INCREMENT BY 1
|
||||||
|
NO MINVALUE
|
||||||
|
NO MAXVALUE
|
||||||
|
CACHE 1;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER SEQUENCE public.notifications_id_seq OWNED BY public.notifications.id;
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: prices; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
-- Name: prices; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -2714,14 +2714,14 @@ ALTER TABLE ONLY public.log_keyrelays ALTER COLUMN id SET DEFAULT nextval('publi
|
||||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY public.log_messages ALTER COLUMN id SET DEFAULT nextval('public.log_messages_id_seq'::regclass);
|
ALTER TABLE ONLY public.log_nameservers ALTER COLUMN id SET DEFAULT nextval('public.log_nameservers_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY public.log_nameservers ALTER COLUMN id SET DEFAULT nextval('public.log_nameservers_id_seq'::regclass);
|
ALTER TABLE ONLY public.log_notifications ALTER COLUMN id SET DEFAULT nextval('public.log_notifications_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -2770,14 +2770,14 @@ ALTER TABLE ONLY public.mail_templates ALTER COLUMN id SET DEFAULT nextval('publ
|
||||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY public.messages ALTER COLUMN id SET DEFAULT nextval('public.messages_id_seq'::regclass);
|
ALTER TABLE ONLY public.nameservers ALTER COLUMN id SET DEFAULT nextval('public.nameservers_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY public.nameservers ALTER COLUMN id SET DEFAULT nextval('public.nameservers_id_seq'::regclass);
|
ALTER TABLE ONLY public.notifications ALTER COLUMN id SET DEFAULT nextval('public.notifications_id_seq'::regclass);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -3129,14 +3129,6 @@ ALTER TABLE ONLY public.log_keyrelays
|
||||||
ADD CONSTRAINT log_keyrelays_pkey PRIMARY KEY (id);
|
ADD CONSTRAINT log_keyrelays_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: log_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER TABLE ONLY public.log_messages
|
|
||||||
ADD CONSTRAINT log_messages_pkey PRIMARY KEY (id);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: log_nameservers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
-- Name: log_nameservers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -3145,6 +3137,14 @@ ALTER TABLE ONLY public.log_nameservers
|
||||||
ADD CONSTRAINT log_nameservers_pkey PRIMARY KEY (id);
|
ADD CONSTRAINT log_nameservers_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: log_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.log_notifications
|
||||||
|
ADD CONSTRAINT log_notifications_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: log_registrars_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
-- Name: log_registrars_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -3193,14 +3193,6 @@ ALTER TABLE ONLY public.mail_templates
|
||||||
ADD CONSTRAINT mail_templates_pkey PRIMARY KEY (id);
|
ADD CONSTRAINT mail_templates_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
||||||
--
|
|
||||||
|
|
||||||
ALTER TABLE ONLY public.messages
|
|
||||||
ADD CONSTRAINT messages_pkey PRIMARY KEY (id);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: nameservers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
-- Name: nameservers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -3209,6 +3201,14 @@ ALTER TABLE ONLY public.nameservers
|
||||||
ADD CONSTRAINT nameservers_pkey PRIMARY KEY (id);
|
ADD CONSTRAINT nameservers_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
ALTER TABLE ONLY public.notifications
|
||||||
|
ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: prices_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
-- Name: prices_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -3788,20 +3788,6 @@ CREATE INDEX index_log_keyrelays_on_item_type_and_item_id ON public.log_keyrelay
|
||||||
CREATE INDEX index_log_keyrelays_on_whodunnit ON public.log_keyrelays USING btree (whodunnit);
|
CREATE INDEX index_log_keyrelays_on_whodunnit ON public.log_keyrelays USING btree (whodunnit);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: index_log_messages_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE INDEX index_log_messages_on_item_type_and_item_id ON public.log_messages USING btree (item_type, item_id);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: index_log_messages_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE INDEX index_log_messages_on_whodunnit ON public.log_messages USING btree (whodunnit);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_log_nameservers_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_log_nameservers_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -3816,6 +3802,20 @@ CREATE INDEX index_log_nameservers_on_item_type_and_item_id ON public.log_namese
|
||||||
CREATE INDEX index_log_nameservers_on_whodunnit ON public.log_nameservers USING btree (whodunnit);
|
CREATE INDEX index_log_nameservers_on_whodunnit ON public.log_nameservers USING btree (whodunnit);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_log_notifications_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_log_notifications_on_item_type_and_item_id ON public.log_notifications USING btree (item_type, item_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_log_notifications_on_whodunnit; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_log_notifications_on_whodunnit ON public.log_notifications USING btree (whodunnit);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_log_registrars_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_log_registrars_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -3872,13 +3872,6 @@ CREATE INDEX index_log_users_on_item_type_and_item_id ON public.log_users USING
|
||||||
CREATE INDEX index_log_users_on_whodunnit ON public.log_users USING btree (whodunnit);
|
CREATE INDEX index_log_users_on_whodunnit ON public.log_users USING btree (whodunnit);
|
||||||
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Name: index_messages_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
||||||
--
|
|
||||||
|
|
||||||
CREATE INDEX index_messages_on_registrar_id ON public.messages USING btree (registrar_id);
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_nameservers_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_nameservers_on_domain_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -3886,6 +3879,13 @@ CREATE INDEX index_messages_on_registrar_id ON public.messages USING btree (regi
|
||||||
CREATE INDEX index_nameservers_on_domain_id ON public.nameservers USING btree (domain_id);
|
CREATE INDEX index_nameservers_on_domain_id ON public.nameservers USING btree (domain_id);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Name: index_notifications_on_registrar_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE INDEX index_notifications_on_registrar_id ON public.notifications USING btree (registrar_id);
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Name: index_prices_on_zone_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
-- Name: index_prices_on_zone_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
||||||
--
|
--
|
||||||
|
@ -4101,7 +4101,7 @@ ALTER TABLE ONLY public.account_activities
|
||||||
-- Name: messages_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
-- Name: messages_registrar_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||||
--
|
--
|
||||||
|
|
||||||
ALTER TABLE ONLY public.messages
|
ALTER TABLE ONLY public.notifications
|
||||||
ADD CONSTRAINT messages_registrar_id_fk FOREIGN KEY (registrar_id) REFERENCES public.registrars(id);
|
ADD CONSTRAINT messages_registrar_id_fk FOREIGN KEY (registrar_id) REFERENCES public.registrars(id);
|
||||||
|
|
||||||
|
|
||||||
|
@ -4759,3 +4759,7 @@ INSERT INTO schema_migrations (version) VALUES ('20180613030330');
|
||||||
|
|
||||||
INSERT INTO schema_migrations (version) VALUES ('20180613045614');
|
INSERT INTO schema_migrations (version) VALUES ('20180613045614');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20180823161237');
|
||||||
|
|
||||||
|
INSERT INTO schema_migrations (version) VALUES ('20180823163548');
|
||||||
|
|
||||||
|
|
|
@ -251,10 +251,10 @@ RSpec.describe Domain do
|
||||||
@domain.statuses = DomainStatus::OK # restore
|
@domain.statuses = DomainStatus::OK # restore
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should add poll message to registrar' do
|
it 'should notify registrar' do
|
||||||
domain = create(:domain, name: 'testpollmessage123.ee')
|
domain = create(:domain, name: 'testpollmessage123.ee')
|
||||||
domain.poll_message!(:poll_pending_update_confirmed_by_registrant)
|
domain.notify_registrar(:poll_pending_update_confirmed_by_registrant)
|
||||||
domain.registrar.messages.first.body.should == 'Registrant confirmed domain update: testpollmessage123.ee'
|
domain.registrar.notifications.first.body.should == 'Registrant confirmed domain update: testpollmessage123.ee'
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'about registrant update confirm' do
|
context 'about registrant update confirm' do
|
||||||
|
|
|
@ -47,7 +47,7 @@ class APIDomainTransfersTest < ApplicationIntegrationTest
|
||||||
def test_notifies_old_registrar
|
def test_notifies_old_registrar
|
||||||
@old_registrar = @domain.registrar
|
@old_registrar = @domain.registrar
|
||||||
|
|
||||||
assert_difference -> { @old_registrar.messages.count } do
|
assert_difference -> { @old_registrar.notifications.count } do
|
||||||
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
post '/repp/v1/domain_transfers', request_params, { 'HTTP_AUTHORIZATION' => http_auth_key }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,7 +43,7 @@ class EppDomainTransferRequestTest < ApplicationIntegrationTest
|
||||||
def test_notifies_old_registrar
|
def test_notifies_old_registrar
|
||||||
@old_registrar = @domain.registrar
|
@old_registrar = @domain.registrar
|
||||||
|
|
||||||
assert_difference -> { @old_registrar.messages.count } do
|
assert_difference -> { @old_registrar.notifications.count } do
|
||||||
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
post '/epp/command/transfer', { frame: request_xml }, { 'HTTP_COOKIE' => 'session=api_goodnames' }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,8 +2,8 @@ require 'test_helper'
|
||||||
|
|
||||||
class EppPollTest < ApplicationIntegrationTest
|
class EppPollTest < ApplicationIntegrationTest
|
||||||
# Deliberately does not conform to RFC5730, which requires the first message to be returned
|
# Deliberately does not conform to RFC5730, which requires the first message to be returned
|
||||||
def test_return_latest_message_when_queue_is_not_empty
|
def test_return_latest_notification_when_queue_is_not_empty
|
||||||
message = messages(:domain_deleted)
|
notification = notifications(:domain_deleted)
|
||||||
|
|
||||||
request_xml =
|
request_xml =
|
||||||
<<-XML
|
<<-XML
|
||||||
|
@ -20,13 +20,13 @@ class EppPollTest < ApplicationIntegrationTest
|
||||||
assert_equal 1301.to_s, response_xml.at_css('result')[:code]
|
assert_equal 1301.to_s, response_xml.at_css('result')[:code]
|
||||||
assert_equal 1, response_xml.css('result').size
|
assert_equal 1, response_xml.css('result').size
|
||||||
assert_equal 2.to_s, response_xml.at_css('msgQ')[:count]
|
assert_equal 2.to_s, response_xml.at_css('msgQ')[:count]
|
||||||
assert_equal message.id.to_s, response_xml.at_css('msgQ')[:id]
|
assert_equal notification.id.to_s, response_xml.at_css('msgQ')[:id]
|
||||||
assert_equal Time.zone.parse('2010-07-05').iso8601, response_xml.at_css('msgQ qDate').text
|
assert_equal Time.zone.parse('2010-07-05').iso8601, response_xml.at_css('msgQ qDate').text
|
||||||
assert_equal 'Your domain has been deleted', response_xml.at_css('msgQ msg').text
|
assert_equal 'Your domain has been deleted', response_xml.at_css('msgQ msg').text
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_no_messages_in_queue
|
def test_no_notifications
|
||||||
registrars(:bestnames).messages.delete_all(:delete_all)
|
registrars(:bestnames).notifications.delete_all(:delete_all)
|
||||||
|
|
||||||
request_xml =
|
request_xml =
|
||||||
<<-XML
|
<<-XML
|
||||||
|
@ -44,49 +44,49 @@ class EppPollTest < ApplicationIntegrationTest
|
||||||
assert_equal 1, response_xml.css('result').size
|
assert_equal 1, response_xml.css('result').size
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_dequeue_message
|
def test_dequeue_notification
|
||||||
message = messages(:greeting)
|
notification = notifications(:greeting)
|
||||||
|
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
<command>
|
<command>
|
||||||
<poll op="ack" msgID="#{message.id}"/>
|
<poll op="ack" msgID="#{notification.id}"/>
|
||||||
</command>
|
</command>
|
||||||
</epp>
|
</epp>
|
||||||
XML
|
XML
|
||||||
|
|
||||||
post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||||
message.reload
|
notification.reload
|
||||||
response_xml = Nokogiri::XML(response.body)
|
response_xml = Nokogiri::XML(response.body)
|
||||||
|
|
||||||
assert_not message.queued?
|
assert_not notification.queued?
|
||||||
assert_equal 1000.to_s, response_xml.at_css('result')[:code]
|
assert_equal 1000.to_s, response_xml.at_css('result')[:code]
|
||||||
assert_equal 1, response_xml.css('result').size
|
assert_equal 1, response_xml.css('result').size
|
||||||
assert_equal 1.to_s, response_xml.at_css('msgQ')[:count]
|
assert_equal 1.to_s, response_xml.at_css('msgQ')[:count]
|
||||||
assert_equal message.id.to_s, response_xml.at_css('msgQ')[:id]
|
assert_equal notification.id.to_s, response_xml.at_css('msgQ')[:id]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_message_of_other_registrars_cannot_be_dequeued
|
def test_notification_of_other_registrars_cannot_be_dequeued
|
||||||
message = messages(:farewell)
|
notification = notifications(:farewell)
|
||||||
|
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
<command>
|
<command>
|
||||||
<poll op="ack" msgID="#{message.id}"/>
|
<poll op="ack" msgID="#{notification.id}"/>
|
||||||
</command>
|
</command>
|
||||||
</epp>
|
</epp>
|
||||||
XML
|
XML
|
||||||
post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
||||||
response_xml = Nokogiri::XML(response.body)
|
response_xml = Nokogiri::XML(response.body)
|
||||||
message.reload
|
notification.reload
|
||||||
|
|
||||||
assert message.queued?
|
assert notification.queued?
|
||||||
assert_equal 2303.to_s, response_xml.at_css('result')[:code]
|
assert_equal 2303.to_s, response_xml.at_css('result')[:code]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_message_not_found
|
def test_notification_not_found
|
||||||
request_xml = <<-XML
|
request_xml = <<-XML
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
|
|
|
@ -18,19 +18,19 @@ class DomainDeleteConfirmJobTest < ActiveSupport::TestCase
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_rejected_registrant_verification_polls_a_message
|
def test_rejected_registrant_verification_notifies_registrar
|
||||||
DomainDeleteConfirmJob.enqueue(@domain.id, RegistrantVerification::REJECTED)
|
DomainDeleteConfirmJob.enqueue(@domain.id, RegistrantVerification::REJECTED)
|
||||||
|
|
||||||
last_registrar_message = @domain.registrar.messages.last
|
last_registrar_notification = @domain.registrar.notifications.last
|
||||||
assert_equal(last_registrar_message.attached_obj_id, @domain.id)
|
assert_equal(last_registrar_notification.attached_obj_id, @domain.id)
|
||||||
assert_equal(last_registrar_message.body, 'Registrant rejected domain deletion: shop.test')
|
assert_equal(last_registrar_notification.body, 'Registrant rejected domain deletion: shop.test')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_accepted_registrant_verification_polls_a_message
|
def test_accepted_registrant_verification_notifies_registrar
|
||||||
DomainDeleteConfirmJob.enqueue(@domain.id, RegistrantVerification::CONFIRMED)
|
DomainDeleteConfirmJob.enqueue(@domain.id, RegistrantVerification::CONFIRMED)
|
||||||
|
|
||||||
last_registrar_message = @domain.registrar.messages.last
|
last_registrar_notification = @domain.registrar.notifications.last
|
||||||
assert_equal(last_registrar_message.attached_obj_id, @domain.id)
|
assert_equal(last_registrar_notification.attached_obj_id, @domain.id)
|
||||||
assert_equal(last_registrar_message.body, 'Registrant confirmed domain deletion: shop.test')
|
assert_equal(last_registrar_notification.body, 'Registrant confirmed domain deletion: shop.test')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,19 +18,19 @@ class DomainUpdateConfirmJobTest < ActiveSupport::TestCase
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_rejected_registrant_verification_polls_a_message
|
def test_rejected_registrant_verification_notifies_registrar
|
||||||
DomainUpdateConfirmJob.enqueue(@domain.id, RegistrantVerification::REJECTED)
|
DomainUpdateConfirmJob.enqueue(@domain.id, RegistrantVerification::REJECTED)
|
||||||
|
|
||||||
last_registrar_message = @domain.registrar.messages.last
|
last_registrar_notification = @domain.registrar.notifications.last
|
||||||
assert_equal(last_registrar_message.attached_obj_id, @domain.id)
|
assert_equal(last_registrar_notification.attached_obj_id, @domain.id)
|
||||||
assert_equal(last_registrar_message.body, 'Registrant rejected domain update: shop.test')
|
assert_equal(last_registrar_notification.body, 'Registrant rejected domain update: shop.test')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_accepted_registrant_verification_polls_a_message
|
def test_accepted_registrant_verification_notifies_registrar
|
||||||
DomainUpdateConfirmJob.enqueue(@domain.id, RegistrantVerification::CONFIRMED)
|
DomainUpdateConfirmJob.enqueue(@domain.id, RegistrantVerification::CONFIRMED)
|
||||||
|
|
||||||
last_registrar_message = @domain.registrar.messages.last
|
last_registrar_notification = @domain.registrar.notifications.last
|
||||||
assert_equal(last_registrar_message.attached_obj_id, @domain.id)
|
assert_equal(last_registrar_notification.attached_obj_id, @domain.id)
|
||||||
assert_equal(last_registrar_message.body, 'Registrant confirmed domain update: shop.test')
|
assert_equal(last_registrar_notification.body, 'Registrant confirmed domain update: shop.test')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ class DomainTransferTest < ActiveSupport::TestCase
|
||||||
def test_notifies_old_registrar_on_approval
|
def test_notifies_old_registrar_on_approval
|
||||||
old_registrar = @domain_transfer.old_registrar
|
old_registrar = @domain_transfer.old_registrar
|
||||||
|
|
||||||
assert_difference -> { old_registrar.messages.count } do
|
assert_difference -> { old_registrar.notifications.count } do
|
||||||
@domain_transfer.approve
|
@domain_transfer.approve
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@ class DomainTransferTest < ActiveSupport::TestCase
|
||||||
id = @domain_transfer.id
|
id = @domain_transfer.id
|
||||||
class_name = @domain_transfer.class.name
|
class_name = @domain_transfer.class.name
|
||||||
|
|
||||||
message = old_registrar.messages.last
|
notification = old_registrar.notifications.last
|
||||||
assert_equal body, message.body
|
assert_equal body, notification.body
|
||||||
assert_equal id, message.attached_obj_id
|
assert_equal id, notification.attached_obj_id
|
||||||
assert_equal class_name, message.attached_obj_type
|
assert_equal class_name, notification.attached_obj_type
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
require 'test_helper'
|
|
||||||
|
|
||||||
class MessageTest < ActiveSupport::TestCase
|
|
||||||
setup do
|
|
||||||
@message = messages(:greeting)
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_valid
|
|
||||||
assert @message.valid?
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_invalid_without_body
|
|
||||||
@message.body = nil
|
|
||||||
assert @message.invalid?
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_invalid_without_registrar
|
|
||||||
@message.registrar = nil
|
|
||||||
assert @message.invalid?
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_dequeue
|
|
||||||
@message.dequeue
|
|
||||||
@message.reload
|
|
||||||
assert_not @message.queued?
|
|
||||||
end
|
|
||||||
end
|
|
27
test/models/notification_test.rb
Normal file
27
test/models/notification_test.rb
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class NotificationTest < ActiveSupport::TestCase
|
||||||
|
setup do
|
||||||
|
@notification = notifications(:greeting)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_valid
|
||||||
|
assert @notification.valid?
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_invalid_without_body
|
||||||
|
@notification.body = nil
|
||||||
|
assert @notification.invalid?
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_invalid_without_registrar
|
||||||
|
@notification.registrar = nil
|
||||||
|
assert @notification.invalid?
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_dequeue
|
||||||
|
@notification.dequeue
|
||||||
|
@notification.reload
|
||||||
|
assert_not @notification.queued?
|
||||||
|
end
|
||||||
|
end
|
|
@ -22,7 +22,7 @@ class AdminAreaDomainForceDeleteTest < ApplicationSystemTestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_notifies_registrar
|
def test_notifies_registrar
|
||||||
assert_difference '@domain.registrar.messages.size' do
|
assert_difference '@domain.registrar.notifications.size' do
|
||||||
visit edit_admin_domain_url(@domain)
|
visit edit_admin_domain_url(@domain)
|
||||||
click_link_or_button 'Force delete domain'
|
click_link_or_button 'Force delete domain'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue