Patch #13460 » functional_renaming_rss_to_atom.diff
| app/controllers/application_controller.rb | ||
|---|---|---|
|
user = autologin_user
|
||
|
elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth?
|
||
|
# RSS key authentication does not start a session
|
||
|
user = User.find_by_rss_key(params[:key])
|
||
|
user = User.find_by_atom_key(params[:key])
|
||
|
end
|
||
|
end
|
||
|
if user.nil? && Setting.rest_api_enabled? && accept_api_auth?
|
||
| app/controllers/my_controller.rb | ||
|---|---|---|
|
end
|
||
|
# Create a new feeds key
|
||
|
def reset_rss_key
|
||
|
def reset_atom_key
|
||
|
if request.post?
|
||
|
if User.current.rss_token
|
||
|
User.current.rss_token.destroy
|
||
|
if User.current.atom_token
|
||
|
User.current.atom_token.destroy
|
||
|
User.current.reload
|
||
|
end
|
||
|
User.current.rss_key
|
||
|
User.current.atom_key
|
||
|
flash[:notice] = l(:notice_feeds_access_key_reseted)
|
||
|
end
|
||
|
redirect_to my_account_path
|
||
|
end
|
||
|
|
||
|
# TODO: remove in Redmine 3.0
|
||
|
def reset_rss_key
|
||
|
ActiveSupport::Deprecation.warn "My#reset_rss_key is deprecated and will be removed in Redmine 3.0. Please use #reset_atom_key instead."
|
||
|
reset_atom_key
|
||
|
end
|
||
|
# Create a new API key
|
||
|
def reset_api_key
|
||
| app/controllers/projects_controller.rb | ||
|---|---|---|
|
@total_hours = TimeEntry.visible.sum(:hours, :include => :project, :conditions => cond).to_f
|
||
|
end
|
||
|
@key = User.current.rss_key
|
||
|
@key = User.current.atom_key
|
||
|
respond_to do |format|
|
||
|
format.html
|
||
| app/models/user.rb | ||
|---|---|---|
|
:after_remove => Proc.new {|user, group| group.user_removed(user)}
|
||
|
has_many :changesets, :dependent => :nullify
|
||
|
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
|
||
|
has_one :rss_token, :class_name => 'Token', :conditions => "action='feeds'"
|
||
|
has_one :atom_token, :class_name => 'Token', :conditions => "action='feeds'"
|
||
|
has_one :api_token, :class_name => 'Token', :conditions => "action='api'"
|
||
|
belongs_to :auth_source
|
||
| ... | ... | |
|
self.pref[:comments_sorting] == 'desc'
|
||
|
end
|
||
|
# Return user's RSS key (a 40 chars long string), used to access feeds
|
||
|
def rss_key
|
||
|
if rss_token.nil?
|
||
|
create_rss_token(:action => 'feeds')
|
||
|
# Return user's ATOM key (a 40 chars long string), used to access feeds
|
||
|
def atom_key
|
||
|
if atom_token.nil?
|
||
|
create_atom_token(:action => 'feeds')
|
||
|
end
|
||
|
rss_token.value
|
||
|
atom_token.value
|
||
|
end
|
||
|
|
||
|
# TODO: remove in Redmine 3.0
|
||
|
def rss_key
|
||
|
ActiveSupport::Deprecation.warn "User.rss_key is deprecated and will be removed in Redmine 3.0. Please use User.atom_key instead."
|
||
|
atom_key
|
||
|
end
|
||
|
# Return user's API key (a 40 chars long string), used to access the API
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
def self.find_by_rss_key(key)
|
||
|
def self.find_by_atom_key(key)
|
||
|
Token.find_active_user('feeds', key)
|
||
|
end
|
||
|
# TODO: remove in Redmine 3.0
|
||
|
def self.find_by_rss_key(key)
|
||
|
ActiveSupport::Deprecation.warn "User.find_by_rss_key is deprecated and will be removed in Redmine 3.0. Please use User.find_by_atom_key instead."
|
||
|
self.find_by_atom_key(key)
|
||
|
end
|
||
|
def self.find_by_api_key(key)
|
||
|
Token.find_active_user('api', key)
|
||
|
end
|
||
| ... | ... | |
|
def name(*args); I18n.t(:label_user_anonymous) end
|
||
|
def mail; nil end
|
||
|
def time_zone; nil end
|
||
|
def rss_key; nil end
|
||
|
def atom_key; nil end
|
||
|
def pref
|
||
|
UserPreference.new(:user => self)
|
||
| app/views/activities/index.html.erb | ||
|---|---|---|
|
</div>
|
||
|
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.rss_key) %>
|
||
|
<%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.atom_key) %>
|
||
|
<% end %>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %>
|
||
|
<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.atom_key)) %>
|
||
|
<% end %>
|
||
|
<% content_for :sidebar do %>
|
||
| app/views/boards/index.html.erb | ||
|---|---|---|
|
</table>
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_messages => 1, :key => User.current.rss_key} %>
|
||
|
<%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_messages => 1, :key => User.current.atom_key} %>
|
||
|
<% end %>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :show_messages => 1, :key => User.current.rss_key}) %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :show_messages => 1, :key => User.current.atom_key}) %>
|
||
|
<% end %>
|
||
|
<% html_title l(:label_board_plural) %>
|
||
| app/views/boards/show.html.erb | ||
|---|---|---|
|
<% end %>
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||
|
<%= f.link_to 'Atom', :url => {:key => User.current.atom_key} %>
|
||
|
<% end %>
|
||
|
<% html_title @board.name %>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.atom_key}, :title => "#{@project}: #{@board}") %>
|
||
|
<% end %>
|
||
| app/views/issues/index.html.erb | ||
|---|---|---|
|
<% end %>
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom', :url => params.merge(:key => User.current.rss_key) %>
|
||
|
<%= f.link_to 'Atom', :url => params.merge(:key => User.current.atom_key) %>
|
||
|
<%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
|
||
|
<%= f.link_to 'PDF', :url => params %>
|
||
|
<% end %>
|
||
| ... | ... | |
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom,
|
||
|
{:query_id => @query, :format => 'atom',
|
||
|
:page => nil, :key => User.current.rss_key},
|
||
|
:page => nil, :key => User.current.atom_key},
|
||
|
:title => l(:label_issue_plural)) %>
|
||
|
<%= auto_discovery_link_tag(:atom,
|
||
|
{:controller => 'journals', :action => 'index',
|
||
|
:query_id => @query, :format => 'atom',
|
||
|
:page => nil, :key => User.current.rss_key},
|
||
|
:page => nil, :key => User.current.atom_key},
|
||
|
:title => l(:label_changes_details)) %>
|
||
|
<% end %>
|
||
| app/views/issues/show.html.erb | ||
|---|---|---|
|
<% end %>
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||
|
<%= f.link_to 'Atom', :url => {:key => User.current.atom_key} %>
|
||
|
<%= f.link_to 'PDF' %>
|
||
|
<% end %>
|
||
| ... | ... | |
|
<% end %>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.atom_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %>
|
||
|
<% end %>
|
||
|
<%= context_menu issues_context_menu_path %>
|
||
| app/views/journals/index.builder | ||
|---|---|---|
|
xml.instruct!
|
||
|
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
||
|
xml.title @title
|
||
|
xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.rss_key, :only_path => false)
|
||
|
xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.atom_key, :only_path => false)
|
||
|
xml.link "rel" => "alternate", "href" => home_url(:only_path => false)
|
||
|
xml.id url_for(:controller => 'welcome', :only_path => false)
|
||
|
xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema)
|
||
| app/views/my/_sidebar.html.erb | ||
|---|---|---|
|
<h4><%= l(:label_feeds_access_key) %></h4>
|
||
|
<p>
|
||
|
<% if @user.rss_token %>
|
||
|
<%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.rss_token.created_on)) %>
|
||
|
<% if @user.atom_token %>
|
||
|
<%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.atom_token.created_on)) %>
|
||
|
<% else %>
|
||
|
<%= l(:label_missing_feeds_access_key) %>
|
||
|
<% end %>
|
||
|
(<%= link_to l(:button_reset), {:action => 'reset_rss_key'}, :method => :post %>)
|
||
|
(<%= link_to l(:button_reset), {:action => 'reset_atom_key'}, :method => :post %>)
|
||
|
</p>
|
||
|
<% if Setting.rest_api_enabled? %>
|
||
| app/views/my/blocks/_issuesassignedtome.html.erb | ||
|---|---|---|
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom,
|
||
|
{:controller => 'issues', :action => 'index', :set_filter => 1,
|
||
|
:assigned_to_id => 'me', :format => 'atom', :key => User.current.rss_key},
|
||
|
:assigned_to_id => 'me', :format => 'atom', :key => User.current.atom_key},
|
||
|
{:title => l(:label_assigned_to_me_issues)}) %>
|
||
|
<% end %>
|
||
| app/views/my/blocks/_issuesreportedbyme.html.erb | ||
|---|---|---|
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom,
|
||
|
{:controller => 'issues', :action => 'index', :set_filter => 1,
|
||
|
:author_id => 'me', :format => 'atom', :key => User.current.rss_key},
|
||
|
:author_id => 'me', :format => 'atom', :key => User.current.atom_key},
|
||
|
{:title => l(:label_reported_issues)}) %>
|
||
|
<% end %>
|
||
| app/views/news/index.html.erb | ||
|---|---|---|
|
<p class="pagination"><%= pagination_links_full @news_pages %></p>
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
|
||
|
<%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.atom_key} %>
|
||
|
<% end %>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
||
|
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.atom_key})) %>
|
||
|
<%= stylesheet_link_tag 'scm' %>
|
||
|
<% end %>
|
||
| app/views/projects/index.html.erb | ||
|---|---|---|
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.atom_key}) %>
|
||
|
<% end %>
|
||
|
<div class="contextual">
|
||
| ... | ... | |
|
<% end %>
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||
|
<%= f.link_to 'Atom', :url => {:key => User.current.atom_key} %>
|
||
|
<% end %>
|
||
|
<% content_for :sidebar do %>
|
||
| app/views/projects/show.html.erb | ||
|---|---|---|
|
<% end %>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.rss_key}) %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :id => @project, :format => 'atom', :key => User.current.atom_key}) %>
|
||
|
<% end %>
|
||
|
<% html_title(l(:label_overview)) -%>
|
||
| app/views/repositories/revisions.html.erb | ||
|---|---|---|
|
<%= auto_discovery_link_tag(
|
||
|
:atom,
|
||
|
params.merge(
|
||
|
{:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
||
|
{:format => 'atom', :page => nil, :key => User.current.atom_key})) %>
|
||
|
<% end %>
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||
|
<%= f.link_to 'Atom', :url => {:key => User.current.atom_key} %>
|
||
|
<% end %>
|
||
|
<% html_title(l(:label_revision_plural)) -%>
|
||
| app/views/repositories/show.html.erb | ||
|---|---|---|
|
<%= auto_discovery_link_tag(
|
||
|
:atom, params.merge(
|
||
|
{:format => 'atom', :action => 'revisions',
|
||
|
:id => @project, :page => nil, :key => User.current.rss_key})) %>
|
||
|
:id => @project, :page => nil, :key => User.current.atom_key})) %>
|
||
|
<% end %>
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom',
|
||
|
:url => {:action => 'revisions', :id => @project,
|
||
|
:repository_id => @repository.identifier_param,
|
||
|
:key => User.current.rss_key} %>
|
||
|
:key => User.current.atom_key} %>
|
||
|
<% end %>
|
||
|
<% end %>
|
||
|
<% end %>
|
||
| app/views/timelog/index.html.erb | ||
|---|---|---|
|
<p class="pagination"><%= pagination_links_full @entry_pages, @entry_count %></p>
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :key => User.current.rss_key}) %>
|
||
|
<%= f.link_to 'Atom', :url => params.merge({:issue_id => @issue, :key => User.current.atom_key}) %>
|
||
|
<%= f.link_to 'CSV', :url => params, :onclick => "showModal('csv-export-options', '330px'); return false;" %>
|
||
|
<% end %>
|
||
| ... | ... | |
|
<% html_title l(:label_spent_time), l(:label_details) %>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:issue_id => @issue, :format => 'atom', :key => User.current.rss_key}, :title => l(:label_spent_time)) %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:issue_id => @issue, :format => 'atom', :key => User.current.atom_key}, :title => l(:label_spent_time)) %>
|
||
|
<% end %>
|
||
| app/views/users/show.html.erb | ||
|---|---|---|
|
</div>
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => nil, :user_id => @user, :key => User.current.rss_key} %>
|
||
|
<%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => nil, :user_id => @user, :key => User.current.atom_key} %>
|
||
|
<% end %>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :user_id => @user, :format => :atom, :key => User.current.rss_key) %>
|
||
|
<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :user_id => @user, :format => :atom, :key => User.current.atom_key) %>
|
||
|
<% end %>
|
||
|
<% end %>
|
||
|
<%= call_hook :view_account_right_bottom, :user => @user %>
|
||
| app/views/welcome/index.html.erb | ||
|---|---|---|
|
</div>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:controller => 'news', :action => 'index', :key => User.current.rss_key, :format => 'atom'},
|
||
|
<%= auto_discovery_link_tag(:atom, {:controller => 'news', :action => 'index', :key => User.current.atom_key, :format => 'atom'},
|
||
|
:title => "#{Setting.app_title}: #{l(:label_news_latest)}") %>
|
||
|
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :key => User.current.rss_key, :format => 'atom'},
|
||
|
<%= auto_discovery_link_tag(:atom, {:controller => 'activities', :action => 'index', :key => User.current.atom_key, :format => 'atom'},
|
||
|
:title => "#{Setting.app_title}: #{l(:label_activity)}") %>
|
||
|
<% end %>
|
||
| app/views/wiki/date_index.html.erb | ||
|---|---|---|
|
<% unless @pages.empty? %>
|
||
|
<% other_formats_links do |f| %>
|
||
|
<%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %>
|
||
|
<%= f.link_to 'Atom', :url => {:controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :key => User.current.atom_key} %>
|
||
|
<% if User.current.allowed_to?(:export_wiki_pages, @project) %>
|
||
|
<%= f.link_to('PDF', :url => {:action => 'export', :format => 'pdf'}) %>
|
||
|
<%= f.link_to('HTML', :url => {:action => 'export'}) %>
|
||
| ... | ... | |
|
<% end %>
|
||
|
<% content_for :header_tags do %>
|
||
|
<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.rss_key) %>
|
||
|
<%= auto_discovery_link_tag(:atom, :controller => 'activities', :action => 'index', :id => @project, :show_wiki_edits => 1, :format => 'atom', :key => User.current.atom_key) %>
|
||
|
<% end %>
|
||
| app/views/wiki/index.html.erb | ||
|---|---|---|
|
<%= f.link_to 'Atom',
|
||
|
:url => {:controller => 'activities', :action => 'index',
|
||
|
:id => @project, :show_wiki_edits => 1,
|
||
|
:key => User.current.rss_key} %>
|
||
|
:key => User.current.atom_key} %>
|
||
|
<% if User.current.allowed_to?(:export_wiki_pages, @project) %>
|
||
|
<%= f.link_to('PDF', :url => {:action => 'export', :format => 'pdf'}) %>
|
||
|
<%= f.link_to('HTML', :url => {:action => 'export'}) %>
|
||
| ... | ... | |
|
<%= auto_discovery_link_tag(
|
||
|
:atom, :controller => 'activities', :action => 'index',
|
||
|
:id => @project, :show_wiki_edits => 1, :format => 'atom',
|
||
|
:key => User.current.rss_key) %>
|
||
|
:key => User.current.atom_key) %>
|
||
|
<% end %>
|
||
| config/routes.rb | ||
|---|---|---|
|
match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post]
|
||
|
match 'my/page', :controller => 'my', :action => 'page', :via => :get
|
||
|
match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page
|
||
|
match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post
|
||
|
match 'my/reset_atom_key', :controller => 'my', :action => 'reset_atom_key', :via => :post
|
||
|
match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post
|
||
|
match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post]
|
||
|
match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get
|
||
| test/functional/my_controller_test.rb | ||
|---|---|---|
|
assert_equal ['documents', 'calendar', 'latestnews'], User.find(2).pref[:my_page_layout]['left']
|
||
|
end
|
||
|
def test_reset_rss_key_with_existing_key
|
||
|
@previous_token_value = User.find(2).rss_key # Will generate one if it's missing
|
||
|
post :reset_rss_key
|
||
|
def test_reset_atom_key_with_existing_key
|
||
|
@previous_token_value = User.find(2).atom_key # Will generate one if it's missing
|
||
|
post :reset_atom_key
|
||
|
assert_not_equal @previous_token_value, User.find(2).rss_key
|
||
|
assert User.find(2).rss_token
|
||
|
assert_not_equal @previous_token_value, User.find(2).atom_key
|
||
|
assert User.find(2).atom_token
|
||
|
assert_match /reset/, flash[:notice]
|
||
|
assert_redirected_to '/my/account'
|
||
|
end
|
||
|
def test_reset_rss_key_without_existing_key
|
||
|
assert_nil User.find(2).rss_token
|
||
|
post :reset_rss_key
|
||
|
def test_reset_atom_key_without_existing_key
|
||
|
assert_nil User.find(2).atom_token
|
||
|
post :reset_atom_key
|
||
|
assert User.find(2).rss_token
|
||
|
assert User.find(2).atom_token
|
||
|
assert_match /reset/, flash[:notice]
|
||
|
assert_redirected_to '/my/account'
|
||
|
end
|
||
| test/integration/application_test.rb | ||
|---|---|---|
|
get 'issues/4.atom'
|
||
|
assert_response 302
|
||
|
rss_key = User.find(2).rss_key
|
||
|
get "issues/4.atom?key=#{rss_key}"
|
||
|
atom_key = User.find(2).atom_key
|
||
|
get "issues/4.atom?key=#{atom_key}"
|
||
|
assert_response 200
|
||
|
assert_nil session[:user_id]
|
||
|
end
|
||
| test/integration/routing/my_test.rb | ||
|---|---|---|
|
{ :controller => 'my', :action => 'index' }
|
||
|
)
|
||
|
assert_routing(
|
||
|
{ :method => 'post', :path => "/my/reset_rss_key" },
|
||
|
{ :controller => 'my', :action => 'reset_rss_key' }
|
||
|
{ :method => 'post', :path => "/my/reset_atom_key" },
|
||
|
{ :controller => 'my', :action => 'reset_atom_key' }
|
||
|
)
|
||
|
assert_routing(
|
||
|
{ :method => 'post', :path => "/my/reset_api_key" },
|
||
| test/unit/user_test.rb | ||
|---|---|---|
|
assert_equal 1, anon2.errors.count
|
||
|
end
|
||
|
def test_rss_key
|
||
|
assert_nil @jsmith.rss_token
|
||
|
key = @jsmith.rss_key
|
||
|
def test_atom_key
|
||
|
assert_nil @jsmith.atom_token
|
||
|
key = @jsmith.atom_key
|
||
|
assert_equal 40, key.length
|
||
|
@jsmith.reload
|
||
|
assert_equal key, @jsmith.rss_key
|
||
|
assert_equal key, @jsmith.atom_key
|
||
|
end
|
||
|
def test_rss_key_should_not_be_generated_twice
|
||
|
def test_atom_key_should_not_be_generated_twice
|
||
|
assert_difference 'Token.count', 1 do
|
||
|
key1 = @jsmith.rss_key
|
||
|
key2 = @jsmith.rss_key
|
||
|
key1 = @jsmith.atom_key
|
||
|
key2 = @jsmith.atom_key
|
||
|
assert_equal key1, key2
|
||
|
end
|
||
|
end
|
||