logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

api_routing_spec.rb (3161B)


  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe 'API routes' do
  4. describe 'Credentials routes' do
  5. it 'routes to verify credentials' do
  6. expect(get('/api/v1/accounts/verify_credentials')).
  7. to route_to('api/v1/accounts/credentials#show')
  8. end
  9. it 'routes to update credentials' do
  10. expect(patch('/api/v1/accounts/update_credentials')).
  11. to route_to('api/v1/accounts/credentials#update')
  12. end
  13. end
  14. describe 'Account routes' do
  15. it 'routes to statuses' do
  16. expect(get('/api/v1/accounts/user/statuses')).
  17. to route_to('api/v1/accounts/statuses#index', account_id: 'user')
  18. end
  19. it 'routes to followers' do
  20. expect(get('/api/v1/accounts/user/followers')).
  21. to route_to('api/v1/accounts/follower_accounts#index', account_id: 'user')
  22. end
  23. it 'routes to following' do
  24. expect(get('/api/v1/accounts/user/following')).
  25. to route_to('api/v1/accounts/following_accounts#index', account_id: 'user')
  26. end
  27. it 'routes to search' do
  28. expect(get('/api/v1/accounts/search')).
  29. to route_to('api/v1/accounts/search#show')
  30. end
  31. it 'routes to relationships' do
  32. expect(get('/api/v1/accounts/relationships')).
  33. to route_to('api/v1/accounts/relationships#index')
  34. end
  35. end
  36. describe 'Statuses routes' do
  37. it 'routes reblogged_by' do
  38. expect(get('/api/v1/statuses/123/reblogged_by')).
  39. to route_to('api/v1/statuses/reblogged_by_accounts#index', status_id: '123')
  40. end
  41. it 'routes favourited_by' do
  42. expect(get('/api/v1/statuses/123/favourited_by')).
  43. to route_to('api/v1/statuses/favourited_by_accounts#index', status_id: '123')
  44. end
  45. it 'routes reblog' do
  46. expect(post('/api/v1/statuses/123/reblog')).
  47. to route_to('api/v1/statuses/reblogs#create', status_id: '123')
  48. end
  49. it 'routes unreblog' do
  50. expect(post('/api/v1/statuses/123/unreblog')).
  51. to route_to('api/v1/statuses/reblogs#destroy', status_id: '123')
  52. end
  53. it 'routes favourite' do
  54. expect(post('/api/v1/statuses/123/favourite')).
  55. to route_to('api/v1/statuses/favourites#create', status_id: '123')
  56. end
  57. it 'routes unfavourite' do
  58. expect(post('/api/v1/statuses/123/unfavourite')).
  59. to route_to('api/v1/statuses/favourites#destroy', status_id: '123')
  60. end
  61. it 'routes mute' do
  62. expect(post('/api/v1/statuses/123/mute')).
  63. to route_to('api/v1/statuses/mutes#create', status_id: '123')
  64. end
  65. it 'routes unmute' do
  66. expect(post('/api/v1/statuses/123/unmute')).
  67. to route_to('api/v1/statuses/mutes#destroy', status_id: '123')
  68. end
  69. end
  70. describe 'Timeline routes' do
  71. it 'routes to home timeline' do
  72. expect(get('/api/v1/timelines/home')).
  73. to route_to('api/v1/timelines/home#show')
  74. end
  75. it 'routes to public timeline' do
  76. expect(get('/api/v1/timelines/public')).
  77. to route_to('api/v1/timelines/public#show')
  78. end
  79. it 'routes to tag timeline' do
  80. expect(get('/api/v1/timelines/tag/test')).
  81. to route_to('api/v1/timelines/tag#show', id: 'test')
  82. end
  83. end
  84. end