mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 13:15:40 +02:00
Merge branch 'master' into refactor-messages
# Conflicts: # app/controllers/epp/polls_controller.rb # test/fixtures/messages.yml # test/integration/epp/poll_test.rb # test/models/message_test.rb
This commit is contained in:
commit
52feefeb79
3 changed files with 2 additions and 20 deletions
|
@ -9,7 +9,7 @@ class Epp::PollsController < EppController
|
||||||
private
|
private
|
||||||
|
|
||||||
def req_poll
|
def req_poll
|
||||||
@notification = current_user.unread_notifications.last
|
@notification = current_user.unread_notifications.order('created_at DESC').take
|
||||||
|
|
||||||
render_epp_response 'epp/poll/poll_no_messages' and return unless @notification
|
render_epp_response 'epp/poll/poll_no_messages' and return unless @notification
|
||||||
if @notification.attached_obj_type && @notification.attached_obj_id
|
if @notification.attached_obj_type && @notification.attached_obj_id
|
||||||
|
|
1
test/fixtures/notifications.yml
vendored
1
test/fixtures/notifications.yml
vendored
|
@ -2,6 +2,7 @@ greeting:
|
||||||
text: Welcome!
|
text: Welcome!
|
||||||
read: false
|
read: false
|
||||||
registrar: bestnames
|
registrar: bestnames
|
||||||
|
created_at: <%= Time.zone.parse('2010-07-04') %>
|
||||||
|
|
||||||
domain_deleted:
|
domain_deleted:
|
||||||
text: Your domain has been deleted
|
text: Your domain has been deleted
|
||||||
|
|
|
@ -24,25 +24,6 @@ class EppPollTest < ApplicationIntegrationTest
|
||||||
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
|
||||||
|
|
||||||
request_xml = <<-XML
|
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
|
||||||
<command>
|
|
||||||
<poll op="req"/>
|
|
||||||
</command>
|
|
||||||
</epp>
|
|
||||||
XML
|
|
||||||
post '/epp/command/poll', { frame: request_xml }, 'HTTP_COOKIE' => 'session=api_bestnames'
|
|
||||||
|
|
||||||
xml_doc = Nokogiri::XML(response.body)
|
|
||||||
assert_equal 1301.to_s, xml_doc.at_css('result')[:code]
|
|
||||||
assert_equal 1, xml_doc.css('result').size
|
|
||||||
assert_equal 2.to_s, xml_doc.at_css('msgQ')[:count]
|
|
||||||
assert_equal notification.id.to_s, xml_doc.at_css('msgQ')[:id]
|
|
||||||
assert_equal Time.zone.parse('2010-07-05').iso8601, xml_doc.at_css('msgQ qDate').text
|
|
||||||
assert_equal 'Your domain has been deleted', xml_doc.at_css('msgQ msg').text
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_no_notifications
|
def test_no_notifications
|
||||||
registrars(:bestnames).notifications.delete_all(:delete_all)
|
registrars(:bestnames).notifications.delete_all(:delete_all)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue