diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/credo/check/consistency/file_location.ex | 166 | ||||
-rw-r--r-- | test/fixtures/config/temp.secret.exs | 4 | ||||
-rw-r--r-- | test/fixtures/mastodon-post-activity-nsfw.json | 68 | ||||
-rw-r--r-- | test/fixtures/modules/runtime_module.ex | 2 | ||||
-rw-r--r-- | test/instance_static/emoji/blobs.gg/blank.png | bin | 0 -> 95 bytes | |||
-rw-r--r-- | test/instance_static/emoji/blobs.gg/pack.json | 11 | ||||
-rw-r--r-- | test/mix/pleroma_test.exs (renamed from test/tasks/pleroma_test.exs) | 0 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/app_test.exs (renamed from test/tasks/app_test.exs) | 0 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/config_test.exs (renamed from test/tasks/config_test.exs) | 0 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/count_statuses_test.exs (renamed from test/tasks/count_statuses_test.exs) | 0 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/database_test.exs (renamed from test/tasks/database_test.exs) | 0 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/digest_test.exs (renamed from test/tasks/digest_test.exs) | 4 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/ecto/migrate_test.exs (renamed from test/tasks/ecto/migrate_test.exs) | 0 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/ecto/rollback_test.exs (renamed from test/tasks/ecto/rollback_test.exs) | 0 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/ecto_test.exs (renamed from test/tasks/ecto/ecto_test.exs) | 0 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/email_test.exs (renamed from test/tasks/email_test.exs) | 4 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/emoji_test.exs (renamed from test/tasks/emoji_test.exs) | 4 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/frontend_test.exs (renamed from test/tasks/frontend_test.exs) | 2 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/instance_test.exs (renamed from test/tasks/instance_test.exs) | 20 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/refresh_counter_cache_test.exs (renamed from test/tasks/refresh_counter_cache_test.exs) | 0 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/relay_test.exs (renamed from test/tasks/relay_test.exs) | 74 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/release_env_test.exs | 30 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/robots_txt_test.exs (renamed from test/tasks/robots_txt_test.exs) | 0 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/uploads_test.exs (renamed from test/tasks/uploads_test.exs) | 0 | ||||
-rw-r--r-- | test/mix/tasks/pleroma/user_test.exs (renamed from test/tasks/user_test.exs) | 11 | ||||
-rw-r--r-- | test/pleroma/activity/ir/topics_test.exs (renamed from test/activity/ir/topics_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/activity_test.exs (renamed from test/activity_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/application_requirements_test.exs (renamed from test/application_requirements_test.exs) | 31 | ||||
-rw-r--r-- | test/pleroma/bbs/handler_test.exs (renamed from test/bbs/handler_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/bookmark_test.exs (renamed from test/bookmark_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/captcha_test.exs (renamed from test/captcha_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/chat/message_reference_test.exs (renamed from test/chat/message_reference_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/chat_test.exs (renamed from test/chat_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/config/deprecation_warnings_test.exs (renamed from test/config/deprecation_warnings_test.exs) | 6 | ||||
-rw-r--r-- | test/pleroma/config/holder_test.exs (renamed from test/config/holder_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/config/loader_test.exs (renamed from test/config/loader_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/config/transfer_task_test.exs (renamed from test/config/transfer_task_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/config_db_test.exs (renamed from test/config/config_db_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/config_test.exs (renamed from test/config_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/conversation/participation_test.exs (renamed from test/conversation/participation_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/conversation_test.exs (renamed from test/conversation_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/docs/generator_test.exs (renamed from test/docs/generator_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/earmark_renderer_test.exs (renamed from test/earmark_renderer_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs (renamed from test/web/activity_pub/object_validators/types/date_time_test.exs) | 6 | ||||
-rw-r--r-- | test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs (renamed from test/web/activity_pub/object_validators/types/object_id_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs (renamed from test/web/activity_pub/object_validators/types/recipients_test.exs) | 6 | ||||
-rw-r--r-- | test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs (renamed from test/web/activity_pub/object_validators/types/safe_text_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/emails/admin_email_test.exs (renamed from test/emails/admin_email_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/emails/mailer_test.exs (renamed from test/emails/mailer_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/emails/user_email_test.exs (renamed from test/emails/user_email_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/emoji/formatter_test.exs (renamed from test/emoji/formatter_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/emoji/loader_test.exs (renamed from test/emoji/loader_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/emoji/pack_test.exs (renamed from test/emoji/pack_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/emoji_test.exs (renamed from test/emoji_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/filter_test.exs (renamed from test/filter_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/following_relationship_test.exs (renamed from test/following_relationship_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/formatter_test.exs (renamed from test/formatter_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/gun/connection_pool_test.exs (renamed from test/gun/conneciton_pool_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/healthcheck_test.exs (renamed from test/healthcheck_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/html_test.exs (renamed from test/html_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/http/adapter_helper/gun_test.exs (renamed from test/http/adapter_helper/gun_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/http/adapter_helper/hackney_test.exs (renamed from test/http/adapter_helper/hackney_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/http/adapter_helper_test.exs (renamed from test/http/adapter_helper_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/http/ex_aws_test.exs (renamed from test/http/ex_aws_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/http/request_builder_test.exs (renamed from test/http/request_builder_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/http/tzdata_test.exs (renamed from test/http/tzdata_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/http_test.exs (renamed from test/http_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/instances/instance_test.exs (renamed from test/web/instances/instance_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/instances_test.exs (renamed from test/web/instances/instances_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/integration/federation_test.exs (renamed from test/federation/federation_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/integration/mastodon_websocket_test.exs (renamed from test/integration/mastodon_websocket_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/job_queue_monitor_test.exs (renamed from test/job_queue_monitor_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/keys_test.exs (renamed from test/keys_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/list_test.exs (renamed from test/list_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/marker_test.exs (renamed from test/marker_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/mfa/backup_codes_test.exs (renamed from test/mfa/backup_codes_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/mfa/totp_test.exs (renamed from test/mfa/totp_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/mfa_test.exs (renamed from test/mfa_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/migration_helper/notification_backfill_test.exs (renamed from test/migration_helper/notification_backfill_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/moderation_log_test.exs (renamed from test/moderation_log_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/notification_test.exs (renamed from test/notification_test.exs) | 10 | ||||
-rw-r--r-- | test/pleroma/object/containment_test.exs (renamed from test/object/containment_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/object/fetcher_test.exs (renamed from test/object/fetcher_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/object_test.exs (renamed from test/object_test.exs) | 10 | ||||
-rw-r--r-- | test/pleroma/otp_version_test.exs (renamed from test/otp_version_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/pagination_test.exs (renamed from test/pagination_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/registration_test.exs (renamed from test/registration_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/repo/migrations/autolinker_to_linkify_test.exs (renamed from test/migrations/20200716195806_autolinker_to_linkify_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/repo/migrations/fix_legacy_tags_test.exs (renamed from test/migrations/20200802170532_fix_legacy_tags_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs (renamed from test/migrations/20200722185515_fix_malformed_formatter_config_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/repo/migrations/move_welcome_settings_test.exs (renamed from test/migrations/20200724133313_move_welcome_settings_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/repo_test.exs (renamed from test/repo_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/report_note_test.exs (renamed from test/report_note_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/reverse_proxy_test.exs (renamed from test/reverse_proxy/reverse_proxy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/runtime_test.exs (renamed from test/runtime_test.exs) | 3 | ||||
-rw-r--r-- | test/pleroma/safe_jsonb_set_test.exs (renamed from test/safe_jsonb_set_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/scheduled_activity_test.exs (renamed from test/scheduled_activity_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/signature_test.exs (renamed from test/signature_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/stats_test.exs (renamed from test/stats_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/upload/filter/anonymize_filename_test.exs (renamed from test/upload/filter/anonymize_filename_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/upload/filter/dedupe_test.exs (renamed from test/upload/filter/dedupe_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/upload/filter/exiftool_test.exs (renamed from test/upload/filter/exiftool_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/upload/filter/mogrifun_test.exs (renamed from test/upload/filter/mogrifun_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/upload/filter/mogrify_test.exs (renamed from test/upload/filter/mogrify_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/upload/filter_test.exs (renamed from test/upload/filter_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/upload_test.exs (renamed from test/upload_test.exs) | 68 | ||||
-rw-r--r-- | test/pleroma/uploaders/local_test.exs (renamed from test/uploaders/local_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/uploaders/s3_test.exs (renamed from test/uploaders/s3_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/user/import_test.exs (renamed from test/user/import_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/user/notification_setting_test.exs (renamed from test/user/notification_setting_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/user/query_test.exs (renamed from test/user/query_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/user/welcome_chat_message_test.exs (renamed from test/user/welcome_chat_massage_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/user/welcome_email_test.exs (renamed from test/user/welcome_email_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/user/welcome_message_test.exs (renamed from test/user/welcome_message_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/user_invite_token_test.exs (renamed from test/user_invite_token_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/user_relationship_test.exs (renamed from test/user_relationship_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/user_search_test.exs (renamed from test/user_search_test.exs) | 8 | ||||
-rw-r--r-- | test/pleroma/user_test.exs (renamed from test/user_test.exs) | 22 | ||||
-rw-r--r-- | test/pleroma/utils_test.exs (renamed from test/utils_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/activity_pub_controller_test.exs (renamed from test/web/activity_pub/activity_pub_controller_test.exs) | 5 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/activity_pub_test.exs (renamed from test/web/activity_pub/activity_pub_test.exs) | 108 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/activity_expiration_policy_test.exs (renamed from test/web/activity_pub/mrf/activity_expiration_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs (renamed from test/web/activity_pub/mrf/anti_followbot_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/anti_link_spam_policy_test.exs (renamed from test/web/activity_pub/mrf/anti_link_spam_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs (renamed from test/web/activity_pub/mrf/ensure_re_prepended_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs (renamed from test/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs (renamed from test/web/activity_pub/mrf/hellthread_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs (renamed from test/web/activity_pub/mrf/keyword_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs (renamed from test/web/activity_pub/mrf/mediaproxy_warming_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/mention_policy_test.exs (renamed from test/web/activity_pub/mrf/mention_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs (renamed from test/web/activity_pub/mrf/no_placeholder_text_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs (renamed from test/web/activity_pub/mrf/normalize_markup_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs (renamed from test/web/activity_pub/mrf/object_age_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs (renamed from test/web/activity_pub/mrf/reject_non_public_test.exs) | 8 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/simple_policy_test.exs (renamed from test/web/activity_pub/mrf/simple_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs (renamed from test/web/activity_pub/mrf/steal_emoji_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs (renamed from test/web/activity_pub/mrf/subchain_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/tag_policy_test.exs (renamed from test/web/activity_pub/mrf/tag_policy_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs (renamed from test/web/activity_pub/mrf/user_allowlist_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs (renamed from test/web/activity_pub/mrf/vocabulary_policy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf_test.exs (renamed from test/web/activity_pub/mrf/mrf_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs (renamed from test/web/activity_pub/object_validators/accept_validation_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs (renamed from test/web/activity_pub/object_validators/announce_validation_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs (renamed from test/web/activity_pub/object_validators/article_note_validator_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs (renamed from test/web/activity_pub/object_validators/attachment_validator_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/block_validation_test.exs (renamed from test/web/activity_pub/object_validators/block_validation_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs (renamed from test/web/activity_pub/object_validators/chat_validation_test.exs) | 6 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs (renamed from test/web/activity_pub/object_validators/delete_validation_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs (renamed from test/web/activity_pub/object_validators/emoji_react_validation_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs (renamed from test/web/activity_pub/object_validators/follow_validation_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/like_validation_test.exs (renamed from test/web/activity_pub/object_validators/like_validation_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs (renamed from test/web/activity_pub/object_validators/reject_validation_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs (renamed from test/web/activity_pub/object_validators/undo_validation_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/object_validators/update_handling_test.exs (renamed from test/web/activity_pub/object_validators/update_validation_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/pipeline_test.exs (renamed from test/web/activity_pub/pipeline_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/publisher_test.exs (renamed from test/web/activity_pub/publisher_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/relay_test.exs (renamed from test/web/activity_pub/relay_test.exs) | 40 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/side_effects_test.exs (renamed from test/web/activity_pub/side_effects_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/accept_handling_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/announce_handling_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/answer_handling_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/article_handling_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/audio_handling_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/block_handling_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs (renamed from test/web/activity_pub/transmogrifier/chat_message_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/delete_handling_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/emoji_react_handling_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/event_handling_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/follow_handling_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/like_handling_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/question_handling_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/reject_handling_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/undo_handling_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/user_update_handling_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs (renamed from test/web/activity_pub/transmogrifier/video_handling_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/transmogrifier_test.exs (renamed from test/web/activity_pub/transmogrifier_test.exs) | 12 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/utils_test.exs (renamed from test/web/activity_pub/utils_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/views/object_view_test.exs (renamed from test/web/activity_pub/views/object_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/views/user_view_test.exs (renamed from test/web/activity_pub/views/user_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/visibility_test.exs (renamed from test/web/activity_pub/visibilty_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs (renamed from test/web/admin_api/controllers/admin_api_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/admin_api/controllers/chat_controller_test.exs (renamed from test/web/admin_api/controllers/chat_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/admin_api/controllers/config_controller_test.exs (renamed from test/web/admin_api/controllers/config_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/admin_api/controllers/instance_document_controller_test.exs (renamed from test/web/admin_api/controllers/instance_document_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/admin_api/controllers/invite_controller_test.exs (renamed from test/web/admin_api/controllers/invite_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs (renamed from test/web/admin_api/controllers/media_proxy_cache_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs (renamed from test/web/admin_api/controllers/oauth_app_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/admin_api/controllers/relay_controller_test.exs (renamed from test/web/admin_api/controllers/relay_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/admin_api/controllers/report_controller_test.exs (renamed from test/web/admin_api/controllers/report_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/admin_api/controllers/status_controller_test.exs (renamed from test/web/admin_api/controllers/status_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/admin_api/search_test.exs (renamed from test/web/admin_api/search_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/admin_api/views/report_view_test.exs (renamed from test/web/admin_api/views/report_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/api_spec/schema_examples_test.exs (renamed from test/web/api_spec/schema_examples_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/auth/auth_controller_test.exs (renamed from test/web/auth/auth_test_controller_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/auth/authenticator_test.exs (renamed from test/web/auth/authenticator_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/auth/basic_auth_test.exs (renamed from test/web/auth/basic_auth_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/auth/pleroma_authenticator_test.exs (renamed from test/web/auth/pleroma_authenticator_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/auth/totp_authenticator_test.exs (renamed from test/web/auth/totp_authenticator_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/chat_channel_test.exs (renamed from test/web/chat_channel_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/common_api/utils_test.exs (renamed from test/web/common_api/common_api_utils_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/common_api_test.exs (renamed from test/web/common_api/common_api_test.exs) | 28 | ||||
-rw-r--r-- | test/pleroma/web/fallback_test.exs (renamed from test/web/fallback_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/fed_sockets/fed_registry_test.exs (renamed from test/web/fed_sockets/fed_registry_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/fed_sockets/fetch_registry_test.exs (renamed from test/web/fed_sockets/fetch_registry_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/fed_sockets/socket_info_test.exs (renamed from test/web/fed_sockets/socket_info_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/federator_test.exs (renamed from test/web/federator_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/feed/tag_controller_test.exs (renamed from test/web/feed/tag_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/feed/user_controller_test.exs (renamed from test/web/feed/user_controller_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/account_controller_test.exs (renamed from test/web/mastodon_api/controllers/account_controller_test.exs) | 12 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/app_controller_test.exs (renamed from test/web/mastodon_api/controllers/app_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs (renamed from test/web/mastodon_api/controllers/auth_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs (renamed from test/web/mastodon_api/controllers/conversation_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/custom_emoji_controller_test.exs (renamed from test/web/mastodon_api/controllers/custom_emoji_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs (renamed from test/web/mastodon_api/controllers/domain_block_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs (renamed from test/web/mastodon_api/controllers/filter_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs (renamed from test/web/mastodon_api/controllers/follow_request_controller_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs (renamed from test/web/mastodon_api/controllers/instance_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/list_controller_test.exs (renamed from test/web/mastodon_api/controllers/list_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs (renamed from test/web/mastodon_api/controllers/marker_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/media_controller_test.exs (renamed from test/web/mastodon_api/controllers/media_controller_test.exs) | 6 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs (renamed from test/web/mastodon_api/controllers/notification_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs (renamed from test/web/mastodon_api/controllers/poll_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/report_controller_test.exs (renamed from test/web/mastodon_api/controllers/report_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs (renamed from test/web/mastodon_api/controllers/scheduled_activity_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/search_controller_test.exs (renamed from test/web/mastodon_api/controllers/search_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/status_controller_test.exs (renamed from test/web/mastodon_api/controllers/status_controller_test.exs) | 6 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs (renamed from test/web/mastodon_api/controllers/subscription_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs (renamed from test/web/mastodon_api/controllers/suggestion_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs (renamed from test/web/mastodon_api/controllers/timeline_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/masto_fe_controller_test.exs (renamed from test/web/masto_fe_controller_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs (renamed from test/web/mastodon_api/mastodon_api_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/mastodon_api_test.exs (renamed from test/web/mastodon_api/mastodon_api_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/update_credentials_test.exs (renamed from test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs) | 8 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/views/account_view_test.exs (renamed from test/web/mastodon_api/views/account_view_test.exs) | 12 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/views/conversation_view_test.exs (renamed from test/web/mastodon_api/views/conversation_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/views/list_view_test.exs (renamed from test/web/mastodon_api/views/list_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/views/marker_view_test.exs (renamed from test/web/mastodon_api/views/marker_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/views/notification_view_test.exs (renamed from test/web/mastodon_api/views/notification_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/views/poll_view_test.exs (renamed from test/web/mastodon_api/views/poll_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs (renamed from test/web/mastodon_api/views/scheduled_activity_view_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/views/status_view_test.exs (renamed from test/web/mastodon_api/views/status_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/mastodon_api/views/subscription_view_test.exs (renamed from test/web/mastodon_api/views/subscription_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/media_proxy/invalidation/http_test.exs (renamed from test/web/media_proxy/invalidations/http_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/media_proxy/invalidation/script_test.exs (renamed from test/web/media_proxy/invalidations/script_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/media_proxy/invalidation_test.exs (renamed from test/web/media_proxy/invalidation_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/media_proxy/media_proxy_controller_test.exs (renamed from test/web/media_proxy/media_proxy_controller_test.exs) | 15 | ||||
-rw-r--r-- | test/pleroma/web/media_proxy_test.exs (renamed from test/web/media_proxy/media_proxy_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/metadata/player_view_test.exs (renamed from test/web/metadata/player_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/metadata/providers/feed_test.exs (renamed from test/web/metadata/feed_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/metadata/providers/open_graph_test.exs (renamed from test/web/metadata/opengraph_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/metadata/providers/rel_me_test.exs (renamed from test/web/metadata/rel_me_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/metadata/providers/restrict_indexing_test.exs (renamed from test/web/metadata/restrict_indexing_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/metadata/providers/twitter_card_test.exs (renamed from test/web/metadata/twitter_card_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/metadata/utils_test.exs (renamed from test/web/metadata/utils_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/metadata_test.exs (renamed from test/web/metadata/metadata_test.exs) | 8 | ||||
-rw-r--r-- | test/pleroma/web/mongoose_im_controller_test.exs (renamed from test/web/mongooseim/mongoose_im_controller_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/node_info_test.exs (renamed from test/web/node_info_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/o_auth/app_test.exs (renamed from test/web/oauth/app_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/o_auth/authorization_test.exs (renamed from test/web/oauth/authorization_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/o_auth/ldap_authorization_test.exs (renamed from test/web/oauth/ldap_authorization_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/o_auth/mfa_controller_test.exs (renamed from test/web/oauth/mfa_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/o_auth/o_auth_controller_test.exs (renamed from test/web/oauth/oauth_controller_test.exs) | 14 | ||||
-rw-r--r-- | test/pleroma/web/o_auth/token/utils_test.exs (renamed from test/web/oauth/token/utils_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/o_auth/token_test.exs (renamed from test/web/oauth/token_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/o_status/o_status_controller_test.exs (renamed from test/web/ostatus/ostatus_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/controllers/account_controller_test.exs (renamed from test/web/pleroma_api/controllers/account_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs (renamed from test/web/pleroma_api/controllers/chat_controller_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs (renamed from test/web/pleroma_api/controllers/conversation_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs (renamed from test/web/pleroma_api/controllers/emoji_file_controller_test.exs) | 40 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs (renamed from test/web/pleroma_api/controllers/emoji_pack_controller_test.exs) | 112 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs (renamed from test/web/pleroma_api/controllers/emoji_reaction_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs (renamed from test/web/pleroma_api/controllers/mascot_controller_test.exs) | 6 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs (renamed from test/web/pleroma_api/controllers/notification_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs (renamed from test/web/pleroma_api/controllers/scrobble_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs (renamed from test/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs (renamed from test/web/pleroma_api/controllers/user_import_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs (renamed from test/web/pleroma_api/views/chat/message_reference_view_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/views/chat_view_test.exs (renamed from test/web/pleroma_api/views/chat_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/pleroma_api/views/scrobble_view_test.exs (renamed from test/web/pleroma_api/views/scrobble_view_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs (renamed from test/plugs/admin_secret_authentication_plug_test.exs) | 10 | ||||
-rw-r--r-- | test/pleroma/web/plugs/authentication_plug_test.exs (renamed from test/plugs/authentication_plug_test.exs) | 10 | ||||
-rw-r--r-- | test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs (renamed from test/plugs/basic_auth_decoder_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/cache_control_test.exs (renamed from test/plugs/cache_control_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/plugs/cache_test.exs (renamed from test/plugs/cache_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/ensure_authenticated_plug_test.exs (renamed from test/plugs/ensure_authenticated_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs (renamed from test/plugs/ensure_public_or_authenticated_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/ensure_user_key_plug_test.exs (renamed from test/plugs/ensure_user_key_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/federating_plug_test.exs (renamed from test/web/plugs/federating_plug_test.exs) | 6 | ||||
-rw-r--r-- | test/pleroma/web/plugs/frontend_static_plug_test.exs (renamed from test/plugs/frontend_static_test.exs) | 5 | ||||
-rw-r--r-- | test/pleroma/web/plugs/http_security_plug_test.exs (renamed from test/plugs/http_security_plug_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/plugs/http_signature_plug_test.exs (renamed from test/plugs/http_signature_plug_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/plugs/idempotency_plug_test.exs (renamed from test/plugs/idempotency_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/instance_static_test.exs (renamed from test/plugs/instance_static_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/plugs/legacy_authentication_plug_test.exs (renamed from test/plugs/legacy_authentication_plug_test.exs) | 8 | ||||
-rw-r--r-- | test/pleroma/web/plugs/mapped_signature_to_identity_plug_test.exs (renamed from test/plugs/mapped_identity_to_signature_plug_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/plugs/o_auth_plug_test.exs (renamed from test/plugs/oauth_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/o_auth_scopes_plug_test.exs (renamed from test/plugs/oauth_scopes_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/plug_helper_test.exs (renamed from test/web/plugs/plug_test.exs) | 8 | ||||
-rw-r--r-- | test/pleroma/web/plugs/rate_limiter_test.exs (renamed from test/plugs/rate_limiter_test.exs) | 6 | ||||
-rw-r--r-- | test/pleroma/web/plugs/remote_ip_test.exs (renamed from test/plugs/remote_ip_test.exs) | 53 | ||||
-rw-r--r-- | test/pleroma/web/plugs/session_authentication_plug_test.exs (renamed from test/plugs/session_authentication_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/set_format_plug_test.exs (renamed from test/plugs/set_format_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/set_locale_plug_test.exs (renamed from test/plugs/set_locale_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/set_user_session_id_plug_test.exs (renamed from test/plugs/set_user_session_id_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/uploaded_media_plug_test.exs (renamed from test/plugs/uploaded_media_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/user_enabled_plug_test.exs (renamed from test/plugs/user_enabled_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/user_fetcher_plug_test.exs (renamed from test/plugs/user_fetcher_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/plugs/user_is_admin_plug_test.exs (renamed from test/plugs/user_is_admin_plug_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/preload/providers/instance_test.exs (renamed from test/web/preload/instance_test.exs) | 8 | ||||
-rw-r--r-- | test/pleroma/web/preload/providers/timeline_test.exs (renamed from test/web/preload/timeline_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/preload/providers/user_test.exs (renamed from test/web/preload/user_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/push/impl_test.exs (renamed from test/web/push/impl_test.exs) | 24 | ||||
-rw-r--r-- | test/pleroma/web/rel_me_test.exs (renamed from test/web/rel_me_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/rich_media/helpers_test.exs (renamed from test/web/rich_media/helpers_test.exs) | 36 | ||||
-rw-r--r-- | test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs (renamed from test/web/rich_media/aws_signed_url_test.exs) | 2 | ||||
-rw-r--r-- | test/pleroma/web/rich_media/parser_test.exs (renamed from test/web/rich_media/parser_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/rich_media/parsers/twitter_card_test.exs (renamed from test/web/rich_media/parsers/twitter_card_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/static_fe/static_fe_controller_test.exs (renamed from test/web/static_fe/static_fe_controller_test.exs) | 4 | ||||
-rw-r--r-- | test/pleroma/web/streamer_test.exs (renamed from test/web/streamer/streamer_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/twitter_api/controller_test.exs (renamed from test/web/twitter_api/twitter_api_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/twitter_api/password_controller_test.exs (renamed from test/web/twitter_api/password_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/twitter_api/remote_follow_controller_test.exs (renamed from test/web/twitter_api/remote_follow_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/twitter_api/twitter_api_test.exs (renamed from test/web/twitter_api/twitter_api_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/twitter_api/util_controller_test.exs (renamed from test/web/twitter_api/util_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/uploader_controller_test.exs (renamed from test/web/uploader_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/views/error_view_test.exs (renamed from test/web/views/error_view_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/web_finger/web_finger_controller_test.exs (renamed from test/web/web_finger/web_finger_controller_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/web/web_finger_test.exs (renamed from test/web/web_finger/web_finger_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/workers/cron/digest_emails_worker_test.exs (renamed from test/workers/cron/digest_emails_worker_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/workers/cron/new_users_digest_worker_test.exs (renamed from test/workers/cron/new_users_digest_worker_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/workers/purge_expired_activity_test.exs (renamed from test/workers/purge_expired_activity_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/workers/purge_expired_token_test.exs (renamed from test/workers/purge_expired_token_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/workers/scheduled_activity_worker_test.exs (renamed from test/workers/scheduled_activity_worker_test.exs) | 0 | ||||
-rw-r--r-- | test/pleroma/xml_builder_test.exs (renamed from test/xml_builder_test.exs) | 0 | ||||
-rw-r--r-- | test/support/captcha/mock.ex (renamed from test/support/captcha_mock.ex) | 0 | ||||
-rw-r--r-- | test/support/channel_case.ex | 2 | ||||
-rw-r--r-- | test/support/conn_case.ex | 3 | ||||
-rw-r--r-- | test/support/factory.ex | 2 | ||||
-rw-r--r-- | test/support/web_push_http_client_mock.ex | 23 |
339 files changed, 1022 insertions, 412 deletions
diff --git a/test/credo/check/consistency/file_location.ex b/test/credo/check/consistency/file_location.ex new file mode 100644 index 000000000..500983608 --- /dev/null +++ b/test/credo/check/consistency/file_location.ex @@ -0,0 +1,166 @@ +# Pleroma: A lightweight social networking server +# Originally taken from +# https://github.com/VeryBigThings/elixir_common/blob/master/lib/vbt/credo/check/consistency/file_location.ex +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Credo.Check.Consistency.FileLocation do + @moduledoc false + + # credo:disable-for-this-file Credo.Check.Readability.Specs + + @checkdoc """ + File location should follow the namespace hierarchy of the module it defines. + + Examples: + + - `lib/my_system.ex` should define the `MySystem` module + - `lib/my_system/accounts.ex` should define the `MySystem.Accounts` module + """ + @explanation [warning: @checkdoc] + + @special_namespaces [ + "controllers", + "views", + "operations", + "channels" + ] + + # `use Credo.Check` required that module attributes are already defined, so we need + # to place these attributes + # before use/alias expressions. + # credo:disable-for-next-line VBT.Credo.Check.Consistency.ModuleLayout + use Credo.Check, category: :warning, base_priority: :high + + alias Credo.Code + + def run(source_file, params \\ []) do + case verify(source_file, params) do + :ok -> + [] + + {:error, module, expected_file} -> + error(IssueMeta.for(source_file, params), module, expected_file) + end + end + + defp verify(source_file, params) do + source_file.filename + |> Path.relative_to_cwd() + |> verify(Code.ast(source_file), params) + end + + @doc false + def verify(relative_path, ast, params) do + if verify_path?(relative_path, params), + do: ast |> main_module() |> verify_module(relative_path, params), + else: :ok + end + + defp verify_path?(relative_path, params) do + case Path.split(relative_path) do + ["lib" | _] -> not exclude?(relative_path, params) + ["test", "support" | _] -> false + ["test", "test_helper.exs"] -> false + ["test" | _] -> not exclude?(relative_path, params) + _ -> false + end + end + + defp exclude?(relative_path, params) do + params + |> Keyword.get(:exclude, []) + |> Enum.any?(&String.starts_with?(relative_path, &1)) + end + + defp main_module(ast) do + {_ast, modules} = Macro.prewalk(ast, [], &traverse/2) + Enum.at(modules, -1) + end + + defp traverse({:defmodule, _meta, args}, modules) do + [{:__aliases__, _, name_parts}, _module_body] = args + {args, [Module.concat(name_parts) | modules]} + end + + defp traverse(ast, state), do: {ast, state} + + # empty file - shouldn't really happen, but we'll let it through + defp verify_module(nil, _relative_path, _params), do: :ok + + defp verify_module(main_module, relative_path, params) do + parsed_path = parsed_path(relative_path, params) + + expected_file = + expected_file_base(parsed_path.root, main_module) <> + Path.extname(parsed_path.allowed) + + cond do + expected_file == parsed_path.allowed -> + :ok + + special_namespaces?(parsed_path.allowed) -> + original_path = parsed_path.allowed + + namespace = + Enum.find(@special_namespaces, original_path, fn namespace -> + String.contains?(original_path, namespace) + end) + + allowed = String.replace(original_path, "/" <> namespace, "") + + if expected_file == allowed, + do: :ok, + else: {:error, main_module, expected_file} + + true -> + {:error, main_module, expected_file} + end + end + + defp special_namespaces?(path), do: String.contains?(path, @special_namespaces) + + defp parsed_path(relative_path, params) do + parts = Path.split(relative_path) + + allowed = + Keyword.get(params, :ignore_folder_namespace, %{}) + |> Stream.flat_map(fn {root, folders} -> Enum.map(folders, &Path.join([root, &1])) end) + |> Stream.map(&Path.split/1) + |> Enum.find(&List.starts_with?(parts, &1)) + |> case do + nil -> + relative_path + + ignore_parts -> + Stream.drop(ignore_parts, -1) + |> Enum.concat(Stream.drop(parts, length(ignore_parts))) + |> Path.join() + end + + %{root: hd(parts), allowed: allowed} + end + + defp expected_file_base(root_folder, module) do + {parent_namespace, module_name} = module |> Module.split() |> Enum.split(-1) + + relative_path = + if parent_namespace == [], + do: "", + else: parent_namespace |> Module.concat() |> Macro.underscore() + + file_name = module_name |> Module.concat() |> Macro.underscore() + + Path.join([root_folder, relative_path, file_name]) + end + + defp error(issue_meta, module, expected_file) do + format_issue(issue_meta, + message: + "Mismatch between file name and main module #{inspect(module)}. " <> + "Expected file path to be #{expected_file}. " <> + "Either move the file or rename the module.", + line_no: 1 + ) + end +end diff --git a/test/fixtures/config/temp.secret.exs b/test/fixtures/config/temp.secret.exs index fa8c7c7e8..621bc8cf6 100644 --- a/test/fixtures/config/temp.secret.exs +++ b/test/fixtures/config/temp.secret.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + use Mix.Config config :pleroma, :first_setting, key: "value", key2: [Pleroma.Repo] diff --git a/test/fixtures/mastodon-post-activity-nsfw.json b/test/fixtures/mastodon-post-activity-nsfw.json new file mode 100644 index 000000000..70729a1bd --- /dev/null +++ b/test/fixtures/mastodon-post-activity-nsfw.json @@ -0,0 +1,68 @@ +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://w3id.org/security/v1", + { + "Emoji": "toot:Emoji", + "Hashtag": "as:Hashtag", + "atomUri": "ostatus:atomUri", + "conversation": "ostatus:conversation", + "inReplyToAtomUri": "ostatus:inReplyToAtomUri", + "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", + "movedTo": "as:movedTo", + "ostatus": "http://ostatus.org#", + "toot": "http://joinmastodon.org/ns#" + } + ], + "actor": "http://mastodon.example.org/users/admin", + "cc": [ + "http://mastodon.example.org/users/admin/followers", + "http://localtesting.pleroma.lol/users/lain" + ], + "id": "http://mastodon.example.org/users/admin/statuses/99512778738411822/activity", + "nickname": "lain", + "object": { + "atomUri": "http://mastodon.example.org/users/admin/statuses/99512778738411822", + "attachment": [], + "attributedTo": "http://mastodon.example.org/users/admin", + "cc": [ + "http://mastodon.example.org/users/admin/followers", + "http://localtesting.pleroma.lol/users/lain" + ], + "content": "<p><span class=\"h-card\"><a href=\"http://localtesting.pleroma.lol/users/lain\" class=\"u-url mention\">@<span>lain</span></a></span> #moo</p>", + "conversation": "tag:mastodon.example.org,2018-02-12:objectId=20:objectType=Conversation", + "id": "http://mastodon.example.org/users/admin/statuses/99512778738411822", + "inReplyTo": null, + "inReplyToAtomUri": null, + "published": "2018-02-12T14:08:20Z", + "summary": "cw", + "tag": [ + { + "href": "http://localtesting.pleroma.lol/users/lain", + "name": "@lain@localtesting.pleroma.lol", + "type": "Mention" + }, + { + "href": "http://mastodon.example.org/tags/nsfw", + "name": "#NSFW", + "type": "Hashtag" + } + ], + "to": [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "type": "Note", + "url": "http://mastodon.example.org/@admin/99512778738411822" + }, + "published": "2018-02-12T14:08:20Z", + "signature": { + "created": "2018-02-12T14:08:20Z", + "creator": "http://mastodon.example.org/users/admin#main-key", + "signatureValue": "rnNfcopkc6+Ju73P806popcfwrK9wGYHaJVG1/ZvrlEbWVDzaHjkXqj9Q3/xju5l8CSn9tvSgCCtPFqZsFQwn/pFIFUcw7ZWB2xi4bDm3NZ3S4XQ8JRaaX7og5hFxAhWkGhJhAkfxVnOg2hG+w2d/7d7vRVSC1vo5ip4erUaA/PkWusZvPIpxnRWoXaxJsFmVx0gJgjpJkYDyjaXUlp+jmaoseeZ4EPQUWqHLKJ59PRG0mg8j2xAjYH9nQaN14qMRmTGPxY8gfv/CUFcatA+8VJU9KEsJkDAwLVvglydNTLGrxpAJU78a2eaht0foV43XUIZGe3DKiJPgE+UOKGCJw==", + "type": "RsaSignature2017" + }, + "to": [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "type": "Create" +} diff --git a/test/fixtures/modules/runtime_module.ex b/test/fixtures/modules/runtime_module.ex index f11032b57..e348c499e 100644 --- a/test/fixtures/modules/runtime_module.ex +++ b/test/fixtures/modules/runtime_module.ex @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule RuntimeModule do +defmodule Fixtures.Modules.RuntimeModule do @moduledoc """ This is a dummy module to test custom runtime modules. """ diff --git a/test/instance_static/emoji/blobs.gg/blank.png b/test/instance_static/emoji/blobs.gg/blank.png Binary files differnew file mode 100644 index 000000000..8f50fa023 --- /dev/null +++ b/test/instance_static/emoji/blobs.gg/blank.png diff --git a/test/instance_static/emoji/blobs.gg/pack.json b/test/instance_static/emoji/blobs.gg/pack.json new file mode 100644 index 000000000..481891b08 --- /dev/null +++ b/test/instance_static/emoji/blobs.gg/pack.json @@ -0,0 +1,11 @@ +{ + "files": { + "blank": "blank.png" + }, + "pack": { + "description": "Test description", + "homepage": "https://pleroma.social", + "license": "Test license", + "share-files": true + } +}
\ No newline at end of file diff --git a/test/tasks/pleroma_test.exs b/test/mix/pleroma_test.exs index c3e47b285..c3e47b285 100644 --- a/test/tasks/pleroma_test.exs +++ b/test/mix/pleroma_test.exs diff --git a/test/tasks/app_test.exs b/test/mix/tasks/pleroma/app_test.exs index 71a84ac8e..71a84ac8e 100644 --- a/test/tasks/app_test.exs +++ b/test/mix/tasks/pleroma/app_test.exs diff --git a/test/tasks/config_test.exs b/test/mix/tasks/pleroma/config_test.exs index f36648829..f36648829 100644 --- a/test/tasks/config_test.exs +++ b/test/mix/tasks/pleroma/config_test.exs diff --git a/test/tasks/count_statuses_test.exs b/test/mix/tasks/pleroma/count_statuses_test.exs index c5cd16960..c5cd16960 100644 --- a/test/tasks/count_statuses_test.exs +++ b/test/mix/tasks/pleroma/count_statuses_test.exs diff --git a/test/tasks/database_test.exs b/test/mix/tasks/pleroma/database_test.exs index 292a5ef5f..292a5ef5f 100644 --- a/test/tasks/database_test.exs +++ b/test/mix/tasks/pleroma/database_test.exs diff --git a/test/tasks/digest_test.exs b/test/mix/tasks/pleroma/digest_test.exs index 0b444c86d..69dccb745 100644 --- a/test/tasks/digest_test.exs +++ b/test/mix/tasks/pleroma/digest_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Mix.Tasks.Pleroma.DigestTest do use Pleroma.DataCase diff --git a/test/tasks/ecto/migrate_test.exs b/test/mix/tasks/pleroma/ecto/migrate_test.exs index 43df176a1..43df176a1 100644 --- a/test/tasks/ecto/migrate_test.exs +++ b/test/mix/tasks/pleroma/ecto/migrate_test.exs diff --git a/test/tasks/ecto/rollback_test.exs b/test/mix/tasks/pleroma/ecto/rollback_test.exs index 0236e35d5..0236e35d5 100644 --- a/test/tasks/ecto/rollback_test.exs +++ b/test/mix/tasks/pleroma/ecto/rollback_test.exs diff --git a/test/tasks/ecto/ecto_test.exs b/test/mix/tasks/pleroma/ecto_test.exs index 3a028df83..3a028df83 100644 --- a/test/tasks/ecto/ecto_test.exs +++ b/test/mix/tasks/pleroma/ecto_test.exs diff --git a/test/tasks/email_test.exs b/test/mix/tasks/pleroma/email_test.exs index 5393e3573..9523aefd8 100644 --- a/test/tasks/email_test.exs +++ b/test/mix/tasks/pleroma/email_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Mix.Tasks.Pleroma.EmailTest do use Pleroma.DataCase diff --git a/test/tasks/emoji_test.exs b/test/mix/tasks/pleroma/emoji_test.exs index 499f098c2..0fb8603ac 100644 --- a/test/tasks/emoji_test.exs +++ b/test/mix/tasks/pleroma/emoji_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Mix.Tasks.Pleroma.EmojiTest do use ExUnit.Case, async: true diff --git a/test/tasks/frontend_test.exs b/test/mix/tasks/pleroma/frontend_test.exs index 022ae51be..6f9ec14cd 100644 --- a/test/tasks/frontend_test.exs +++ b/test/mix/tasks/pleroma/frontend_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.FrontendTest do +defmodule Mix.Tasks.Pleroma.FrontendTest do use Pleroma.DataCase alias Mix.Tasks.Pleroma.Frontend diff --git a/test/tasks/instance_test.exs b/test/mix/tasks/pleroma/instance_test.exs index 3b4c041d9..fe69a2def 100644 --- a/test/tasks/instance_test.exs +++ b/test/mix/tasks/pleroma/instance_test.exs @@ -2,9 +2,11 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.InstanceTest do +defmodule Mix.Tasks.Pleroma.InstanceTest do use ExUnit.Case + @release_env_file "./test/pleroma.test.env" + setup do File.mkdir_p!(tmp_path()) @@ -16,6 +18,8 @@ defmodule Pleroma.InstanceTest do File.rm_rf(Path.join(static_dir, "robots.txt")) end + if File.exists?(@release_env_file), do: File.rm_rf(@release_env_file) + Pleroma.Config.put([:instance, :static_dir], static_dir) end) @@ -63,7 +67,15 @@ defmodule Pleroma.InstanceTest do "--uploads-dir", "test/uploads", "--static-dir", - "./test/../test/instance/static/" + "./test/../test/instance/static/", + "--strip-uploads", + "y", + "--dedupe-uploads", + "n", + "--anonymize-uploads", + "n", + "--release-env-file", + @release_env_file ]) end @@ -82,8 +94,12 @@ defmodule Pleroma.InstanceTest do assert generated_config =~ "password: \"dbpass\"" assert generated_config =~ "configurable_from_database: true" assert generated_config =~ "http: [ip: {127, 0, 0, 1}, port: 4000]" + assert generated_config =~ "filters: [Pleroma.Upload.Filter.ExifTool]" assert File.read!(tmp_path() <> "setup.psql") == generated_setup_psql() assert File.exists?(Path.expand("./test/instance/static/robots.txt")) + assert File.exists?(@release_env_file) + + assert File.read!(@release_env_file) =~ ~r/^RELEASE_COOKIE=.*/ end defp generated_setup_psql do diff --git a/test/tasks/refresh_counter_cache_test.exs b/test/mix/tasks/pleroma/refresh_counter_cache_test.exs index 6a1a9ac17..6a1a9ac17 100644 --- a/test/tasks/refresh_counter_cache_test.exs +++ b/test/mix/tasks/pleroma/refresh_counter_cache_test.exs diff --git a/test/tasks/relay_test.exs b/test/mix/tasks/pleroma/relay_test.exs index e5225b64c..cf48e7dda 100644 --- a/test/tasks/relay_test.exs +++ b/test/mix/tasks/pleroma/relay_test.exs @@ -81,6 +81,80 @@ defmodule Mix.Tasks.Pleroma.RelayTest do assert undo_activity.data["object"]["id"] == cancelled_activity.data["id"] refute "#{target_instance}/followers" in User.following(local_user) end + + test "unfollow when relay is dead" do + user = insert(:user) + target_instance = user.ap_id + + Mix.Tasks.Pleroma.Relay.run(["follow", target_instance]) + + %User{ap_id: follower_id} = local_user = Relay.get_actor() + target_user = User.get_cached_by_ap_id(target_instance) + follow_activity = Utils.fetch_latest_follow(local_user, target_user) + User.follow(local_user, target_user) + + assert "#{target_instance}/followers" in User.following(local_user) + + Tesla.Mock.mock(fn %{method: :get, url: ^target_instance} -> + %Tesla.Env{status: 404} + end) + + Pleroma.Repo.delete(user) + Cachex.clear(:user_cache) + + Mix.Tasks.Pleroma.Relay.run(["unfollow", target_instance]) + + cancelled_activity = Activity.get_by_ap_id(follow_activity.data["id"]) + assert cancelled_activity.data["state"] == "accept" + + assert [] == + ActivityPub.fetch_activities( + [], + %{ + type: "Undo", + actor_id: follower_id, + skip_preload: true, + invisible_actors: true + } + ) + end + + test "force unfollow when relay is dead" do + user = insert(:user) + target_instance = user.ap_id + + Mix.Tasks.Pleroma.Relay.run(["follow", target_instance]) + + %User{ap_id: follower_id} = local_user = Relay.get_actor() + target_user = User.get_cached_by_ap_id(target_instance) + follow_activity = Utils.fetch_latest_follow(local_user, target_user) + User.follow(local_user, target_user) + + assert "#{target_instance}/followers" in User.following(local_user) + + Tesla.Mock.mock(fn %{method: :get, url: ^target_instance} -> + %Tesla.Env{status: 404} + end) + + Pleroma.Repo.delete(user) + Cachex.clear(:user_cache) + + Mix.Tasks.Pleroma.Relay.run(["unfollow", target_instance, "--force"]) + + cancelled_activity = Activity.get_by_ap_id(follow_activity.data["id"]) + assert cancelled_activity.data["state"] == "cancelled" + + [undo_activity] = + ActivityPub.fetch_activities( + [], + %{type: "Undo", actor_id: follower_id, skip_preload: true, invisible_actors: true} + ) + + assert undo_activity.data["type"] == "Undo" + assert undo_activity.data["actor"] == local_user.ap_id + assert undo_activity.data["object"]["id"] == cancelled_activity.data["id"] + refute "#{target_instance}/followers" in User.following(local_user) + end end describe "mix pleroma.relay list" do diff --git a/test/mix/tasks/pleroma/release_env_test.exs b/test/mix/tasks/pleroma/release_env_test.exs new file mode 100644 index 000000000..519f1eba9 --- /dev/null +++ b/test/mix/tasks/pleroma/release_env_test.exs @@ -0,0 +1,30 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Mix.Tasks.Pleroma.ReleaseEnvTest do + use ExUnit.Case + import ExUnit.CaptureIO, only: [capture_io: 1] + + @path "config/pleroma.test.env" + + def do_clean do + if File.exists?(@path) do + File.rm_rf(@path) + end + end + + setup do + do_clean() + on_exit(fn -> do_clean() end) + :ok + end + + test "generate pleroma.env" do + assert capture_io(fn -> + Mix.Tasks.Pleroma.ReleaseEnv.run(["gen", "--path", @path, "--force"]) + end) =~ "The file generated" + + assert File.read!(@path) =~ "RELEASE_COOKIE=" + end +end diff --git a/test/tasks/robots_txt_test.exs b/test/mix/tasks/pleroma/robots_txt_test.exs index 7040a0e4e..7040a0e4e 100644 --- a/test/tasks/robots_txt_test.exs +++ b/test/mix/tasks/pleroma/robots_txt_test.exs diff --git a/test/tasks/uploads_test.exs b/test/mix/tasks/pleroma/uploads_test.exs index d69e149a8..d69e149a8 100644 --- a/test/tasks/uploads_test.exs +++ b/test/mix/tasks/pleroma/uploads_test.exs diff --git a/test/tasks/user_test.exs b/test/mix/tasks/pleroma/user_test.exs index b8c423c48..ce819f815 100644 --- a/test/tasks/user_test.exs +++ b/test/mix/tasks/pleroma/user_test.exs @@ -248,14 +248,19 @@ defmodule Mix.Tasks.Pleroma.UserTest do user = User.get_cached_by_nickname(user.nickname) assert user.is_moderator - assert user.locked + assert user.is_locked assert user.is_admin refute user.confirmation_pending end test "All statuses unset" do user = - insert(:user, locked: true, is_moderator: true, is_admin: true, confirmation_pending: true) + insert(:user, + is_locked: true, + is_moderator: true, + is_admin: true, + confirmation_pending: true + ) Mix.Tasks.Pleroma.User.run([ "set", @@ -280,7 +285,7 @@ defmodule Mix.Tasks.Pleroma.UserTest do user = User.get_cached_by_nickname(user.nickname) refute user.is_moderator - refute user.locked + refute user.is_locked refute user.is_admin assert user.confirmation_pending end diff --git a/test/activity/ir/topics_test.exs b/test/pleroma/activity/ir/topics_test.exs index 14a6e6b71..4ddcea1ec 100644 --- a/test/activity/ir/topics_test.exs +++ b/test/pleroma/activity/ir/topics_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Activity.Ir.TopicsTest do use Pleroma.DataCase diff --git a/test/activity_test.exs b/test/pleroma/activity_test.exs index ee6a99cc3..ee6a99cc3 100644 --- a/test/activity_test.exs +++ b/test/pleroma/activity_test.exs diff --git a/test/application_requirements_test.exs b/test/pleroma/application_requirements_test.exs index 21d24ddd0..c505ae229 100644 --- a/test/application_requirements_test.exs +++ b/test/pleroma/application_requirements_test.exs @@ -4,9 +4,12 @@ defmodule Pleroma.ApplicationRequirementsTest do use Pleroma.DataCase + import ExUnit.CaptureLog import Mock + alias Pleroma.ApplicationRequirements + alias Pleroma.Config alias Pleroma.Repo describe "check_welcome_message_config!/1" do @@ -70,42 +73,42 @@ defmodule Pleroma.ApplicationRequirementsTest do setup do: clear_config([:database, :rum_enabled]) test "raises if rum is enabled and detects unapplied rum migrations" do - Pleroma.Config.put([:database, :rum_enabled], true) + Config.put([:database, :rum_enabled], true) with_mocks([{Repo, [:passthrough], [exists?: fn _, _ -> false end]}]) do - assert_raise Pleroma.ApplicationRequirements.VerifyError, + assert_raise ApplicationRequirements.VerifyError, "Unapplied RUM Migrations detected", fn -> - capture_log(&Pleroma.ApplicationRequirements.verify!/0) + capture_log(&ApplicationRequirements.verify!/0) end end end test "raises if rum is disabled and detects rum migrations" do - Pleroma.Config.put([:database, :rum_enabled], false) + Config.put([:database, :rum_enabled], false) with_mocks([{Repo, [:passthrough], [exists?: fn _, _ -> true end]}]) do - assert_raise Pleroma.ApplicationRequirements.VerifyError, + assert_raise ApplicationRequirements.VerifyError, "RUM Migrations detected", fn -> - capture_log(&Pleroma.ApplicationRequirements.verify!/0) + capture_log(&ApplicationRequirements.verify!/0) end end end test "doesn't do anything if rum enabled and applied migrations" do - Pleroma.Config.put([:database, :rum_enabled], true) + Config.put([:database, :rum_enabled], true) with_mocks([{Repo, [:passthrough], [exists?: fn _, _ -> true end]}]) do - assert Pleroma.ApplicationRequirements.verify!() == :ok + assert ApplicationRequirements.verify!() == :ok end end test "doesn't do anything if rum disabled" do - Pleroma.Config.put([:database, :rum_enabled], false) + Config.put([:database, :rum_enabled], false) with_mocks([{Repo, [:passthrough], [exists?: fn _, _ -> false end]}]) do - assert Pleroma.ApplicationRequirements.verify!() == :ok + assert ApplicationRequirements.verify!() == :ok end end end @@ -130,17 +133,17 @@ defmodule Pleroma.ApplicationRequirementsTest do setup do: clear_config([:i_am_aware_this_may_cause_data_loss, :disable_migration_check]) test "raises if it detects unapplied migrations" do - assert_raise Pleroma.ApplicationRequirements.VerifyError, + assert_raise ApplicationRequirements.VerifyError, "Unapplied Migrations detected", fn -> - capture_log(&Pleroma.ApplicationRequirements.verify!/0) + capture_log(&ApplicationRequirements.verify!/0) end end test "doesn't do anything if disabled" do - Pleroma.Config.put([:i_am_aware_this_may_cause_data_loss, :disable_migration_check], true) + Config.put([:i_am_aware_this_may_cause_data_loss, :disable_migration_check], true) - assert :ok == Pleroma.ApplicationRequirements.verify!() + assert :ok == ApplicationRequirements.verify!() end end end diff --git a/test/bbs/handler_test.exs b/test/pleroma/bbs/handler_test.exs index eb716486e..eb716486e 100644 --- a/test/bbs/handler_test.exs +++ b/test/pleroma/bbs/handler_test.exs diff --git a/test/bookmark_test.exs b/test/pleroma/bookmark_test.exs index 2726fe7cd..2726fe7cd 100644 --- a/test/bookmark_test.exs +++ b/test/pleroma/bookmark_test.exs diff --git a/test/captcha_test.exs b/test/pleroma/captcha_test.exs index 1b9f4a12f..1b9f4a12f 100644 --- a/test/captcha_test.exs +++ b/test/pleroma/captcha_test.exs diff --git a/test/chat/message_reference_test.exs b/test/pleroma/chat/message_reference_test.exs index aaa7c1ad4..aaa7c1ad4 100644 --- a/test/chat/message_reference_test.exs +++ b/test/pleroma/chat/message_reference_test.exs diff --git a/test/chat_test.exs b/test/pleroma/chat_test.exs index 9e8a9ebf0..9e8a9ebf0 100644 --- a/test/chat_test.exs +++ b/test/pleroma/chat_test.exs diff --git a/test/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs index f81a7b580..0cfed4555 100644 --- a/test/config/deprecation_warnings_test.exs +++ b/test/pleroma/config/deprecation_warnings_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Config.DeprecationWarningsTest do use ExUnit.Case use Pleroma.Tests.Helpers @@ -83,7 +87,7 @@ defmodule Pleroma.Config.DeprecationWarningsTest do end test "check_activity_expiration_config/0" do - clear_config([Pleroma.ActivityExpiration, :enabled], true) + clear_config(Pleroma.ActivityExpiration, enabled: true) assert capture_log(fn -> DeprecationWarnings.check_activity_expiration_config() diff --git a/test/config/holder_test.exs b/test/pleroma/config/holder_test.exs index abcaa27dd..abcaa27dd 100644 --- a/test/config/holder_test.exs +++ b/test/pleroma/config/holder_test.exs diff --git a/test/config/loader_test.exs b/test/pleroma/config/loader_test.exs index 607572f4e..607572f4e 100644 --- a/test/config/loader_test.exs +++ b/test/pleroma/config/loader_test.exs diff --git a/test/config/transfer_task_test.exs b/test/pleroma/config/transfer_task_test.exs index f53829e09..f53829e09 100644 --- a/test/config/transfer_task_test.exs +++ b/test/pleroma/config/transfer_task_test.exs diff --git a/test/config/config_db_test.exs b/test/pleroma/config_db_test.exs index 3895e2cda..3895e2cda 100644 --- a/test/config/config_db_test.exs +++ b/test/pleroma/config_db_test.exs diff --git a/test/config_test.exs b/test/pleroma/config_test.exs index 1556e4237..1556e4237 100644 --- a/test/config_test.exs +++ b/test/pleroma/config_test.exs diff --git a/test/conversation/participation_test.exs b/test/pleroma/conversation/participation_test.exs index 59a1b6492..59a1b6492 100644 --- a/test/conversation/participation_test.exs +++ b/test/pleroma/conversation/participation_test.exs diff --git a/test/conversation_test.exs b/test/pleroma/conversation_test.exs index 359aa6840..359aa6840 100644 --- a/test/conversation_test.exs +++ b/test/pleroma/conversation_test.exs diff --git a/test/docs/generator_test.exs b/test/pleroma/docs/generator_test.exs index b32918a69..43877244d 100644 --- a/test/docs/generator_test.exs +++ b/test/pleroma/docs/generator_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Docs.GeneratorTest do use ExUnit.Case, async: true alias Pleroma.Docs.Generator diff --git a/test/earmark_renderer_test.exs b/test/pleroma/earmark_renderer_test.exs index 220d97d16..220d97d16 100644 --- a/test/earmark_renderer_test.exs +++ b/test/pleroma/earmark_renderer_test.exs diff --git a/test/web/activity_pub/object_validators/types/date_time_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs index 43be8e936..812463454 100644 --- a/test/web/activity_pub/object_validators/types/date_time_test.exs +++ b/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs @@ -1,4 +1,8 @@ -defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.DateTimeTest do +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.DateTimeTest do alias Pleroma.EctoType.ActivityPub.ObjectValidators.DateTime use Pleroma.DataCase diff --git a/test/web/activity_pub/object_validators/types/object_id_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs index e0ab76379..732e2365f 100644 --- a/test/web/activity_pub/object_validators/types/object_id_test.exs +++ b/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.ObjectValidators.Types.ObjectIDTest do +defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.ObjectIDTest do alias Pleroma.EctoType.ActivityPub.ObjectValidators.ObjectID use Pleroma.DataCase diff --git a/test/web/activity_pub/object_validators/types/recipients_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs index 053916bdd..2e6a0c83d 100644 --- a/test/web/activity_pub/object_validators/types/recipients_test.exs +++ b/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs @@ -1,4 +1,8 @@ -defmodule Pleroma.Web.ObjectValidators.Types.RecipientsTest do +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.RecipientsTest do alias Pleroma.EctoType.ActivityPub.ObjectValidators.Recipients use Pleroma.DataCase diff --git a/test/web/activity_pub/object_validators/types/safe_text_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs index 9c08606f6..7eddd2388 100644 --- a/test/web/activity_pub/object_validators/types/safe_text_test.exs +++ b/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.SafeTextTest do +defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.SafeTextTest do use Pleroma.DataCase alias Pleroma.EctoType.ActivityPub.ObjectValidators.SafeText diff --git a/test/emails/admin_email_test.exs b/test/pleroma/emails/admin_email_test.exs index e24231e27..155057f3e 100644 --- a/test/emails/admin_email_test.exs +++ b/test/pleroma/emails/admin_email_test.exs @@ -63,7 +63,7 @@ defmodule Pleroma.Emails.AdminEmailTest do assert res.html_body == """ <p>New account for review: <a href="#{account_url}">@#{account.nickname}</a></p> <blockquote>Plz let me in</blockquote> - <a href="http://localhost:4001/pleroma/admin">Visit AdminFE</a> + <a href="http://localhost:4001/pleroma/admin/#/users/#{account.id}/">Visit AdminFE</a> """ end end diff --git a/test/emails/mailer_test.exs b/test/pleroma/emails/mailer_test.exs index 9e232d2a0..9e232d2a0 100644 --- a/test/emails/mailer_test.exs +++ b/test/pleroma/emails/mailer_test.exs diff --git a/test/emails/user_email_test.exs b/test/pleroma/emails/user_email_test.exs index a75623bb4..a75623bb4 100644 --- a/test/emails/user_email_test.exs +++ b/test/pleroma/emails/user_email_test.exs diff --git a/test/emoji/formatter_test.exs b/test/pleroma/emoji/formatter_test.exs index 12af6cd8b..12af6cd8b 100644 --- a/test/emoji/formatter_test.exs +++ b/test/pleroma/emoji/formatter_test.exs diff --git a/test/emoji/loader_test.exs b/test/pleroma/emoji/loader_test.exs index 804039e7e..804039e7e 100644 --- a/test/emoji/loader_test.exs +++ b/test/pleroma/emoji/loader_test.exs diff --git a/test/emoji/pack_test.exs b/test/pleroma/emoji/pack_test.exs index 70d1eaa1b..70d1eaa1b 100644 --- a/test/emoji/pack_test.exs +++ b/test/pleroma/emoji/pack_test.exs diff --git a/test/emoji_test.exs b/test/pleroma/emoji_test.exs index 1dd3c58c6..1dd3c58c6 100644 --- a/test/emoji_test.exs +++ b/test/pleroma/emoji_test.exs diff --git a/test/filter_test.exs b/test/pleroma/filter_test.exs index 0a5c4426a..0a5c4426a 100644 --- a/test/filter_test.exs +++ b/test/pleroma/filter_test.exs diff --git a/test/following_relationship_test.exs b/test/pleroma/following_relationship_test.exs index 17a468abb..17a468abb 100644 --- a/test/following_relationship_test.exs +++ b/test/pleroma/following_relationship_test.exs diff --git a/test/formatter_test.exs b/test/pleroma/formatter_test.exs index f066bd50a..f066bd50a 100644 --- a/test/formatter_test.exs +++ b/test/pleroma/formatter_test.exs diff --git a/test/gun/conneciton_pool_test.exs b/test/pleroma/gun/connection_pool_test.exs index aea908fac..aea908fac 100644 --- a/test/gun/conneciton_pool_test.exs +++ b/test/pleroma/gun/connection_pool_test.exs diff --git a/test/healthcheck_test.exs b/test/pleroma/healthcheck_test.exs index e341e6983..e341e6983 100644 --- a/test/healthcheck_test.exs +++ b/test/pleroma/healthcheck_test.exs diff --git a/test/html_test.exs b/test/pleroma/html_test.exs index 7d3756884..7d3756884 100644 --- a/test/html_test.exs +++ b/test/pleroma/html_test.exs diff --git a/test/http/adapter_helper/gun_test.exs b/test/pleroma/http/adapter_helper/gun_test.exs index 80589c73d..80589c73d 100644 --- a/test/http/adapter_helper/gun_test.exs +++ b/test/pleroma/http/adapter_helper/gun_test.exs diff --git a/test/http/adapter_helper/hackney_test.exs b/test/pleroma/http/adapter_helper/hackney_test.exs index f2361ff0b..f2361ff0b 100644 --- a/test/http/adapter_helper/hackney_test.exs +++ b/test/pleroma/http/adapter_helper/hackney_test.exs diff --git a/test/http/adapter_helper_test.exs b/test/pleroma/http/adapter_helper_test.exs index 24d501ad5..24d501ad5 100644 --- a/test/http/adapter_helper_test.exs +++ b/test/pleroma/http/adapter_helper_test.exs diff --git a/test/http/ex_aws_test.exs b/test/pleroma/http/ex_aws_test.exs index d0b00ca26..d0b00ca26 100644 --- a/test/http/ex_aws_test.exs +++ b/test/pleroma/http/ex_aws_test.exs diff --git a/test/http/request_builder_test.exs b/test/pleroma/http/request_builder_test.exs index fab909905..fab909905 100644 --- a/test/http/request_builder_test.exs +++ b/test/pleroma/http/request_builder_test.exs diff --git a/test/http/tzdata_test.exs b/test/pleroma/http/tzdata_test.exs index 3e605d33b..3e605d33b 100644 --- a/test/http/tzdata_test.exs +++ b/test/pleroma/http/tzdata_test.exs diff --git a/test/http_test.exs b/test/pleroma/http_test.exs index d394bb942..d394bb942 100644 --- a/test/http_test.exs +++ b/test/pleroma/http_test.exs diff --git a/test/web/instances/instance_test.exs b/test/pleroma/instances/instance_test.exs index 4f0805100..4f0805100 100644 --- a/test/web/instances/instance_test.exs +++ b/test/pleroma/instances/instance_test.exs diff --git a/test/web/instances/instances_test.exs b/test/pleroma/instances_test.exs index d2618025c..d2618025c 100644 --- a/test/web/instances/instances_test.exs +++ b/test/pleroma/instances_test.exs diff --git a/test/federation/federation_test.exs b/test/pleroma/integration/federation_test.exs index 10d71fb88..10d71fb88 100644 --- a/test/federation/federation_test.exs +++ b/test/pleroma/integration/federation_test.exs diff --git a/test/integration/mastodon_websocket_test.exs b/test/pleroma/integration/mastodon_websocket_test.exs index 0f2e6cc2b..0f2e6cc2b 100644 --- a/test/integration/mastodon_websocket_test.exs +++ b/test/pleroma/integration/mastodon_websocket_test.exs diff --git a/test/job_queue_monitor_test.exs b/test/pleroma/job_queue_monitor_test.exs index 65c1e9f29..65c1e9f29 100644 --- a/test/job_queue_monitor_test.exs +++ b/test/pleroma/job_queue_monitor_test.exs diff --git a/test/keys_test.exs b/test/pleroma/keys_test.exs index 9e8528cba..9e8528cba 100644 --- a/test/keys_test.exs +++ b/test/pleroma/keys_test.exs diff --git a/test/list_test.exs b/test/pleroma/list_test.exs index b5572cbae..b5572cbae 100644 --- a/test/list_test.exs +++ b/test/pleroma/list_test.exs diff --git a/test/marker_test.exs b/test/pleroma/marker_test.exs index 7b3943c7b..7b3943c7b 100644 --- a/test/marker_test.exs +++ b/test/pleroma/marker_test.exs diff --git a/test/mfa/backup_codes_test.exs b/test/pleroma/mfa/backup_codes_test.exs index 7bc01b36b..41adb1e96 100644 --- a/test/mfa/backup_codes_test.exs +++ b/test/pleroma/mfa/backup_codes_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.MFA.BackupCodesTest do use Pleroma.DataCase diff --git a/test/mfa/totp_test.exs b/test/pleroma/mfa/totp_test.exs index 50153d208..9edb6fd54 100644 --- a/test/mfa/totp_test.exs +++ b/test/pleroma/mfa/totp_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.MFA.TOTPTest do use Pleroma.DataCase diff --git a/test/mfa_test.exs b/test/pleroma/mfa_test.exs index 8875cefd9..8875cefd9 100644 --- a/test/mfa_test.exs +++ b/test/pleroma/mfa_test.exs diff --git a/test/migration_helper/notification_backfill_test.exs b/test/pleroma/migration_helper/notification_backfill_test.exs index 2a62a2b00..2a62a2b00 100644 --- a/test/migration_helper/notification_backfill_test.exs +++ b/test/pleroma/migration_helper/notification_backfill_test.exs diff --git a/test/moderation_log_test.exs b/test/pleroma/moderation_log_test.exs index 59f4d67f8..59f4d67f8 100644 --- a/test/moderation_log_test.exs +++ b/test/pleroma/moderation_log_test.exs diff --git a/test/notification_test.exs b/test/pleroma/notification_test.exs index f2e0f0b0d..a74fb7bc2 100644 --- a/test/notification_test.exs +++ b/test/pleroma/notification_test.exs @@ -346,7 +346,7 @@ defmodule Pleroma.NotificationTest do describe "follow / follow_request notifications" do test "it creates `follow` notification for approved Follow activity" do user = insert(:user) - followed_user = insert(:user, locked: false) + followed_user = insert(:user, is_locked: false) {:ok, _, _, _activity} = CommonAPI.follow(user, followed_user) assert FollowingRelationship.following?(user, followed_user) @@ -361,7 +361,7 @@ defmodule Pleroma.NotificationTest do test "it creates `follow_request` notification for pending Follow activity" do user = insert(:user) - followed_user = insert(:user, locked: true) + followed_user = insert(:user, is_locked: true) {:ok, _, _, _activity} = CommonAPI.follow(user, followed_user) refute FollowingRelationship.following?(user, followed_user) @@ -383,7 +383,7 @@ defmodule Pleroma.NotificationTest do test "it doesn't create a notification for follow-unfollow-follow chains" do user = insert(:user) - followed_user = insert(:user, locked: false) + followed_user = insert(:user, is_locked: false) {:ok, _, _, _activity} = CommonAPI.follow(user, followed_user) assert FollowingRelationship.following?(user, followed_user) @@ -397,10 +397,10 @@ defmodule Pleroma.NotificationTest do end test "dismisses the notification on follow request rejection" do - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) follower = insert(:user) {:ok, _, _, _follow_activity} = CommonAPI.follow(follower, user) - assert [notification] = Notification.for_user(user) + assert [_notification] = Notification.for_user(user) {:ok, _follower} = CommonAPI.reject_follow_request(follower, user) assert [] = Notification.for_user(user) end diff --git a/test/object/containment_test.exs b/test/pleroma/object/containment_test.exs index 90b6dccf2..90b6dccf2 100644 --- a/test/object/containment_test.exs +++ b/test/pleroma/object/containment_test.exs diff --git a/test/object/fetcher_test.exs b/test/pleroma/object/fetcher_test.exs index 14d2c645f..14d2c645f 100644 --- a/test/object/fetcher_test.exs +++ b/test/pleroma/object/fetcher_test.exs diff --git a/test/object_test.exs b/test/pleroma/object_test.exs index 198d3b1cf..99caba336 100644 --- a/test/object_test.exs +++ b/test/pleroma/object_test.exs @@ -82,7 +82,7 @@ defmodule Pleroma.ObjectTest do Pleroma.Config.put([:instance, :cleanup_attachments], false) file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -116,7 +116,7 @@ defmodule Pleroma.ObjectTest do Pleroma.Config.put([:instance, :cleanup_attachments], true) file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -155,7 +155,7 @@ defmodule Pleroma.ObjectTest do File.mkdir_p!(uploads_dir) file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -188,7 +188,7 @@ defmodule Pleroma.ObjectTest do Pleroma.Config.put([:instance, :cleanup_attachments], true) file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -225,7 +225,7 @@ defmodule Pleroma.ObjectTest do Pleroma.Config.put([:instance, :cleanup_attachments], true) file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } diff --git a/test/otp_version_test.exs b/test/pleroma/otp_version_test.exs index 7d2538ec8..7d2538ec8 100644 --- a/test/otp_version_test.exs +++ b/test/pleroma/otp_version_test.exs diff --git a/test/pagination_test.exs b/test/pleroma/pagination_test.exs index e526f23e8..e526f23e8 100644 --- a/test/pagination_test.exs +++ b/test/pleroma/pagination_test.exs diff --git a/test/registration_test.exs b/test/pleroma/registration_test.exs index 7db8e3664..7db8e3664 100644 --- a/test/registration_test.exs +++ b/test/pleroma/registration_test.exs diff --git a/test/migrations/20200716195806_autolinker_to_linkify_test.exs b/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs index 250d11c61..84f520fe4 100644 --- a/test/migrations/20200716195806_autolinker_to_linkify_test.exs +++ b/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Repo.Migrations.AutolinkerToLinkifyTest do use Pleroma.DataCase import Pleroma.Factory diff --git a/test/migrations/20200802170532_fix_legacy_tags_test.exs b/test/pleroma/repo/migrations/fix_legacy_tags_test.exs index 3b4dee407..432055e45 100644 --- a/test/migrations/20200802170532_fix_legacy_tags_test.exs +++ b/test/pleroma/repo/migrations/fix_legacy_tags_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Repo.Migrations.FixLegacyTagsTest do alias Pleroma.User use Pleroma.DataCase diff --git a/test/migrations/20200722185515_fix_malformed_formatter_config_test.exs b/test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs index d3490478e..61528599a 100644 --- a/test/migrations/20200722185515_fix_malformed_formatter_config_test.exs +++ b/test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Repo.Migrations.FixMalformedFormatterConfigTest do use Pleroma.DataCase import Pleroma.Factory diff --git a/test/migrations/20200724133313_move_welcome_settings_test.exs b/test/pleroma/repo/migrations/move_welcome_settings_test.exs index 739f24547..53d05a55a 100644 --- a/test/migrations/20200724133313_move_welcome_settings_test.exs +++ b/test/pleroma/repo/migrations/move_welcome_settings_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Repo.Migrations.MoveWelcomeSettingsTest do use Pleroma.DataCase import Pleroma.Factory diff --git a/test/repo_test.exs b/test/pleroma/repo_test.exs index 155791be2..155791be2 100644 --- a/test/repo_test.exs +++ b/test/pleroma/repo_test.exs diff --git a/test/report_note_test.exs b/test/pleroma/report_note_test.exs index 25c1d6a61..25c1d6a61 100644 --- a/test/report_note_test.exs +++ b/test/pleroma/report_note_test.exs diff --git a/test/reverse_proxy/reverse_proxy_test.exs b/test/pleroma/reverse_proxy_test.exs index 8df63de65..8df63de65 100644 --- a/test/reverse_proxy/reverse_proxy_test.exs +++ b/test/pleroma/reverse_proxy_test.exs diff --git a/test/runtime_test.exs b/test/pleroma/runtime_test.exs index a1a6c57cd..010594fcd 100644 --- a/test/runtime_test.exs +++ b/test/pleroma/runtime_test.exs @@ -6,6 +6,7 @@ defmodule Pleroma.RuntimeTest do use ExUnit.Case, async: true test "it loads custom runtime modules" do - assert {:module, RuntimeModule} == Code.ensure_compiled(RuntimeModule) + assert {:module, Fixtures.Modules.RuntimeModule} == + Code.ensure_compiled(Fixtures.Modules.RuntimeModule) end end diff --git a/test/safe_jsonb_set_test.exs b/test/pleroma/safe_jsonb_set_test.exs index 748540570..8b1274545 100644 --- a/test/safe_jsonb_set_test.exs +++ b/test/pleroma/safe_jsonb_set_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.SafeJsonbSetTest do use Pleroma.DataCase diff --git a/test/scheduled_activity_test.exs b/test/pleroma/scheduled_activity_test.exs index 7faa5660d..7faa5660d 100644 --- a/test/scheduled_activity_test.exs +++ b/test/pleroma/scheduled_activity_test.exs diff --git a/test/signature_test.exs b/test/pleroma/signature_test.exs index a7a75aa4d..a7a75aa4d 100644 --- a/test/signature_test.exs +++ b/test/pleroma/signature_test.exs diff --git a/test/stats_test.exs b/test/pleroma/stats_test.exs index 74bf785b0..74bf785b0 100644 --- a/test/stats_test.exs +++ b/test/pleroma/stats_test.exs diff --git a/test/upload/filter/anonymize_filename_test.exs b/test/pleroma/upload/filter/anonymize_filename_test.exs index 19b915cc8..7ef01ce91 100644 --- a/test/upload/filter/anonymize_filename_test.exs +++ b/test/pleroma/upload/filter/anonymize_filename_test.exs @@ -13,7 +13,7 @@ defmodule Pleroma.Upload.Filter.AnonymizeFilenameTest do upload_file = %Upload{ name: "an… image.jpg", - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg") } diff --git a/test/upload/filter/dedupe_test.exs b/test/pleroma/upload/filter/dedupe_test.exs index 75c7198e1..92a3d7df3 100644 --- a/test/upload/filter/dedupe_test.exs +++ b/test/pleroma/upload/filter/dedupe_test.exs @@ -18,7 +18,7 @@ defmodule Pleroma.Upload.Filter.DedupeTest do upload = %Upload{ name: "an… image.jpg", - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), tempfile: Path.absname("test/fixtures/image_tmp.jpg") } diff --git a/test/upload/filter/exiftool_test.exs b/test/pleroma/upload/filter/exiftool_test.exs index d4cd4ba11..6b978b64c 100644 --- a/test/upload/filter/exiftool_test.exs +++ b/test/pleroma/upload/filter/exiftool_test.exs @@ -16,7 +16,7 @@ defmodule Pleroma.Upload.Filter.ExiftoolTest do upload = %Pleroma.Upload{ name: "image_with_GPS_data.jpg", - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/DSCN0010.jpg"), tempfile: Path.absname("test/fixtures/DSCN0010_tmp.jpg") } diff --git a/test/upload/filter/mogrifun_test.exs b/test/pleroma/upload/filter/mogrifun_test.exs index dc1e9e78f..fc2f68276 100644 --- a/test/upload/filter/mogrifun_test.exs +++ b/test/pleroma/upload/filter/mogrifun_test.exs @@ -17,7 +17,7 @@ defmodule Pleroma.Upload.Filter.MogrifunTest do upload = %Upload{ name: "an… image.jpg", - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), tempfile: Path.absname("test/fixtures/image_tmp.jpg") } diff --git a/test/upload/filter/mogrify_test.exs b/test/pleroma/upload/filter/mogrify_test.exs index bf64b96b3..6dee02e8b 100644 --- a/test/upload/filter/mogrify_test.exs +++ b/test/pleroma/upload/filter/mogrify_test.exs @@ -18,7 +18,7 @@ defmodule Pleroma.Upload.Filter.MogrifyTest do upload = %Pleroma.Upload{ name: "an… image.jpg", - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), tempfile: Path.absname("test/fixtures/image_tmp.jpg") } diff --git a/test/upload/filter_test.exs b/test/pleroma/upload/filter_test.exs index 352b66402..09394929c 100644 --- a/test/upload/filter_test.exs +++ b/test/pleroma/upload/filter_test.exs @@ -20,7 +20,7 @@ defmodule Pleroma.Upload.FilterTest do upload = %Pleroma.Upload{ name: "an… image.jpg", - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), tempfile: Path.absname("test/fixtures/image_tmp.jpg") } diff --git a/test/upload_test.exs b/test/pleroma/upload_test.exs index b06b54487..f52d4dff6 100644 --- a/test/upload_test.exs +++ b/test/pleroma/upload_test.exs @@ -11,7 +11,7 @@ defmodule Pleroma.UploadTest do alias Pleroma.Uploaders.Uploader @upload_file %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), filename: "image.jpg" } @@ -112,7 +112,7 @@ defmodule Pleroma.UploadTest do File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), filename: "image.jpg" } @@ -124,7 +124,7 @@ defmodule Pleroma.UploadTest do File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), filename: "image.jpg" } @@ -140,7 +140,7 @@ defmodule Pleroma.UploadTest do File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), filename: "an [image.jpg" } @@ -156,7 +156,7 @@ defmodule Pleroma.UploadTest do File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), filename: "an [image.jpg" } @@ -165,63 +165,31 @@ defmodule Pleroma.UploadTest do assert data["name"] == "an [image.jpg" end - test "fixes incorrect content type" do - File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") - - file = %Plug.Upload{ - content_type: "application/octet-stream", - path: Path.absname("test/fixtures/image_tmp.jpg"), - filename: "an [image.jpg" + test "fixes incorrect content type when base64 is given" do + params = %{ + img: "data:image/png;base64,#{Base.encode64(File.read!("test/fixtures/image.jpg"))}" } - {:ok, data} = Upload.store(file, filters: [Pleroma.Upload.Filter.Dedupe]) + {:ok, data} = Upload.store(params) assert hd(data["url"])["mediaType"] == "image/jpeg" end - test "adds missing extension" do + test "adds extension when base64 is given" do File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") - file = %Plug.Upload{ - content_type: "image/jpg", - path: Path.absname("test/fixtures/image_tmp.jpg"), - filename: "an [image" + params = %{ + img: "data:image/png;base64,#{Base.encode64(File.read!("test/fixtures/image.jpg"))}" } - {:ok, data} = Upload.store(file) - assert data["name"] == "an [image.jpg" - end - - test "fixes incorrect file extension" do - File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") - - file = %Plug.Upload{ - content_type: "image/jpg", - path: Path.absname("test/fixtures/image_tmp.jpg"), - filename: "an [image.blah" - } - - {:ok, data} = Upload.store(file) - assert data["name"] == "an [image.jpg" - end - - test "don't modify filename of an unknown type" do - File.cp("test/fixtures/test.txt", "test/fixtures/test_tmp.txt") - - file = %Plug.Upload{ - content_type: "text/plain", - path: Path.absname("test/fixtures/test_tmp.txt"), - filename: "test.txt" - } - - {:ok, data} = Upload.store(file) - assert data["name"] == "test.txt" + {:ok, data} = Upload.store(params) + assert String.ends_with?(data["name"], ".jpg") end test "copies the file to the configured folder with anonymizing filename" do File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), filename: "an [image.jpg" } @@ -235,7 +203,7 @@ defmodule Pleroma.UploadTest do File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), filename: "an… image.jpg" } @@ -250,7 +218,7 @@ defmodule Pleroma.UploadTest do File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), filename: ":?#[]@!$&\\'()*+,;=.jpg" } @@ -272,7 +240,7 @@ defmodule Pleroma.UploadTest do File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), filename: "image.jpg" } diff --git a/test/uploaders/local_test.exs b/test/pleroma/uploaders/local_test.exs index 18122ff6c..1ce7be485 100644 --- a/test/uploaders/local_test.exs +++ b/test/pleroma/uploaders/local_test.exs @@ -19,7 +19,7 @@ defmodule Pleroma.Uploaders.LocalTest do file = %Pleroma.Upload{ name: "image.jpg", - content_type: "image/jpg", + content_type: "image/jpeg", path: file_path, tempfile: Path.absname("test/fixtures/image_tmp.jpg") } @@ -38,7 +38,7 @@ defmodule Pleroma.Uploaders.LocalTest do file = %Pleroma.Upload{ name: "image.jpg", - content_type: "image/jpg", + content_type: "image/jpeg", path: file_path, tempfile: Path.absname("test/fixtures/image_tmp.jpg") } diff --git a/test/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs index d949c90a5..e7a013dd8 100644 --- a/test/uploaders/s3_test.exs +++ b/test/pleroma/uploaders/s3_test.exs @@ -56,7 +56,7 @@ defmodule Pleroma.Uploaders.S3Test do setup do file_upload = %Pleroma.Upload{ name: "image-tet.jpg", - content_type: "image/jpg", + content_type: "image/jpeg", path: "test_folder/image-tet.jpg", tempfile: Path.absname("test/instance_static/add/shortcode.png") } diff --git a/test/user/import_test.exs b/test/pleroma/user/import_test.exs index e404deeb5..e404deeb5 100644 --- a/test/user/import_test.exs +++ b/test/pleroma/user/import_test.exs diff --git a/test/user/notification_setting_test.exs b/test/pleroma/user/notification_setting_test.exs index 308da216a..308da216a 100644 --- a/test/user/notification_setting_test.exs +++ b/test/pleroma/user/notification_setting_test.exs diff --git a/test/user/query_test.exs b/test/pleroma/user/query_test.exs index e2f5c7d81..e2f5c7d81 100644 --- a/test/user/query_test.exs +++ b/test/pleroma/user/query_test.exs diff --git a/test/user/welcome_chat_massage_test.exs b/test/pleroma/user/welcome_chat_message_test.exs index fe26d6e4d..fe26d6e4d 100644 --- a/test/user/welcome_chat_massage_test.exs +++ b/test/pleroma/user/welcome_chat_message_test.exs diff --git a/test/user/welcome_email_test.exs b/test/pleroma/user/welcome_email_test.exs index d005d11b2..d005d11b2 100644 --- a/test/user/welcome_email_test.exs +++ b/test/pleroma/user/welcome_email_test.exs diff --git a/test/user/welcome_message_test.exs b/test/pleroma/user/welcome_message_test.exs index 3cd6f5cb7..3cd6f5cb7 100644 --- a/test/user/welcome_message_test.exs +++ b/test/pleroma/user/welcome_message_test.exs diff --git a/test/user_invite_token_test.exs b/test/pleroma/user_invite_token_test.exs index 63f18f13c..63f18f13c 100644 --- a/test/user_invite_token_test.exs +++ b/test/pleroma/user_invite_token_test.exs diff --git a/test/user_relationship_test.exs b/test/pleroma/user_relationship_test.exs index f12406097..f12406097 100644 --- a/test/user_relationship_test.exs +++ b/test/pleroma/user_relationship_test.exs diff --git a/test/user_search_test.exs b/test/pleroma/user_search_test.exs index cc14e9741..31d787ffa 100644 --- a/test/user_search_test.exs +++ b/test/pleroma/user_search_test.exs @@ -36,6 +36,12 @@ defmodule Pleroma.UserSearchTest do assert first_user.id == user.id end + test "doesn't die if two users have the same uri" do + insert(:user, %{uri: "https://gensokyo.2hu/@raymoo"}) + insert(:user, %{uri: "https://gensokyo.2hu/@raymoo"}) + assert [_first_user, _second_user] = User.search("https://gensokyo.2hu/@raymoo") + end + test "returns a user with matching uri as the first result" do user = insert(:user, %{ @@ -60,7 +66,7 @@ defmodule Pleroma.UserSearchTest do end test "excludes users when discoverable is false" do - insert(:user, %{nickname: "john 3000", discoverable: false}) + insert(:user, %{nickname: "john 3000", is_discoverable: false}) insert(:user, %{nickname: "john 3001"}) users = User.search("john") diff --git a/test/user_test.exs b/test/pleroma/user_test.exs index d506f7047..7220ce846 100644 --- a/test/user_test.exs +++ b/test/pleroma/user_test.exs @@ -174,7 +174,7 @@ defmodule Pleroma.UserTest do test "returns all pending follow requests" do unlocked = insert(:user) - locked = insert(:user, locked: true) + locked = insert(:user, is_locked: true) follower = insert(:user) CommonAPI.follow(follower, unlocked) @@ -187,7 +187,7 @@ defmodule Pleroma.UserTest do end test "doesn't return already accepted or duplicate follow requests" do - locked = insert(:user, locked: true) + locked = insert(:user, is_locked: true) pending_follower = insert(:user) accepted_follower = insert(:user) @@ -201,7 +201,7 @@ defmodule Pleroma.UserTest do end test "doesn't return follow requests for deactivated accounts" do - locked = insert(:user, locked: true) + locked = insert(:user, is_locked: true) pending_follower = insert(:user, %{deactivated: true}) CommonAPI.follow(pending_follower, locked) @@ -211,7 +211,7 @@ defmodule Pleroma.UserTest do end test "clears follow requests when requester is blocked" do - followed = insert(:user, locked: true) + followed = insert(:user, is_locked: true) follower = insert(:user) CommonAPI.follow(follower, followed) @@ -299,8 +299,8 @@ defmodule Pleroma.UserTest do end test "local users do not automatically follow local locked accounts" do - follower = insert(:user, locked: true) - followed = insert(:user, locked: true) + follower = insert(:user, is_locked: true) + followed = insert(:user, is_locked: true) {:ok, follower} = User.maybe_direct_follow(follower, followed) @@ -1360,7 +1360,7 @@ defmodule Pleroma.UserTest do follower = insert(:user) {:ok, follower} = User.follow(follower, user) - locked_user = insert(:user, name: "locked", locked: true) + locked_user = insert(:user, name: "locked", is_locked: true) {:ok, _} = User.follow(user, locked_user, :follow_pending) object = insert(:note, user: user) @@ -1450,7 +1450,7 @@ defmodule Pleroma.UserTest do note_count: 9, follower_count: 9, following_count: 9001, - locked: true, + is_locked: true, confirmation_pending: true, password_reset_pending: true, approval_pending: true, @@ -1467,7 +1467,7 @@ defmodule Pleroma.UserTest do pleroma_settings_store: %{"q" => "x"}, fields: [%{"gg" => "qq"}], raw_fields: [%{"gg" => "qq"}], - discoverable: true, + is_discoverable: true, also_known_as: ["https://lol.olo/users/loll"] }) @@ -1492,7 +1492,7 @@ defmodule Pleroma.UserTest do note_count: 0, follower_count: 0, following_count: 0, - locked: false, + is_locked: false, confirmation_pending: false, password_reset_pending: false, approval_pending: false, @@ -1509,7 +1509,7 @@ defmodule Pleroma.UserTest do pleroma_settings_store: %{}, fields: [], raw_fields: [], - discoverable: false, + is_discoverable: false, also_known_as: [] } = user end diff --git a/test/utils_test.exs b/test/pleroma/utils_test.exs index 460f7e0b5..460f7e0b5 100644 --- a/test/utils_test.exs +++ b/test/pleroma/utils_test.exs diff --git a/test/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index 0517571f2..b11e2f961 100644 --- a/test/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -1487,9 +1487,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do desc = "Description of the image" image = %Plug.Upload{ - content_type: "image/jpg", + content_type: "bad/content-type", path: Path.absname("test/fixtures/image.jpg"), - filename: "an_image.jpg" + filename: "an_image.png" } object = @@ -1504,6 +1504,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do assert [%{"href" => object_href, "mediaType" => object_mediatype}] = object["url"] assert is_binary(object_href) assert object_mediatype == "image/jpeg" + assert String.ends_with?(object_href, ".jpg") activity_request = %{ "@context" => "https://www.w3.org/ns/activitystreams", diff --git a/test/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 7bdad3810..6ac883b23 100644 --- a/test/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -505,22 +505,22 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do # public {:ok, _} = CommonAPI.post(user2, Map.put(reply_data, :visibility, "public")) - assert %{data: data, object: object} = Activity.get_by_ap_id_with_object(ap_id) + assert %{data: _data, object: object} = Activity.get_by_ap_id_with_object(ap_id) assert object.data["repliesCount"] == 1 # unlisted {:ok, _} = CommonAPI.post(user2, Map.put(reply_data, :visibility, "unlisted")) - assert %{data: data, object: object} = Activity.get_by_ap_id_with_object(ap_id) + assert %{data: _data, object: object} = Activity.get_by_ap_id_with_object(ap_id) assert object.data["repliesCount"] == 2 # private {:ok, _} = CommonAPI.post(user2, Map.put(reply_data, :visibility, "private")) - assert %{data: data, object: object} = Activity.get_by_ap_id_with_object(ap_id) + assert %{data: _data, object: object} = Activity.get_by_ap_id_with_object(ap_id) assert object.data["repliesCount"] == 2 # direct {:ok, _} = CommonAPI.post(user2, Map.put(reply_data, :visibility, "direct")) - assert %{data: data, object: object} = Activity.get_by_ap_id_with_object(ap_id) + assert %{data: _data, object: object} = Activity.get_by_ap_id_with_object(ap_id) assert object.data["repliesCount"] == 2 end end @@ -752,6 +752,22 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do refute repeat_activity in activities end + test "returns your own posts regardless of mute" do + user = insert(:user) + muted = insert(:user) + + {:ok, muted_post} = CommonAPI.post(muted, %{status: "Im stupid"}) + + {:ok, reply} = + CommonAPI.post(user, %{status: "I'm muting you", in_reply_to_status_id: muted_post.id}) + + {:ok, _} = User.mute(user, muted) + + [activity] = ActivityPub.fetch_activities([], %{muting_user: user, skip_preload: true}) + + assert activity.id == reply.id + end + test "doesn't return muted activities" do activity_one = insert(:note_activity) activity_two = insert(:note_activity) @@ -1029,7 +1045,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do describe "uploading files" do setup do test_file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -1120,7 +1136,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do test "creates an undo activity for a pending follow request" do follower = insert(:user) - followed = insert(:user, %{locked: true}) + followed = insert(:user, %{is_locked: true}) {:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed) {:ok, activity} = ActivityPub.unfollow(follower, followed) @@ -2177,4 +2193,84 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do assert user.nickname == orig_user.nickname end end + + describe "reply filtering" do + test "`following` still contains announcements by friends" do + user = insert(:user) + followed = insert(:user) + not_followed = insert(:user) + + User.follow(user, followed) + + {:ok, followed_post} = CommonAPI.post(followed, %{status: "Hello"}) + + {:ok, not_followed_to_followed} = + CommonAPI.post(not_followed, %{ + status: "Also hello", + in_reply_to_status_id: followed_post.id + }) + + {:ok, retoot} = CommonAPI.repeat(not_followed_to_followed.id, followed) + + params = + %{} + |> Map.put(:type, ["Create", "Announce"]) + |> Map.put(:blocking_user, user) + |> Map.put(:muting_user, user) + |> Map.put(:reply_filtering_user, user) + |> Map.put(:reply_visibility, "following") + |> Map.put(:announce_filtering_user, user) + |> Map.put(:user, user) + + activities = + [user.ap_id | User.following(user)] + |> ActivityPub.fetch_activities(params) + + followed_post_id = followed_post.id + retoot_id = retoot.id + + assert [%{id: ^followed_post_id}, %{id: ^retoot_id}] = activities + + assert length(activities) == 2 + end + + # This test is skipped because, while this is the desired behavior, + # there seems to be no good way to achieve it with the method that + # we currently use for detecting to who a reply is directed. + # This is a TODO and should be fixed by a later rewrite of the code + # in question. + @tag skip: true + test "`following` still contains self-replies by friends" do + user = insert(:user) + followed = insert(:user) + not_followed = insert(:user) + + User.follow(user, followed) + + {:ok, followed_post} = CommonAPI.post(followed, %{status: "Hello"}) + {:ok, not_followed_post} = CommonAPI.post(not_followed, %{status: "Also hello"}) + + {:ok, _followed_to_not_followed} = + CommonAPI.post(followed, %{status: "sup", in_reply_to_status_id: not_followed_post.id}) + + {:ok, _followed_self_reply} = + CommonAPI.post(followed, %{status: "Also cofe", in_reply_to_status_id: followed_post.id}) + + params = + %{} + |> Map.put(:type, ["Create", "Announce"]) + |> Map.put(:blocking_user, user) + |> Map.put(:muting_user, user) + |> Map.put(:reply_filtering_user, user) + |> Map.put(:reply_visibility, "following") + |> Map.put(:announce_filtering_user, user) + |> Map.put(:user, user) + + activities = + [user.ap_id | User.following(user)] + |> ActivityPub.fetch_activities(params) + + assert length(activities) == 2 + end + end end diff --git a/test/web/activity_pub/mrf/activity_expiration_policy_test.exs b/test/pleroma/web/activity_pub/mrf/activity_expiration_policy_test.exs index e7370d4ef..e7370d4ef 100644 --- a/test/web/activity_pub/mrf/activity_expiration_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/activity_expiration_policy_test.exs diff --git a/test/web/activity_pub/mrf/anti_followbot_policy_test.exs b/test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs index 3c795f5ac..3c795f5ac 100644 --- a/test/web/activity_pub/mrf/anti_followbot_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs diff --git a/test/web/activity_pub/mrf/anti_link_spam_policy_test.exs b/test/pleroma/web/activity_pub/mrf/anti_link_spam_policy_test.exs index 6867c9853..6867c9853 100644 --- a/test/web/activity_pub/mrf/anti_link_spam_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/anti_link_spam_policy_test.exs diff --git a/test/web/activity_pub/mrf/ensure_re_prepended_test.exs b/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs index 9a283f27d..9a283f27d 100644 --- a/test/web/activity_pub/mrf/ensure_re_prepended_test.exs +++ b/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs diff --git a/test/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs b/test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs index 86dd9ddae..86dd9ddae 100644 --- a/test/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs diff --git a/test/web/activity_pub/mrf/hellthread_policy_test.exs b/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs index 26f5bcdaa..26f5bcdaa 100644 --- a/test/web/activity_pub/mrf/hellthread_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs diff --git a/test/web/activity_pub/mrf/keyword_policy_test.exs b/test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs index b3d0f3d90..b3d0f3d90 100644 --- a/test/web/activity_pub/mrf/keyword_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs diff --git a/test/web/activity_pub/mrf/mediaproxy_warming_policy_test.exs b/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs index 1710c4d2a..1710c4d2a 100644 --- a/test/web/activity_pub/mrf/mediaproxy_warming_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs diff --git a/test/web/activity_pub/mrf/mention_policy_test.exs b/test/pleroma/web/activity_pub/mrf/mention_policy_test.exs index 220309cc9..220309cc9 100644 --- a/test/web/activity_pub/mrf/mention_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/mention_policy_test.exs diff --git a/test/web/activity_pub/mrf/no_placeholder_text_policy_test.exs b/test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs index 64ea61dd4..64ea61dd4 100644 --- a/test/web/activity_pub/mrf/no_placeholder_text_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs diff --git a/test/web/activity_pub/mrf/normalize_markup_test.exs b/test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs index 9b39c45bd..9b39c45bd 100644 --- a/test/web/activity_pub/mrf/normalize_markup_test.exs +++ b/test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs diff --git a/test/web/activity_pub/mrf/object_age_policy_test.exs b/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs index cf6acc9a2..cf6acc9a2 100644 --- a/test/web/activity_pub/mrf/object_age_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs diff --git a/test/web/activity_pub/mrf/reject_non_public_test.exs b/test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs index 58b46b9a2..e08eb3ba6 100644 --- a/test/web/activity_pub/mrf/reject_non_public_test.exs +++ b/test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs @@ -21,7 +21,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.RejectNonPublicTest do "type" => "Create" } - assert {:ok, message} = RejectNonPublic.filter(message) + assert {:ok, _message} = RejectNonPublic.filter(message) end test "it's allowed when cc address contain public address" do @@ -34,7 +34,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.RejectNonPublicTest do "type" => "Create" } - assert {:ok, message} = RejectNonPublic.filter(message) + assert {:ok, _message} = RejectNonPublic.filter(message) end end @@ -50,7 +50,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.RejectNonPublicTest do } Pleroma.Config.put([:mrf_rejectnonpublic, :allow_followersonly], true) - assert {:ok, message} = RejectNonPublic.filter(message) + assert {:ok, _message} = RejectNonPublic.filter(message) end test "it's rejected when addrer of message in the follower addresses of user and it disabled in config" do @@ -80,7 +80,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.RejectNonPublicTest do } Pleroma.Config.put([:mrf_rejectnonpublic, :allow_direct], true) - assert {:ok, message} = RejectNonPublic.filter(message) + assert {:ok, _message} = RejectNonPublic.filter(message) end test "it's reject when direct messages aren't allow" do diff --git a/test/web/activity_pub/mrf/simple_policy_test.exs b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs index d7dde62c4..d7dde62c4 100644 --- a/test/web/activity_pub/mrf/simple_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs diff --git a/test/web/activity_pub/mrf/steal_emoji_policy_test.exs b/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs index 3f8222736..3f8222736 100644 --- a/test/web/activity_pub/mrf/steal_emoji_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs diff --git a/test/web/activity_pub/mrf/subchain_policy_test.exs b/test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs index fff66cb7e..fff66cb7e 100644 --- a/test/web/activity_pub/mrf/subchain_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs diff --git a/test/web/activity_pub/mrf/tag_policy_test.exs b/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs index 6ff71d640..ffc30ba62 100644 --- a/test/web/activity_pub/mrf/tag_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs @@ -29,7 +29,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicyTest do actor = insert(:user, tags: ["mrf_tag:disable-remote-subscription"]) follower = insert(:user, tags: ["mrf_tag:disable-remote-subscription"], local: true) message = %{"object" => actor.ap_id, "type" => "Follow", "actor" => follower.ap_id} - assert {:ok, message} = TagPolicy.filter(message) + assert {:ok, _message} = TagPolicy.filter(message) end end diff --git a/test/web/activity_pub/mrf/user_allowlist_policy_test.exs b/test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs index 8e1ad5bc8..8e1ad5bc8 100644 --- a/test/web/activity_pub/mrf/user_allowlist_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs diff --git a/test/web/activity_pub/mrf/vocabulary_policy_test.exs b/test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs index 2bceb67ee..2bceb67ee 100644 --- a/test/web/activity_pub/mrf/vocabulary_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs diff --git a/test/web/activity_pub/mrf/mrf_test.exs b/test/pleroma/web/activity_pub/mrf_test.exs index e82c8afa6..e8cdde2e1 100644 --- a/test/web/activity_pub/mrf/mrf_test.exs +++ b/test/pleroma/web/activity_pub/mrf_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Web.ActivityPub.MRFTest do use ExUnit.Case, async: true use Pleroma.Tests.Helpers diff --git a/test/web/activity_pub/object_validators/accept_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs index d6111ba41..d6111ba41 100644 --- a/test/web/activity_pub/object_validators/accept_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs diff --git a/test/web/activity_pub/object_validators/announce_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs index 623342f76..4771c4698 100644 --- a/test/web/activity_pub/object_validators/announce_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnnouncValidationTest do +defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnnounceValidationTest do use Pleroma.DataCase alias Pleroma.Object diff --git a/test/web/activity_pub/object_validators/article_note_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs index cc6dab872..cc6dab872 100644 --- a/test/web/activity_pub/object_validators/article_note_validator_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs diff --git a/test/web/activity_pub/object_validators/attachment_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs index 558bb3131..760388e80 100644 --- a/test/web/activity_pub/object_validators/attachment_validator_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs @@ -56,7 +56,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidatorTest do user = insert(:user) file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } diff --git a/test/web/activity_pub/object_validators/block_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/block_validation_test.exs index c08d4b2e8..c08d4b2e8 100644 --- a/test/web/activity_pub/object_validators/block_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/block_validation_test.exs diff --git a/test/web/activity_pub/object_validators/chat_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs index 16e4808e5..d7e299224 100644 --- a/test/web/activity_pub/object_validators/chat_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs @@ -77,7 +77,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatValidationTest do user: user } do file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -98,7 +98,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatValidationTest do user: user } do file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -119,7 +119,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatValidationTest do user: user } do file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } diff --git a/test/web/activity_pub/object_validators/delete_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs index 02683b899..02683b899 100644 --- a/test/web/activity_pub/object_validators/delete_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs diff --git a/test/web/activity_pub/object_validators/emoji_react_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs index 582e6d785..582e6d785 100644 --- a/test/web/activity_pub/object_validators/emoji_react_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs diff --git a/test/web/activity_pub/object_validators/follow_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs index 6e1378be2..6e1378be2 100644 --- a/test/web/activity_pub/object_validators/follow_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs diff --git a/test/web/activity_pub/object_validators/like_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs index 2c033b7e2..2c033b7e2 100644 --- a/test/web/activity_pub/object_validators/like_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs diff --git a/test/web/activity_pub/object_validators/reject_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs index 370bb6e5c..370bb6e5c 100644 --- a/test/web/activity_pub/object_validators/reject_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs diff --git a/test/web/activity_pub/object_validators/undo_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs index 75bbcc4b6..75bbcc4b6 100644 --- a/test/web/activity_pub/object_validators/undo_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs diff --git a/test/web/activity_pub/object_validators/update_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs index 5e80cf731..5e80cf731 100644 --- a/test/web/activity_pub/object_validators/update_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs diff --git a/test/web/activity_pub/pipeline_test.exs b/test/pleroma/web/activity_pub/pipeline_test.exs index 210a06563..210a06563 100644 --- a/test/web/activity_pub/pipeline_test.exs +++ b/test/pleroma/web/activity_pub/pipeline_test.exs diff --git a/test/web/activity_pub/publisher_test.exs b/test/pleroma/web/activity_pub/publisher_test.exs index b9388b966..b9388b966 100644 --- a/test/web/activity_pub/publisher_test.exs +++ b/test/pleroma/web/activity_pub/publisher_test.exs diff --git a/test/web/activity_pub/relay_test.exs b/test/pleroma/web/activity_pub/relay_test.exs index 9d657ac4f..3284980f7 100644 --- a/test/web/activity_pub/relay_test.exs +++ b/test/pleroma/web/activity_pub/relay_test.exs @@ -63,6 +63,46 @@ defmodule Pleroma.Web.ActivityPub.RelayTest do assert activity.data["to"] == [user.ap_id] refute "#{user.ap_id}/followers" in User.following(service_actor) end + + test "force unfollow when target service is dead" do + user = insert(:user) + user_ap_id = user.ap_id + user_id = user.id + + Tesla.Mock.mock(fn %{method: :get, url: ^user_ap_id} -> + %Tesla.Env{status: 404} + end) + + service_actor = Relay.get_actor() + CommonAPI.follow(service_actor, user) + assert "#{user.ap_id}/followers" in User.following(service_actor) + + assert Pleroma.Repo.get_by( + Pleroma.FollowingRelationship, + follower_id: service_actor.id, + following_id: user_id + ) + + Pleroma.Repo.delete(user) + Cachex.clear(:user_cache) + + assert {:ok, %Activity{} = activity} = Relay.unfollow(user_ap_id, %{force: true}) + + assert refresh_record(service_actor).following_count == 0 + + refute Pleroma.Repo.get_by( + Pleroma.FollowingRelationship, + follower_id: service_actor.id, + following_id: user_id + ) + + assert activity.actor == "#{Pleroma.Web.Endpoint.url()}/relay" + assert user.ap_id in activity.recipients + assert activity.data["type"] == "Undo" + assert activity.data["actor"] == service_actor.ap_id + assert activity.data["to"] == [user_ap_id] + refute "#{user.ap_id}/followers" in User.following(service_actor) + end end describe "publish/1" do diff --git a/test/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs index 9efbaad04..9efbaad04 100644 --- a/test/web/activity_pub/side_effects_test.exs +++ b/test/pleroma/web/activity_pub/side_effects_test.exs diff --git a/test/web/activity_pub/transmogrifier/accept_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs index 77d468f5c..c6ff96f08 100644 --- a/test/web/activity_pub/transmogrifier/accept_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs @@ -46,7 +46,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AcceptHandlingTest do test "it works for incoming accepts which are referenced by IRI only" do follower = insert(:user) - followed = insert(:user, locked: true) + followed = insert(:user, is_locked: true) {:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed) @@ -72,7 +72,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AcceptHandlingTest do test "it fails for incoming accepts which cannot be correlated" do follower = insert(:user) - followed = insert(:user, locked: true) + followed = insert(:user, is_locked: true) accept_data = File.read!("test/fixtures/mastodon-accept-activity.json") diff --git a/test/web/activity_pub/transmogrifier/announce_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs index e895636b5..54335acdb 100644 --- a/test/web/activity_pub/transmogrifier/announce_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs @@ -144,7 +144,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AnnounceHandlingTest do _user = insert(:user, local: false, ap_id: data["actor"]) - assert {:error, e} = Transmogrifier.handle_incoming(data) + assert {:error, _e} = Transmogrifier.handle_incoming(data) end test "it does not clobber the addressing on announce activities" do diff --git a/test/web/activity_pub/transmogrifier/answer_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs index 0f6605c3f..0f6605c3f 100644 --- a/test/web/activity_pub/transmogrifier/answer_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/article_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs index 9b12a470a..9b12a470a 100644 --- a/test/web/activity_pub/transmogrifier/article_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/audio_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs index 0636d00c5..0636d00c5 100644 --- a/test/web/activity_pub/transmogrifier/audio_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/block_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs index 71f1a0ed5..71f1a0ed5 100644 --- a/test/web/activity_pub/transmogrifier/block_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/chat_message_test.exs b/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs index 31274c067..31274c067 100644 --- a/test/web/activity_pub/transmogrifier/chat_message_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs diff --git a/test/web/activity_pub/transmogrifier/delete_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs index c9a53918c..c9a53918c 100644 --- a/test/web/activity_pub/transmogrifier/delete_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/emoji_react_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs index 0fb056b50..0fb056b50 100644 --- a/test/web/activity_pub/transmogrifier/emoji_react_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/event_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs index 7f1ef2cbd..7f1ef2cbd 100644 --- a/test/web/activity_pub/transmogrifier/event_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/follow_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs index 757d90941..4ef8210ad 100644 --- a/test/web/activity_pub/transmogrifier/follow_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs @@ -65,7 +65,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.FollowHandlingTest do end test "with locked accounts, it does create a Follow, but not an Accept" do - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) data = File.read!("test/fixtures/mastodon-follow-activity.json") @@ -188,7 +188,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.FollowHandlingTest do test "it works for incoming follows to locked account" do pending_follower = insert(:user, ap_id: "http://mastodon.example.org/users/admin") - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) data = File.read!("test/fixtures/mastodon-follow-activity.json") diff --git a/test/web/activity_pub/transmogrifier/like_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs index 53fe1d550..53fe1d550 100644 --- a/test/web/activity_pub/transmogrifier/like_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/question_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs index d2822ce75..d2822ce75 100644 --- a/test/web/activity_pub/transmogrifier/question_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/reject_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs index 7592fbe1c..5c1451def 100644 --- a/test/web/activity_pub/transmogrifier/reject_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs @@ -14,7 +14,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.RejectHandlingTest do test "it fails for incoming rejects which cannot be correlated" do follower = insert(:user) - followed = insert(:user, locked: true) + followed = insert(:user, is_locked: true) accept_data = File.read!("test/fixtures/mastodon-reject-activity.json") @@ -33,7 +33,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.RejectHandlingTest do test "it works for incoming rejects which are referenced by IRI only" do follower = insert(:user) - followed = insert(:user, locked: true) + followed = insert(:user, is_locked: true) {:ok, follower} = User.follow(follower, followed) {:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed) diff --git a/test/web/activity_pub/transmogrifier/undo_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs index 8683f7135..8683f7135 100644 --- a/test/web/activity_pub/transmogrifier/undo_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier/user_update_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs index 64636656c..7c4d16db7 100644 --- a/test/web/activity_pub/transmogrifier/user_update_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs @@ -154,6 +154,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.UserUpdateHandlingTest do {:ok, %Activity{local: false}} = Transmogrifier.handle_incoming(update_data) user = User.get_cached_by_ap_id(user.ap_id) - assert user.locked == true + assert user.is_locked == true end end diff --git a/test/web/activity_pub/transmogrifier/video_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs index 69c953a2e..69c953a2e 100644 --- a/test/web/activity_pub/transmogrifier/video_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index 561674f01..e39af1dfc 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -101,7 +101,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do {:ok, returned_activity} = Transmogrifier.handle_incoming(data) returned_object = Object.normalize(returned_activity, false) - assert activity = + assert %Activity{} = Activity.get_create_by_object_ap_id( "https://mstdn.io/users/mayuutann/statuses/99568293732299394" ) @@ -206,6 +206,16 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do assert user.note_count == 1 end + test "it works for incoming notices without the sensitive property but an nsfw hashtag" do + data = File.read!("test/fixtures/mastodon-post-activity-nsfw.json") |> Poison.decode!() + + {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) + + object_data = Object.normalize(data["object"], false).data + + assert object_data["sensitive"] == true + end + test "it works for incoming notices with hashtags" do data = File.read!("test/fixtures/mastodon-post-activity-hashtag.json") |> Poison.decode!() diff --git a/test/web/activity_pub/utils_test.exs b/test/pleroma/web/activity_pub/utils_test.exs index d50213545..be9cd7d13 100644 --- a/test/web/activity_pub/utils_test.exs +++ b/test/pleroma/web/activity_pub/utils_test.exs @@ -193,7 +193,7 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do describe "update_follow_state_for_all/2" do test "updates the state of all Follow activities with the same actor and object" do - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) follower = insert(:user) {:ok, _, _, follow_activity} = CommonAPI.follow(follower, user) @@ -217,7 +217,7 @@ defmodule Pleroma.Web.ActivityPub.UtilsTest do describe "update_follow_state/2" do test "updates the state of the given follow activity" do - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) follower = insert(:user) {:ok, _, _, follow_activity} = CommonAPI.follow(follower, user) diff --git a/test/web/activity_pub/views/object_view_test.exs b/test/pleroma/web/activity_pub/views/object_view_test.exs index f0389845d..f0389845d 100644 --- a/test/web/activity_pub/views/object_view_test.exs +++ b/test/pleroma/web/activity_pub/views/object_view_test.exs diff --git a/test/web/activity_pub/views/user_view_test.exs b/test/pleroma/web/activity_pub/views/user_view_test.exs index 98c7c9d09..98c7c9d09 100644 --- a/test/web/activity_pub/views/user_view_test.exs +++ b/test/pleroma/web/activity_pub/views/user_view_test.exs diff --git a/test/web/activity_pub/visibilty_test.exs b/test/pleroma/web/activity_pub/visibility_test.exs index 8e9354c65..8e9354c65 100644 --- a/test/web/activity_pub/visibilty_test.exs +++ b/test/pleroma/web/activity_pub/visibility_test.exs diff --git a/test/web/admin_api/controllers/admin_api_controller_test.exs b/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs index cba6b43d3..cba6b43d3 100644 --- a/test/web/admin_api/controllers/admin_api_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs diff --git a/test/web/admin_api/controllers/chat_controller_test.exs b/test/pleroma/web/admin_api/controllers/chat_controller_test.exs index bd4c9c9d1..bd4c9c9d1 100644 --- a/test/web/admin_api/controllers/chat_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/chat_controller_test.exs diff --git a/test/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index 4e897455f..4e897455f 100644 --- a/test/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs diff --git a/test/web/admin_api/controllers/instance_document_controller_test.exs b/test/pleroma/web/admin_api/controllers/instance_document_controller_test.exs index 5f7b042f6..5f7b042f6 100644 --- a/test/web/admin_api/controllers/instance_document_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/instance_document_controller_test.exs diff --git a/test/web/admin_api/controllers/invite_controller_test.exs b/test/pleroma/web/admin_api/controllers/invite_controller_test.exs index ab186c5e7..ab186c5e7 100644 --- a/test/web/admin_api/controllers/invite_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/invite_controller_test.exs diff --git a/test/web/admin_api/controllers/media_proxy_cache_controller_test.exs b/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs index f243d1fb2..f243d1fb2 100644 --- a/test/web/admin_api/controllers/media_proxy_cache_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs diff --git a/test/web/admin_api/controllers/oauth_app_controller_test.exs b/test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs index ed7c4172c..ed7c4172c 100644 --- a/test/web/admin_api/controllers/oauth_app_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs diff --git a/test/web/admin_api/controllers/relay_controller_test.exs b/test/pleroma/web/admin_api/controllers/relay_controller_test.exs index adadf2b5c..adadf2b5c 100644 --- a/test/web/admin_api/controllers/relay_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/relay_controller_test.exs diff --git a/test/web/admin_api/controllers/report_controller_test.exs b/test/pleroma/web/admin_api/controllers/report_controller_test.exs index 57946e6bb..57946e6bb 100644 --- a/test/web/admin_api/controllers/report_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/report_controller_test.exs diff --git a/test/web/admin_api/controllers/status_controller_test.exs b/test/pleroma/web/admin_api/controllers/status_controller_test.exs index eff78fb0a..eff78fb0a 100644 --- a/test/web/admin_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/status_controller_test.exs diff --git a/test/web/admin_api/search_test.exs b/test/pleroma/web/admin_api/search_test.exs index d88867c52..ceec64f1e 100644 --- a/test/web/admin_api/search_test.exs +++ b/test/pleroma/web/admin_api/search_test.exs @@ -180,7 +180,7 @@ defmodule Pleroma.Web.AdminAPI.SearchTest do test "it returns non-discoverable users" do insert(:user) - insert(:user, discoverable: false) + insert(:user, is_discoverable: false) {:ok, _results, total} = Search.user() diff --git a/test/web/admin_api/views/report_view_test.exs b/test/pleroma/web/admin_api/views/report_view_test.exs index 5a02292be..5a02292be 100644 --- a/test/web/admin_api/views/report_view_test.exs +++ b/test/pleroma/web/admin_api/views/report_view_test.exs diff --git a/test/web/api_spec/schema_examples_test.exs b/test/pleroma/web/api_spec/schema_examples_test.exs index f00e834fc..f00e834fc 100644 --- a/test/web/api_spec/schema_examples_test.exs +++ b/test/pleroma/web/api_spec/schema_examples_test.exs diff --git a/test/web/auth/auth_test_controller_test.exs b/test/pleroma/web/auth/auth_controller_test.exs index fed52b7f3..498554060 100644 --- a/test/web/auth/auth_test_controller_test.exs +++ b/test/pleroma/web/auth/auth_controller_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Tests.AuthTestControllerTest do +defmodule Pleroma.Web.Auth.AuthControllerTest do use Pleroma.Web.ConnCase import Pleroma.Factory diff --git a/test/web/auth/authenticator_test.exs b/test/pleroma/web/auth/authenticator_test.exs index d54253343..d54253343 100644 --- a/test/web/auth/authenticator_test.exs +++ b/test/pleroma/web/auth/authenticator_test.exs diff --git a/test/web/auth/basic_auth_test.exs b/test/pleroma/web/auth/basic_auth_test.exs index bf6e3d2fc..bf6e3d2fc 100644 --- a/test/web/auth/basic_auth_test.exs +++ b/test/pleroma/web/auth/basic_auth_test.exs diff --git a/test/web/auth/pleroma_authenticator_test.exs b/test/pleroma/web/auth/pleroma_authenticator_test.exs index 1ba0dfecc..1ba0dfecc 100644 --- a/test/web/auth/pleroma_authenticator_test.exs +++ b/test/pleroma/web/auth/pleroma_authenticator_test.exs diff --git a/test/web/auth/totp_authenticator_test.exs b/test/pleroma/web/auth/totp_authenticator_test.exs index 84d4cd840..84d4cd840 100644 --- a/test/web/auth/totp_authenticator_test.exs +++ b/test/pleroma/web/auth/totp_authenticator_test.exs diff --git a/test/web/chat_channel_test.exs b/test/pleroma/web/chat_channel_test.exs index f18f3a212..32170873d 100644 --- a/test/web/chat_channel_test.exs +++ b/test/pleroma/web/chat_channel_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Web.ChatChannelTest do use Pleroma.Web.ChannelCase alias Pleroma.Web.ChatChannel diff --git a/test/web/common_api/common_api_utils_test.exs b/test/pleroma/web/common_api/utils_test.exs index e67c10b93..e67c10b93 100644 --- a/test/web/common_api/common_api_utils_test.exs +++ b/test/pleroma/web/common_api/utils_test.exs diff --git a/test/web/common_api/common_api_test.exs b/test/pleroma/web/common_api_test.exs index e34f5a49b..c5b90ad84 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -95,12 +95,26 @@ defmodule Pleroma.Web.CommonAPITest do describe "posting chat messages" do setup do: clear_config([:instance, :chat_limit]) + test "it posts a self-chat" do + author = insert(:user) + recipient = author + + {:ok, activity} = + CommonAPI.post_chat_message( + author, + recipient, + "remember to buy milk when milk truk arive" + ) + + assert activity.data["type"] == "Create" + end + test "it posts a chat message without content but with an attachment" do author = insert(:user) recipient = insert(:user) file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -622,7 +636,7 @@ defmodule Pleroma.Web.CommonAPITest do assert {:error, "The status is over the character limit"} = CommonAPI.post(user, %{status: "foobar"}) - assert {:ok, activity} = CommonAPI.post(user, %{status: "12345"}) + assert {:ok, _activity} = CommonAPI.post(user, %{status: "12345"}) end test "it can handle activities that expire" do @@ -1071,7 +1085,7 @@ defmodule Pleroma.Web.CommonAPITest do test "cancels a pending follow for a local user" do follower = insert(:user) - followed = insert(:user, locked: true) + followed = insert(:user, is_locked: true) assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} = CommonAPI.follow(follower, followed) @@ -1093,7 +1107,7 @@ defmodule Pleroma.Web.CommonAPITest do test "cancels a pending follow for a remote user" do follower = insert(:user) - followed = insert(:user, locked: true, local: false, ap_enabled: true) + followed = insert(:user, is_locked: true, local: false, ap_enabled: true) assert {:ok, follower, followed, %{id: activity_id, data: %{"state" => "pending"}}} = CommonAPI.follow(follower, followed) @@ -1116,7 +1130,7 @@ defmodule Pleroma.Web.CommonAPITest do describe "accept_follow_request/2" do test "after acceptance, it sets all existing pending follow request states to 'accept'" do - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) follower = insert(:user) follower_two = insert(:user) @@ -1136,7 +1150,7 @@ defmodule Pleroma.Web.CommonAPITest do end test "after rejection, it sets all existing pending follow request states to 'reject'" do - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) follower = insert(:user) follower_two = insert(:user) @@ -1156,7 +1170,7 @@ defmodule Pleroma.Web.CommonAPITest do end test "doesn't create a following relationship if the corresponding follow request doesn't exist" do - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) not_follower = insert(:user) CommonAPI.accept_follow_request(not_follower, user) diff --git a/test/web/fallback_test.exs b/test/pleroma/web/fallback_test.exs index a65865860..a65865860 100644 --- a/test/web/fallback_test.exs +++ b/test/pleroma/web/fallback_test.exs diff --git a/test/web/fed_sockets/fed_registry_test.exs b/test/pleroma/web/fed_sockets/fed_registry_test.exs index 19ac874d6..73aaced46 100644 --- a/test/web/fed_sockets/fed_registry_test.exs +++ b/test/pleroma/web/fed_sockets/fed_registry_test.exs @@ -52,7 +52,7 @@ defmodule Pleroma.Web.FedSockets.FedRegistryTest do end test "will be ignored" do - assert {:ok, %SocketInfo{origin: origin, pid: pid_one}} = + assert {:ok, %SocketInfo{origin: origin, pid: _pid_one}} = FedRegistry.get_fed_socket(@good_domain_origin) assert origin == "good.domain:80" @@ -63,7 +63,7 @@ defmodule Pleroma.Web.FedSockets.FedRegistryTest do test "the newer process will be closed" do pid_two = build_test_socket(@good_domain) - assert {:ok, %SocketInfo{origin: origin, pid: pid_one}} = + assert {:ok, %SocketInfo{origin: origin, pid: _pid_one}} = FedRegistry.get_fed_socket(@good_domain_origin) assert origin == "good.domain:80" diff --git a/test/web/fed_sockets/fetch_registry_test.exs b/test/pleroma/web/fed_sockets/fetch_registry_test.exs index 7bd2d995a..7bd2d995a 100644 --- a/test/web/fed_sockets/fetch_registry_test.exs +++ b/test/pleroma/web/fed_sockets/fetch_registry_test.exs diff --git a/test/web/fed_sockets/socket_info_test.exs b/test/pleroma/web/fed_sockets/socket_info_test.exs index db3d6edcd..db3d6edcd 100644 --- a/test/web/fed_sockets/socket_info_test.exs +++ b/test/pleroma/web/fed_sockets/socket_info_test.exs diff --git a/test/web/federator_test.exs b/test/pleroma/web/federator_test.exs index 592fdccd1..592fdccd1 100644 --- a/test/web/federator_test.exs +++ b/test/pleroma/web/federator_test.exs diff --git a/test/web/feed/tag_controller_test.exs b/test/pleroma/web/feed/tag_controller_test.exs index 868e40965..868e40965 100644 --- a/test/web/feed/tag_controller_test.exs +++ b/test/pleroma/web/feed/tag_controller_test.exs diff --git a/test/web/feed/user_controller_test.exs b/test/pleroma/web/feed/user_controller_test.exs index 9a5610baa..a5dc0894b 100644 --- a/test/web/feed/user_controller_test.exs +++ b/test/pleroma/web/feed/user_controller_test.exs @@ -206,7 +206,7 @@ defmodule Pleroma.Web.Feed.UserControllerTest do |> response(200) assert response == - Fallback.RedirectController.redirector_with_meta( + Pleroma.Web.Fallback.RedirectController.redirector_with_meta( conn, %{user: user} ).resp_body diff --git a/test/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs index f7f1369e4..dcc0c81ec 100644 --- a/test/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs @@ -32,7 +32,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do test "works by nickname" do user = insert(:user) - assert %{"id" => user_id} = + assert %{"id" => _user_id} = build_conn() |> get("/api/v1/accounts/#{user.nickname}") |> json_response_and_validate_schema(200) @@ -43,7 +43,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do user = insert(:user, nickname: "user@example.com", local: false) - assert %{"id" => user_id} = + assert %{"id" => _user_id} = build_conn() |> get("/api/v1/accounts/#{user.nickname}") |> json_response_and_validate_schema(200) @@ -380,7 +380,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do other_user = insert(:user) file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -706,7 +706,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do end test "cancelling follow request", %{conn: conn} do - %{id: other_user_id} = insert(:user, %{locked: true}) + %{id: other_user_id} = insert(:user, %{is_locked: true}) assert %{"id" => ^other_user_id, "following" => false, "requested" => true} = conn @@ -1429,10 +1429,10 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do test "returns lists to which the account belongs" do %{user: user, conn: conn} = oauth_access(["read:lists"]) other_user = insert(:user) - assert {:ok, %Pleroma.List{id: list_id} = list} = Pleroma.List.create("Test List", user) + assert {:ok, %Pleroma.List{id: _list_id} = list} = Pleroma.List.create("Test List", user) {:ok, %{following: _following}} = Pleroma.List.follow(list, other_user) - assert [%{"id" => list_id, "title" => "Test List"}] = + assert [%{"id" => _list_id, "title" => "Test List"}] = conn |> get("/api/v1/accounts/#{other_user.id}/lists") |> json_response_and_validate_schema(200) diff --git a/test/web/mastodon_api/controllers/app_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs index a0b8b126c..a0b8b126c 100644 --- a/test/web/mastodon_api/controllers/app_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs diff --git a/test/web/mastodon_api/controllers/auth_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs index bf2438fe2..bf2438fe2 100644 --- a/test/web/mastodon_api/controllers/auth_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs diff --git a/test/web/mastodon_api/controllers/conversation_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs index 3e21e6bf1..3e21e6bf1 100644 --- a/test/web/mastodon_api/controllers/conversation_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs diff --git a/test/web/mastodon_api/controllers/custom_emoji_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/custom_emoji_controller_test.exs index ab0027f90..ab0027f90 100644 --- a/test/web/mastodon_api/controllers/custom_emoji_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/custom_emoji_controller_test.exs diff --git a/test/web/mastodon_api/controllers/domain_block_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs index 664654500..664654500 100644 --- a/test/web/mastodon_api/controllers/domain_block_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs diff --git a/test/web/mastodon_api/controllers/filter_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs index 0d426ec34..0d426ec34 100644 --- a/test/web/mastodon_api/controllers/filter_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs diff --git a/test/web/mastodon_api/controllers/follow_request_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs index 6749e0e83..a9dd7cd30 100644 --- a/test/web/mastodon_api/controllers/follow_request_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs @@ -12,7 +12,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do describe "locked accounts" do setup do - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) %{conn: conn} = oauth_access(["follow"], user: user) %{user: user, conn: conn} end diff --git a/test/web/mastodon_api/controllers/instance_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs index 6a9ccd979..6a9ccd979 100644 --- a/test/web/mastodon_api/controllers/instance_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs diff --git a/test/web/mastodon_api/controllers/list_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs index 091ec006c..091ec006c 100644 --- a/test/web/mastodon_api/controllers/list_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs diff --git a/test/web/mastodon_api/controllers/marker_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs index 9f0481120..9f0481120 100644 --- a/test/web/mastodon_api/controllers/marker_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs diff --git a/test/web/mastodon_api/controllers/media_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs index 906fd940f..d2bd57515 100644 --- a/test/web/mastodon_api/controllers/media_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs @@ -14,7 +14,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do setup do image = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -74,7 +74,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do setup %{user: actor} do file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -106,7 +106,7 @@ defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do setup %{user: actor} do file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } diff --git a/test/web/mastodon_api/controllers/notification_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs index 70ef0e8b5..70ef0e8b5 100644 --- a/test/web/mastodon_api/controllers/notification_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs diff --git a/test/web/mastodon_api/controllers/poll_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs index f41de6448..f41de6448 100644 --- a/test/web/mastodon_api/controllers/poll_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs diff --git a/test/web/mastodon_api/controllers/report_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs index 6636cff96..6636cff96 100644 --- a/test/web/mastodon_api/controllers/report_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs diff --git a/test/web/mastodon_api/controllers/scheduled_activity_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs index 1ff871c89..1ff871c89 100644 --- a/test/web/mastodon_api/controllers/scheduled_activity_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs diff --git a/test/web/mastodon_api/controllers/search_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs index 04dc6f445..04dc6f445 100644 --- a/test/web/mastodon_api/controllers/search_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index 633a25e50..436608e51 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -167,7 +167,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do test "posting an undefined status with an attachment", %{user: user, conn: conn} do file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -408,7 +408,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do |> Kernel.<>("Z") file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -937,7 +937,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do |> get("/api/v1/statuses/#{reblog_activity1.id}") assert %{ - "reblog" => %{"id" => id, "reblogged" => false, "reblogs_count" => 2}, + "reblog" => %{"id" => _id, "reblogged" => false, "reblogs_count" => 2}, "reblogged" => false, "favourited" => false, "bookmarked" => false diff --git a/test/web/mastodon_api/controllers/subscription_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs index d36bb1ae8..d36bb1ae8 100644 --- a/test/web/mastodon_api/controllers/subscription_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs diff --git a/test/web/mastodon_api/controllers/suggestion_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs index 7f08e187c..7f08e187c 100644 --- a/test/web/mastodon_api/controllers/suggestion_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs diff --git a/test/web/mastodon_api/controllers/timeline_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs index c6e0268fd..c6e0268fd 100644 --- a/test/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs diff --git a/test/web/masto_fe_controller_test.exs b/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs index f3b54b5f2..ed8add8d2 100644 --- a/test/web/masto_fe_controller_test.exs +++ b/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.MastodonAPI.MastoFEController do +defmodule Pleroma.Web.MastodonAPI.MastoFEControllerTest do use Pleroma.Web.ConnCase alias Pleroma.Config diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs index bb4bc4396..bb4bc4396 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs diff --git a/test/web/mastodon_api/mastodon_api_test.exs b/test/pleroma/web/mastodon_api/mastodon_api_test.exs index 0c5a38bf6..0c5a38bf6 100644 --- a/test/web/mastodon_api/mastodon_api_test.exs +++ b/test/pleroma/web/mastodon_api/mastodon_api_test.exs diff --git a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs b/test/pleroma/web/mastodon_api/update_credentials_test.exs index 2e6704726..ed1921c91 100644 --- a/test/web/mastodon_api/controllers/account_controller/update_credentials_test.exs +++ b/test/pleroma/web/mastodon_api/update_credentials_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do +defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do alias Pleroma.Repo alias Pleroma.User @@ -222,7 +222,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do test "updates the user's avatar", %{user: user, conn: conn} do new_avatar = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -246,7 +246,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do test "updates the user's banner", %{user: user, conn: conn} do new_header = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -265,7 +265,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController.UpdateCredentialsTest do test "updates the user's background", %{conn: conn, user: user} do new_header = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } diff --git a/test/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs index a5f39b215..203e61c71 100644 --- a/test/web/mastodon_api/views/account_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs @@ -332,7 +332,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do test "represent a relationship for the user with a pending follow request" do user = insert(:user) - other_user = insert(:user, locked: true) + other_user = insert(:user, is_locked: true) {:ok, user, other_user, _} = CommonAPI.follow(user, other_user) user = User.get_cached_by_id(user.id) @@ -481,7 +481,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do end test "shows non-zero when follow requests are pending" do - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user}) @@ -493,7 +493,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do end test "decreases when accepting a follow request" do - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user}) @@ -510,7 +510,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do end test "decreases when rejecting a follow request" do - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user}) @@ -527,14 +527,14 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do end test "shows non-zero when historical unapproved requests are present" do - user = insert(:user, locked: true) + user = insert(:user, is_locked: true) assert %{locked: true} = AccountView.render("show.json", %{user: user, for: user}) other_user = insert(:user) {:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user) - {:ok, user} = User.update_and_set_cache(user, %{locked: false}) + {:ok, user} = User.update_and_set_cache(user, %{is_locked: false}) assert %{locked: false, follow_requests_count: 1} = AccountView.render("show.json", %{user: user, for: user}) diff --git a/test/web/mastodon_api/views/conversation_view_test.exs b/test/pleroma/web/mastodon_api/views/conversation_view_test.exs index 2e8203c9b..2e8203c9b 100644 --- a/test/web/mastodon_api/views/conversation_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/conversation_view_test.exs diff --git a/test/web/mastodon_api/views/list_view_test.exs b/test/pleroma/web/mastodon_api/views/list_view_test.exs index ca99242cb..ca99242cb 100644 --- a/test/web/mastodon_api/views/list_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/list_view_test.exs diff --git a/test/web/mastodon_api/views/marker_view_test.exs b/test/pleroma/web/mastodon_api/views/marker_view_test.exs index 48a0a6d33..48a0a6d33 100644 --- a/test/web/mastodon_api/views/marker_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/marker_view_test.exs diff --git a/test/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs index 2f6a808f1..2f6a808f1 100644 --- a/test/web/mastodon_api/views/notification_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/notification_view_test.exs diff --git a/test/web/mastodon_api/views/poll_view_test.exs b/test/pleroma/web/mastodon_api/views/poll_view_test.exs index b7e2f17ef..b7e2f17ef 100644 --- a/test/web/mastodon_api/views/poll_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/poll_view_test.exs diff --git a/test/web/mastodon_api/views/scheduled_activity_view_test.exs b/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs index fbfd873ef..04f73f5a0 100644 --- a/test/web/mastodon_api/views/scheduled_activity_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs @@ -22,7 +22,7 @@ defmodule Pleroma.Web.MastodonAPI.ScheduledActivityViewTest do |> NaiveDateTime.to_iso8601() file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } diff --git a/test/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs index 70d829979..70d829979 100644 --- a/test/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs diff --git a/test/web/mastodon_api/views/subscription_view_test.exs b/test/pleroma/web/mastodon_api/views/subscription_view_test.exs index 981524c0e..981524c0e 100644 --- a/test/web/mastodon_api/views/subscription_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/subscription_view_test.exs diff --git a/test/web/media_proxy/invalidations/http_test.exs b/test/pleroma/web/media_proxy/invalidation/http_test.exs index a1bef5237..13d081325 100644 --- a/test/web/media_proxy/invalidations/http_test.exs +++ b/test/pleroma/web/media_proxy/invalidation/http_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Web.MediaProxy.Invalidation.HttpTest do use ExUnit.Case alias Pleroma.Web.MediaProxy.Invalidation diff --git a/test/web/media_proxy/invalidations/script_test.exs b/test/pleroma/web/media_proxy/invalidation/script_test.exs index 51833ab18..692cbb2df 100644 --- a/test/web/media_proxy/invalidations/script_test.exs +++ b/test/pleroma/web/media_proxy/invalidation/script_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Web.MediaProxy.Invalidation.ScriptTest do use ExUnit.Case alias Pleroma.Web.MediaProxy.Invalidation diff --git a/test/web/media_proxy/invalidation_test.exs b/test/pleroma/web/media_proxy/invalidation_test.exs index 926ae74ca..aa1435ac0 100644 --- a/test/web/media_proxy/invalidation_test.exs +++ b/test/pleroma/web/media_proxy/invalidation_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Web.MediaProxy.InvalidationTest do use ExUnit.Case use Pleroma.Tests.Helpers diff --git a/test/web/media_proxy/media_proxy_controller_test.exs b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs index 33e6873f7..e9b584822 100644 --- a/test/web/media_proxy/media_proxy_controller_test.exs +++ b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs @@ -81,6 +81,15 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do end describe "Media Preview Proxy" do + def assert_dependencies_installed do + missing_dependencies = Pleroma.Helpers.MediaHelper.missing_dependencies() + + assert missing_dependencies == [], + "Error: missing dependencies (please refer to `docs/installation`): #{ + inspect(missing_dependencies) + }" + end + setup do clear_config([:media_proxy, :enabled], true) clear_config([:media_preview_proxy, :enabled], true) @@ -184,6 +193,8 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do url: url, media_proxy_url: media_proxy_url } do + assert_dependencies_installed() + # Setting a high :min_content_length to ensure this scenario is not affected by its logic clear_config([:media_preview_proxy, :min_content_length], 1_000_000_000) @@ -270,6 +281,8 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do url: url, media_proxy_url: media_proxy_url } do + assert_dependencies_installed() + Tesla.Mock.mock(fn %{method: "head", url: ^media_proxy_url} -> %Tesla.Env{status: 200, body: "", headers: [{"content-type", "image/png"}]} @@ -290,6 +303,8 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do url: url, media_proxy_url: media_proxy_url } do + assert_dependencies_installed() + Tesla.Mock.mock(fn %{method: "head", url: ^media_proxy_url} -> %Tesla.Env{status: 200, body: "", headers: [{"content-type", "image/jpeg"}]} diff --git a/test/web/media_proxy/media_proxy_test.exs b/test/pleroma/web/media_proxy_test.exs index 0e6df826c..0e6df826c 100644 --- a/test/web/media_proxy/media_proxy_test.exs +++ b/test/pleroma/web/media_proxy_test.exs diff --git a/test/web/metadata/player_view_test.exs b/test/pleroma/web/metadata/player_view_test.exs index e6c990242..e6c990242 100644 --- a/test/web/metadata/player_view_test.exs +++ b/test/pleroma/web/metadata/player_view_test.exs diff --git a/test/web/metadata/feed_test.exs b/test/pleroma/web/metadata/providers/feed_test.exs index e6e5cc5ed..e6e5cc5ed 100644 --- a/test/web/metadata/feed_test.exs +++ b/test/pleroma/web/metadata/providers/feed_test.exs diff --git a/test/web/metadata/opengraph_test.exs b/test/pleroma/web/metadata/providers/open_graph_test.exs index 218540e6c..218540e6c 100644 --- a/test/web/metadata/opengraph_test.exs +++ b/test/pleroma/web/metadata/providers/open_graph_test.exs diff --git a/test/web/metadata/rel_me_test.exs b/test/pleroma/web/metadata/providers/rel_me_test.exs index 2293d6e13..2293d6e13 100644 --- a/test/web/metadata/rel_me_test.exs +++ b/test/pleroma/web/metadata/providers/rel_me_test.exs diff --git a/test/web/metadata/restrict_indexing_test.exs b/test/pleroma/web/metadata/providers/restrict_indexing_test.exs index 6b3a65372..282d132c8 100644 --- a/test/web/metadata/restrict_indexing_test.exs +++ b/test/pleroma/web/metadata/providers/restrict_indexing_test.exs @@ -14,13 +14,13 @@ defmodule Pleroma.Web.Metadata.Providers.RestrictIndexingTest do test "for local user" do assert Pleroma.Web.Metadata.Providers.RestrictIndexing.build_tags(%{ - user: %Pleroma.User{local: true, discoverable: true} + user: %Pleroma.User{local: true, is_discoverable: true} }) == [] end test "for local user when discoverable is false" do assert Pleroma.Web.Metadata.Providers.RestrictIndexing.build_tags(%{ - user: %Pleroma.User{local: true, discoverable: false} + user: %Pleroma.User{local: true, is_discoverable: false} }) == [{:meta, [name: "robots", content: "noindex, noarchive"], []}] end end diff --git a/test/web/metadata/twitter_card_test.exs b/test/pleroma/web/metadata/providers/twitter_card_test.exs index 10931b5ba..10931b5ba 100644 --- a/test/web/metadata/twitter_card_test.exs +++ b/test/pleroma/web/metadata/providers/twitter_card_test.exs diff --git a/test/web/metadata/utils_test.exs b/test/pleroma/web/metadata/utils_test.exs index 8183256d8..8183256d8 100644 --- a/test/web/metadata/utils_test.exs +++ b/test/pleroma/web/metadata/utils_test.exs diff --git a/test/web/metadata/metadata_test.exs b/test/pleroma/web/metadata_test.exs index ca6cbe67f..8fb946540 100644 --- a/test/web/metadata/metadata_test.exs +++ b/test/pleroma/web/metadata_test.exs @@ -16,14 +16,14 @@ defmodule Pleroma.Web.MetadataTest do end test "for local user" do - user = insert(:user, discoverable: false) + user = insert(:user, is_discoverable: false) assert Pleroma.Web.Metadata.build_tags(%{user: user}) =~ "<meta content=\"noindex, noarchive\" name=\"robots\">" end test "for local user set to discoverable" do - user = insert(:user, discoverable: true) + user = insert(:user, is_discoverable: true) refute Pleroma.Web.Metadata.build_tags(%{user: user}) =~ "<meta content=\"noindex, noarchive\" name=\"robots\">" @@ -33,14 +33,14 @@ defmodule Pleroma.Web.MetadataTest do describe "no metadata for private instances" do test "for local user set to discoverable" do clear_config([:instance, :public], false) - user = insert(:user, bio: "This is my secret fedi account bio", discoverable: true) + user = insert(:user, bio: "This is my secret fedi account bio", is_discoverable: true) assert "" = Pleroma.Web.Metadata.build_tags(%{user: user}) end test "search exclusion metadata is included" do clear_config([:instance, :public], false) - user = insert(:user, bio: "This is my secret fedi account bio", discoverable: false) + user = insert(:user, bio: "This is my secret fedi account bio", is_discoverable: false) assert ~s(<meta content="noindex, noarchive" name="robots">) == Pleroma.Web.Metadata.build_tags(%{user: user}) diff --git a/test/web/mongooseim/mongoose_im_controller_test.exs b/test/pleroma/web/mongoose_im_controller_test.exs index 5176cde84..e3a8aa3d8 100644 --- a/test/web/mongooseim/mongoose_im_controller_test.exs +++ b/test/pleroma/web/mongoose_im_controller_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.MongooseIMController do +defmodule Pleroma.Web.MongooseIMControllerTest do use Pleroma.Web.ConnCase import Pleroma.Factory diff --git a/test/web/node_info_test.exs b/test/pleroma/web/node_info_test.exs index 06b33607f..06b33607f 100644 --- a/test/web/node_info_test.exs +++ b/test/pleroma/web/node_info_test.exs diff --git a/test/web/oauth/app_test.exs b/test/pleroma/web/o_auth/app_test.exs index 993a490e0..993a490e0 100644 --- a/test/web/oauth/app_test.exs +++ b/test/pleroma/web/o_auth/app_test.exs diff --git a/test/web/oauth/authorization_test.exs b/test/pleroma/web/o_auth/authorization_test.exs index d74b26cf8..d74b26cf8 100644 --- a/test/web/oauth/authorization_test.exs +++ b/test/pleroma/web/o_auth/authorization_test.exs diff --git a/test/web/oauth/ldap_authorization_test.exs b/test/pleroma/web/o_auth/ldap_authorization_test.exs index 63b1c0eb8..63b1c0eb8 100644 --- a/test/web/oauth/ldap_authorization_test.exs +++ b/test/pleroma/web/o_auth/ldap_authorization_test.exs diff --git a/test/web/oauth/mfa_controller_test.exs b/test/pleroma/web/o_auth/mfa_controller_test.exs index 3c341facd..3c341facd 100644 --- a/test/web/oauth/mfa_controller_test.exs +++ b/test/pleroma/web/o_auth/mfa_controller_test.exs diff --git a/test/web/oauth/oauth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs index 1200126b8..a00df8cc7 100644 --- a/test/web/oauth/oauth_controller_test.exs +++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs @@ -77,7 +77,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do } ) - assert response = html_response(conn, 302) + assert html_response(conn, 302) redirect_query = URI.parse(redirected_to(conn)).query assert %{"state" => state_param} = URI.decode_query(redirect_query) @@ -119,7 +119,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do } ) - assert response = html_response(conn, 302) + assert html_response(conn, 302) assert redirected_to(conn) =~ ~r/#{redirect_uri}\?code=.+/ end @@ -182,7 +182,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do } ) - assert response = html_response(conn, 302) + assert html_response(conn, 302) assert redirected_to(conn) == app.redirect_uris assert get_flash(conn, :error) == "Failed to authenticate: (error description)." end @@ -238,7 +238,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do } ) - assert response = html_response(conn, 302) + assert html_response(conn, 302) assert redirected_to(conn) =~ ~r/#{redirect_uri}\?code=.+/ end @@ -268,7 +268,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do } ) - assert response = html_response(conn, 401) + assert html_response(conn, 401) end test "with invalid params, POST /oauth/register?op=register renders registration_details page", @@ -336,7 +336,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do } ) - assert response = html_response(conn, 302) + assert html_response(conn, 302) assert redirected_to(conn) =~ ~r/#{redirect_uri}\?code=.+/ end @@ -367,7 +367,7 @@ defmodule Pleroma.Web.OAuth.OAuthControllerTest do } ) - assert response = html_response(conn, 401) + assert html_response(conn, 401) end test "with invalid params, POST /oauth/register?op=connect renders registration_details page", diff --git a/test/web/oauth/token/utils_test.exs b/test/pleroma/web/o_auth/token/utils_test.exs index a610d92f8..a610d92f8 100644 --- a/test/web/oauth/token/utils_test.exs +++ b/test/pleroma/web/o_auth/token/utils_test.exs diff --git a/test/web/oauth/token_test.exs b/test/pleroma/web/o_auth/token_test.exs index c88b9cc98..c88b9cc98 100644 --- a/test/web/oauth/token_test.exs +++ b/test/pleroma/web/o_auth/token_test.exs diff --git a/test/web/ostatus/ostatus_controller_test.exs b/test/pleroma/web/o_status/o_status_controller_test.exs index ee498f4b5..ee498f4b5 100644 --- a/test/web/ostatus/ostatus_controller_test.exs +++ b/test/pleroma/web/o_status/o_status_controller_test.exs diff --git a/test/web/pleroma_api/controllers/account_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs index 07909d48b..07909d48b 100644 --- a/test/web/pleroma_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs diff --git a/test/web/pleroma_api/controllers/chat_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs index 11d5ba373..6381f9757 100644 --- a/test/web/pleroma_api/controllers/chat_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs @@ -105,7 +105,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do test "it works with an attachment", %{conn: conn, user: user} do file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } diff --git a/test/web/pleroma_api/controllers/conversation_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs index e6d0b3e37..e6d0b3e37 100644 --- a/test/web/pleroma_api/controllers/conversation_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs diff --git a/test/web/pleroma_api/controllers/emoji_file_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs index 39b4e1dac..82de86ee3 100644 --- a/test/web/pleroma_api/controllers/emoji_file_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs @@ -29,7 +29,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do {:ok, %{admin_conn: admin_conn}} end - describe "POST/PATCH/DELETE /api/pleroma/emoji/packs/:name/files" do + describe "POST/PATCH/DELETE /api/pleroma/emoji/packs/files?name=:name" do setup do pack_file = "#{@emoji_path}/test_pack/pack.json" original_content = File.read!(pack_file) @@ -56,7 +56,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do resp = admin_conn |> put_req_header("content-type", "multipart/form-data") - |> post("/api/pleroma/emoji/packs/test_pack/files", %{ + |> post("/api/pleroma/emoji/packs/files?name=test_pack", %{ file: %Plug.Upload{ content_type: "application/zip", filename: "emojis.zip", @@ -83,7 +83,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do test "create shortcode exists", %{admin_conn: admin_conn} do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> post("/api/pleroma/emoji/packs/test_pack/files", %{ + |> post("/api/pleroma/emoji/packs/files?name=test_pack", %{ shortcode: "blank", filename: "dir/blank.png", file: %Plug.Upload{ @@ -101,7 +101,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> post("/api/pleroma/emoji/packs/test_pack/files", %{ + |> post("/api/pleroma/emoji/packs/files?name=test_pack", %{ shortcode: "blank3", filename: "dir/blank.png", file: %Plug.Upload{ @@ -119,7 +119,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> patch("/api/pleroma/emoji/packs/test_pack/files", %{ + |> patch("/api/pleroma/emoji/packs/files?name=test_pack", %{ shortcode: "blank", new_shortcode: "blank2", new_filename: "dir_2/blank_3.png" @@ -135,7 +135,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> post("/api/pleroma/emoji/packs/test_pack/files", %{ + |> post("/api/pleroma/emoji/packs/files?name=test_pack", %{ shortcode: "blank3", filename: "dir/blank.png", file: %Plug.Upload{ @@ -153,7 +153,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> patch("/api/pleroma/emoji/packs/test_pack/files", %{ + |> patch("/api/pleroma/emoji/packs/files?name=test_pack", %{ shortcode: "blank3", new_shortcode: "blank4", new_filename: "dir_2/blank_3.png", @@ -171,7 +171,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do test "with empty filename", %{admin_conn: admin_conn} do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> post("/api/pleroma/emoji/packs/test_pack/files", %{ + |> post("/api/pleroma/emoji/packs/files?name=test_pack", %{ shortcode: "blank2", filename: "", file: %Plug.Upload{ @@ -187,7 +187,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do test "add file with not loaded pack", %{admin_conn: admin_conn} do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> post("/api/pleroma/emoji/packs/not_loaded/files", %{ + |> post("/api/pleroma/emoji/packs/files?name=not_loaded", %{ shortcode: "blank3", filename: "dir/blank.png", file: %Plug.Upload{ @@ -202,7 +202,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do test "remove file with not loaded pack", %{admin_conn: admin_conn} do assert admin_conn - |> delete("/api/pleroma/emoji/packs/not_loaded/files?shortcode=blank3") + |> delete("/api/pleroma/emoji/packs/files?name=not_loaded&shortcode=blank3") |> json_response_and_validate_schema(:not_found) == %{ "error" => "pack \"not_loaded\" is not found" } @@ -210,7 +210,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do test "remove file with empty shortcode", %{admin_conn: admin_conn} do assert admin_conn - |> delete("/api/pleroma/emoji/packs/not_loaded/files?shortcode=") + |> delete("/api/pleroma/emoji/packs/files?name=not_loaded&shortcode=") |> json_response_and_validate_schema(:not_found) == %{ "error" => "pack \"not_loaded\" is not found" } @@ -219,7 +219,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do test "update file with not loaded pack", %{admin_conn: admin_conn} do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> patch("/api/pleroma/emoji/packs/not_loaded/files", %{ + |> patch("/api/pleroma/emoji/packs/files?name=not_loaded", %{ shortcode: "blank4", new_shortcode: "blank3", new_filename: "dir_2/blank_3.png" @@ -232,7 +232,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do test "new with shortcode as file with update", %{admin_conn: admin_conn} do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> post("/api/pleroma/emoji/packs/test_pack/files", %{ + |> post("/api/pleroma/emoji/packs/files?name=test_pack", %{ shortcode: "blank4", filename: "dir/blank.png", file: %Plug.Upload{ @@ -250,7 +250,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> patch("/api/pleroma/emoji/packs/test_pack/files", %{ + |> patch("/api/pleroma/emoji/packs/files?name=test_pack", %{ shortcode: "blank4", new_shortcode: "blank3", new_filename: "dir_2/blank_3.png" @@ -265,7 +265,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do assert File.exists?("#{@emoji_path}/test_pack/dir_2/blank_3.png") assert admin_conn - |> delete("/api/pleroma/emoji/packs/test_pack/files?shortcode=blank3") + |> delete("/api/pleroma/emoji/packs/files?name=test_pack&shortcode=blank3") |> json_response_and_validate_schema(200) == %{ "blank" => "blank.png", "blank2" => "blank2.png" @@ -287,7 +287,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> post("/api/pleroma/emoji/packs/test_pack/files", %{ + |> post("/api/pleroma/emoji/packs/files?name=test_pack", %{ shortcode: "blank_url", file: "https://test-blank/blank_url.png" }) @@ -307,7 +307,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> post("/api/pleroma/emoji/packs/test_pack/files", %{ + |> post("/api/pleroma/emoji/packs/files?name=test_pack", %{ file: %Plug.Upload{ filename: "shortcode.png", path: "#{Pleroma.Config.get([:instance, :static_dir])}/add/shortcode.png" @@ -322,7 +322,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do test "remove non existing shortcode in pack.json", %{admin_conn: admin_conn} do assert admin_conn - |> delete("/api/pleroma/emoji/packs/test_pack/files?shortcode=blank3") + |> delete("/api/pleroma/emoji/packs/files?name=test_pack&shortcode=blank3") |> json_response_and_validate_schema(:bad_request) == %{ "error" => "Emoji \"blank3\" does not exist" } @@ -331,7 +331,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do test "update non existing emoji", %{admin_conn: admin_conn} do assert admin_conn |> put_req_header("content-type", "multipart/form-data") - |> patch("/api/pleroma/emoji/packs/test_pack/files", %{ + |> patch("/api/pleroma/emoji/packs/files?name=test_pack", %{ shortcode: "blank3", new_shortcode: "blank4", new_filename: "dir_2/blank_3.png" @@ -347,7 +347,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do } = admin_conn |> put_req_header("content-type", "multipart/form-data") - |> patch("/api/pleroma/emoji/packs/test_pack/files", %{ + |> patch("/api/pleroma/emoji/packs/files?name=test_pack", %{ shortcode: "blank", new_filename: "dir_2/blank_3.png" }) diff --git a/test/web/pleroma_api/controllers/emoji_pack_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs index a34df2c18..3445f0ca0 100644 --- a/test/web/pleroma_api/controllers/emoji_pack_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs @@ -37,11 +37,11 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do test "GET /api/pleroma/emoji/packs", %{conn: conn} do resp = conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200) - assert resp["count"] == 3 + assert resp["count"] == 4 assert resp["packs"] |> Map.keys() - |> length() == 3 + |> length() == 4 shared = resp["packs"]["test_pack"] assert shared["files"] == %{"blank" => "blank.png", "blank2" => "blank2.png"} @@ -58,7 +58,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do |> get("/api/pleroma/emoji/packs?page_size=1") |> json_response_and_validate_schema(200) - assert resp["count"] == 3 + assert resp["count"] == 4 packs = Map.keys(resp["packs"]) @@ -71,7 +71,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do |> get("/api/pleroma/emoji/packs?page_size=1&page=2") |> json_response_and_validate_schema(200) - assert resp["count"] == 3 + assert resp["count"] == 4 packs = Map.keys(resp["packs"]) assert length(packs) == 1 [pack2] = packs @@ -81,18 +81,28 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do |> get("/api/pleroma/emoji/packs?page_size=1&page=3") |> json_response_and_validate_schema(200) - assert resp["count"] == 3 + assert resp["count"] == 4 packs = Map.keys(resp["packs"]) assert length(packs) == 1 [pack3] = packs - assert [pack1, pack2, pack3] |> Enum.uniq() |> length() == 3 + + resp = + conn + |> get("/api/pleroma/emoji/packs?page_size=1&page=4") + |> json_response_and_validate_schema(200) + + assert resp["count"] == 4 + packs = Map.keys(resp["packs"]) + assert length(packs) == 1 + [pack4] = packs + assert [pack1, pack2, pack3, pack4] |> Enum.uniq() |> length() == 4 end describe "GET /api/pleroma/emoji/packs/remote" do test "shareable instance", %{admin_conn: admin_conn, conn: conn} do resp = conn - |> get("/api/pleroma/emoji/packs") + |> get("/api/pleroma/emoji/packs?page=2&page_size=1") |> json_response_and_validate_schema(200) mock(fn @@ -102,12 +112,12 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} -> json(%{metadata: %{features: ["shareable_emoji_packs"]}}) - %{method: :get, url: "https://example.com/api/pleroma/emoji/packs"} -> + %{method: :get, url: "https://example.com/api/pleroma/emoji/packs?page=2&page_size=1"} -> json(resp) end) assert admin_conn - |> get("/api/pleroma/emoji/packs/remote?url=https://example.com") + |> get("/api/pleroma/emoji/packs/remote?url=https://example.com&page=2&page_size=1") |> json_response_and_validate_schema(200) == resp end @@ -128,11 +138,11 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do end end - describe "GET /api/pleroma/emoji/packs/:name/archive" do + describe "GET /api/pleroma/emoji/packs/archive?name=:name" do test "download shared pack", %{conn: conn} do resp = conn - |> get("/api/pleroma/emoji/packs/test_pack/archive") + |> get("/api/pleroma/emoji/packs/archive?name=test_pack") |> response(200) {:ok, arch} = :zip.unzip(resp, [:memory]) @@ -143,7 +153,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do test "non existing pack", %{conn: conn} do assert conn - |> get("/api/pleroma/emoji/packs/test_pack_for_import/archive") + |> get("/api/pleroma/emoji/packs/archive?name=test_pack_for_import") |> json_response_and_validate_schema(:not_found) == %{ "error" => "Pack test_pack_for_import does not exist" } @@ -151,7 +161,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do test "non downloadable pack", %{conn: conn} do assert conn - |> get("/api/pleroma/emoji/packs/test_pack_nonshared/archive") + |> get("/api/pleroma/emoji/packs/archive?name=test_pack_nonshared") |> json_response_and_validate_schema(:forbidden) == %{ "error" => "Pack test_pack_nonshared cannot be downloaded from this instance, either pack sharing was disabled for this pack or some files are missing" @@ -173,28 +183,28 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do %{ method: :get, - url: "https://example.com/api/pleroma/emoji/packs/test_pack" + url: "https://example.com/api/pleroma/emoji/pack?name=test_pack" } -> conn - |> get("/api/pleroma/emoji/packs/test_pack") + |> get("/api/pleroma/emoji/pack?name=test_pack") |> json_response_and_validate_schema(200) |> json() %{ method: :get, - url: "https://example.com/api/pleroma/emoji/packs/test_pack/archive" + url: "https://example.com/api/pleroma/emoji/packs/archive?name=test_pack" } -> conn - |> get("/api/pleroma/emoji/packs/test_pack/archive") + |> get("/api/pleroma/emoji/packs/archive?name=test_pack") |> response(200) |> text() %{ method: :get, - url: "https://example.com/api/pleroma/emoji/packs/test_pack_nonshared" + url: "https://example.com/api/pleroma/emoji/pack?name=test_pack_nonshared" } -> conn - |> get("/api/pleroma/emoji/packs/test_pack_nonshared") + |> get("/api/pleroma/emoji/pack?name=test_pack_nonshared") |> json_response_and_validate_schema(200) |> json() @@ -218,7 +228,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do assert File.exists?("#{@emoji_path}/test_pack2/blank.png") assert admin_conn - |> delete("/api/pleroma/emoji/packs/test_pack2") + |> delete("/api/pleroma/emoji/pack?name=test_pack2") |> json_response_and_validate_schema(200) == "ok" refute File.exists?("#{@emoji_path}/test_pack2") @@ -239,7 +249,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do assert File.exists?("#{@emoji_path}/test_pack_nonshared2/blank.png") assert admin_conn - |> delete("/api/pleroma/emoji/packs/test_pack_nonshared2") + |> delete("/api/pleroma/emoji/pack?name=test_pack_nonshared2") |> json_response_and_validate_schema(200) == "ok" refute File.exists?("#{@emoji_path}/test_pack_nonshared2") @@ -279,14 +289,14 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do %{ method: :get, - url: "https://example.com/api/pleroma/emoji/packs/pack_bad_sha" + url: "https://example.com/api/pleroma/emoji/pack?name=pack_bad_sha" } -> {:ok, pack} = Pleroma.Emoji.Pack.load_pack("pack_bad_sha") %Tesla.Env{status: 200, body: Jason.encode!(pack)} %{ method: :get, - url: "https://example.com/api/pleroma/emoji/packs/pack_bad_sha/archive" + url: "https://example.com/api/pleroma/emoji/packs/archive?name=pack_bad_sha" } -> %Tesla.Env{ status: 200, @@ -316,7 +326,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do %{ method: :get, - url: "https://example.com/api/pleroma/emoji/packs/test_pack" + url: "https://example.com/api/pleroma/emoji/pack?name=test_pack" } -> {:ok, pack} = Pleroma.Emoji.Pack.load_pack("test_pack") %Tesla.Env{status: 200, body: Jason.encode!(pack)} @@ -336,7 +346,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do end end - describe "PATCH /api/pleroma/emoji/packs/:name" do + describe "PATCH /api/pleroma/emoji/pack?name=:name" do setup do pack_file = "#{@emoji_path}/test_pack/pack.json" original_content = File.read!(pack_file) @@ -358,7 +368,9 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do test "for a pack without a fallback source", ctx do assert ctx[:admin_conn] |> put_req_header("content-type", "multipart/form-data") - |> patch("/api/pleroma/emoji/packs/test_pack", %{"metadata" => ctx[:new_data]}) + |> patch("/api/pleroma/emoji/pack?name=test_pack", %{ + "metadata" => ctx[:new_data] + }) |> json_response_and_validate_schema(200) == ctx[:new_data] assert Jason.decode!(File.read!(ctx[:pack_file]))["pack"] == ctx[:new_data] @@ -384,7 +396,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do assert ctx[:admin_conn] |> put_req_header("content-type", "multipart/form-data") - |> patch("/api/pleroma/emoji/packs/test_pack", %{metadata: new_data}) + |> patch("/api/pleroma/emoji/pack?name=test_pack", %{metadata: new_data}) |> json_response_and_validate_schema(200) == new_data_with_sha assert Jason.decode!(File.read!(ctx[:pack_file]))["pack"] == new_data_with_sha @@ -404,17 +416,17 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do assert ctx[:admin_conn] |> put_req_header("content-type", "multipart/form-data") - |> patch("/api/pleroma/emoji/packs/test_pack", %{metadata: new_data}) + |> patch("/api/pleroma/emoji/pack?name=test_pack", %{metadata: new_data}) |> json_response_and_validate_schema(:bad_request) == %{ "error" => "The fallback archive does not have all files specified in pack.json" } end end - describe "POST/DELETE /api/pleroma/emoji/packs/:name" do + describe "POST/DELETE /api/pleroma/emoji/pack?name=:name" do test "creating and deleting a pack", %{admin_conn: admin_conn} do assert admin_conn - |> post("/api/pleroma/emoji/packs/test_created") + |> post("/api/pleroma/emoji/pack?name=test_created") |> json_response_and_validate_schema(200) == "ok" assert File.exists?("#{@emoji_path}/test_created/pack.json") @@ -426,7 +438,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do } assert admin_conn - |> delete("/api/pleroma/emoji/packs/test_created") + |> delete("/api/pleroma/emoji/pack?name=test_created") |> json_response_and_validate_schema(200) == "ok" refute File.exists?("#{@emoji_path}/test_created/pack.json") @@ -439,7 +451,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do File.write!(Path.join(path, "pack.json"), pack_file) assert admin_conn - |> post("/api/pleroma/emoji/packs/test_created") + |> post("/api/pleroma/emoji/pack?name=test_created") |> json_response_and_validate_schema(:conflict) == %{ "error" => "A pack named \"test_created\" already exists" } @@ -449,7 +461,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do test "with empty name", %{admin_conn: admin_conn} do assert admin_conn - |> post("/api/pleroma/emoji/packs/ ") + |> post("/api/pleroma/emoji/pack?name= ") |> json_response_and_validate_schema(:bad_request) == %{ "error" => "pack name cannot be empty" } @@ -458,7 +470,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do test "deleting nonexisting pack", %{admin_conn: admin_conn} do assert admin_conn - |> delete("/api/pleroma/emoji/packs/non_existing") + |> delete("/api/pleroma/emoji/pack?name=non_existing") |> json_response_and_validate_schema(:not_found) == %{ "error" => "Pack non_existing does not exist" } @@ -466,7 +478,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do test "deleting with empty name", %{admin_conn: admin_conn} do assert admin_conn - |> delete("/api/pleroma/emoji/packs/ ") + |> delete("/api/pleroma/emoji/pack?name= ") |> json_response_and_validate_schema(:bad_request) == %{ "error" => "pack name cannot be empty" } @@ -514,7 +526,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do } end - describe "GET /api/pleroma/emoji/packs/:name" do + describe "GET /api/pleroma/emoji/pack?name=:name" do test "shows pack.json", %{conn: conn} do assert %{ "files" => files, @@ -529,7 +541,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do } } = conn - |> get("/api/pleroma/emoji/packs/test_pack") + |> get("/api/pleroma/emoji/pack?name=test_pack") |> json_response_and_validate_schema(200) assert files == %{"blank" => "blank.png", "blank2" => "blank2.png"} @@ -539,7 +551,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do "files_count" => 2 } = conn - |> get("/api/pleroma/emoji/packs/test_pack?page_size=1") + |> get("/api/pleroma/emoji/pack?name=test_pack&page_size=1") |> json_response_and_validate_schema(200) assert files |> Map.keys() |> length() == 1 @@ -549,15 +561,33 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do "files_count" => 2 } = conn - |> get("/api/pleroma/emoji/packs/test_pack?page_size=1&page=2") + |> get("/api/pleroma/emoji/pack?name=test_pack&page_size=1&page=2") |> json_response_and_validate_schema(200) assert files |> Map.keys() |> length() == 1 end + test "for pack name with special chars", %{conn: conn} do + assert %{ + "files" => _files, + "files_count" => 1, + "pack" => %{ + "can-download" => true, + "description" => "Test description", + "download-sha256" => _, + "homepage" => "https://pleroma.social", + "license" => "Test license", + "share-files" => true + } + } = + conn + |> get("/api/pleroma/emoji/pack?name=blobs.gg") + |> json_response_and_validate_schema(200) + end + test "non existing pack", %{conn: conn} do assert conn - |> get("/api/pleroma/emoji/packs/non_existing") + |> get("/api/pleroma/emoji/pack?name=non_existing") |> json_response_and_validate_schema(:not_found) == %{ "error" => "Pack non_existing does not exist" } @@ -565,7 +595,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do test "error name", %{conn: conn} do assert conn - |> get("/api/pleroma/emoji/packs/ ") + |> get("/api/pleroma/emoji/pack?name= ") |> json_response_and_validate_schema(:bad_request) == %{ "error" => "pack name cannot be empty" } diff --git a/test/web/pleroma_api/controllers/emoji_reaction_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs index 3deab30d1..3deab30d1 100644 --- a/test/web/pleroma_api/controllers/emoji_reaction_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs diff --git a/test/web/pleroma_api/controllers/mascot_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs index e2ead6e15..289119d45 100644 --- a/test/web/pleroma_api/controllers/mascot_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs @@ -24,7 +24,7 @@ defmodule Pleroma.Web.PleromaAPI.MascotControllerTest do assert json_response_and_validate_schema(ret_conn, 415) file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } @@ -34,7 +34,7 @@ defmodule Pleroma.Web.PleromaAPI.MascotControllerTest do |> put_req_header("content-type", "multipart/form-data") |> put("/api/v1/pleroma/mascot", %{"file" => file}) - assert %{"id" => _, "type" => image} = json_response_and_validate_schema(conn, 200) + assert %{"id" => _, "type" => _image} = json_response_and_validate_schema(conn, 200) end test "mascot retrieving" do @@ -48,7 +48,7 @@ defmodule Pleroma.Web.PleromaAPI.MascotControllerTest do # When a user sets their mascot, we should get that back file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } diff --git a/test/web/pleroma_api/controllers/notification_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs index bb4fe6c49..bb4fe6c49 100644 --- a/test/web/pleroma_api/controllers/notification_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs diff --git a/test/web/pleroma_api/controllers/scrobble_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs index f39c07ac6..f39c07ac6 100644 --- a/test/web/pleroma_api/controllers/scrobble_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs diff --git a/test/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs index d23d08a00..22988c881 100644 --- a/test/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Web.PleromaAPI.TwoFactorAuthenticationControllerTest do use Pleroma.Web.ConnCase diff --git a/test/web/pleroma_api/controllers/user_import_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs index 433c97e81..433c97e81 100644 --- a/test/web/pleroma_api/controllers/user_import_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs diff --git a/test/web/pleroma_api/views/chat/message_reference_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs index 40dbae3cd..f171a1e55 100644 --- a/test/web/pleroma_api/views/chat/message_reference_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.PleromaAPI.Chat.MessageReferenceViewTest do +defmodule Pleroma.Web.PleromaAPI.ChatMessageReferenceViewTest do use Pleroma.DataCase alias Pleroma.Chat @@ -19,7 +19,7 @@ defmodule Pleroma.Web.PleromaAPI.Chat.MessageReferenceViewTest do recipient = insert(:user) file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } diff --git a/test/web/pleroma_api/views/chat_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_view_test.exs index 02484b705..02484b705 100644 --- a/test/web/pleroma_api/views/chat_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/chat_view_test.exs diff --git a/test/web/pleroma_api/views/scrobble_view_test.exs b/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs index 6bdb56509..0f43cbdc3 100644 --- a/test/web/pleroma_api/views/scrobble_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.PleromaAPI.StatusViewTest do +defmodule Pleroma.Web.PleromaAPI.ScrobbleViewTest do use Pleroma.DataCase alias Pleroma.Web.PleromaAPI.ScrobbleView diff --git a/test/plugs/admin_secret_authentication_plug_test.exs b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs index 14094eda8..33394722a 100644 --- a/test/plugs/admin_secret_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs @@ -2,16 +2,16 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.AdminSecretAuthenticationPlugTest do +defmodule Pleroma.Web.Plugs.AdminSecretAuthenticationPlugTest do use Pleroma.Web.ConnCase import Mock import Pleroma.Factory - alias Pleroma.Plugs.AdminSecretAuthenticationPlug - alias Pleroma.Plugs.OAuthScopesPlug - alias Pleroma.Plugs.PlugHelper - alias Pleroma.Plugs.RateLimiter + alias Pleroma.Web.Plugs.AdminSecretAuthenticationPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.PlugHelper + alias Pleroma.Web.Plugs.RateLimiter test "does nothing if a user is assigned", %{conn: conn} do user = insert(:user) diff --git a/test/plugs/authentication_plug_test.exs b/test/pleroma/web/plugs/authentication_plug_test.exs index 777ae15ae..af39352e2 100644 --- a/test/plugs/authentication_plug_test.exs +++ b/test/pleroma/web/plugs/authentication_plug_test.exs @@ -2,13 +2,13 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.AuthenticationPlugTest do +defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.AuthenticationPlug - alias Pleroma.Plugs.OAuthScopesPlug - alias Pleroma.Plugs.PlugHelper alias Pleroma.User + alias Pleroma.Web.Plugs.AuthenticationPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.PlugHelper import ExUnit.CaptureLog import Pleroma.Factory @@ -118,7 +118,7 @@ defmodule Pleroma.Plugs.AuthenticationPlugTest do "psBWV8gxkGOZWBz$PmfCycChoxeJ3GgGzwvhlgacb9mUoZ.KUXNCssekER4SJ7bOK53uXrHNb2e4i8yPFgSKyzaW9CcmrDXWIEMtD1" assert capture_log(fn -> - refute Pleroma.Plugs.AuthenticationPlug.checkpw("password", hash) + refute AuthenticationPlug.checkpw("password", hash) end) =~ "[error] Password hash not recognized" end end diff --git a/test/plugs/basic_auth_decoder_plug_test.exs b/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs index a6063d4f6..2d6af228c 100644 --- a/test/plugs/basic_auth_decoder_plug_test.exs +++ b/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs @@ -2,10 +2,10 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.BasicAuthDecoderPlugTest do +defmodule Pleroma.Web.Plugs.BasicAuthDecoderPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.BasicAuthDecoderPlug + alias Pleroma.Web.Plugs.BasicAuthDecoderPlug defp basic_auth_enc(username, password) do "Basic " <> Base.encode64("#{username}:#{password}") diff --git a/test/plugs/cache_control_test.exs b/test/pleroma/web/plugs/cache_control_test.exs index 6b567e81d..fcf3d2be8 100644 --- a/test/plugs/cache_control_test.exs +++ b/test/pleroma/web/plugs/cache_control_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.CacheControlTest do +defmodule Pleroma.Web.Plugs.CacheControlTest do use Pleroma.Web.ConnCase alias Plug.Conn diff --git a/test/plugs/cache_test.exs b/test/pleroma/web/plugs/cache_test.exs index 8b231c881..93a66f5d3 100644 --- a/test/plugs/cache_test.exs +++ b/test/pleroma/web/plugs/cache_test.exs @@ -2,11 +2,11 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.CacheTest do +defmodule Pleroma.Web.Plugs.CacheTest do use ExUnit.Case, async: true use Plug.Test - alias Pleroma.Plugs.Cache + alias Pleroma.Web.Plugs.Cache @miss_resp {200, [ diff --git a/test/plugs/ensure_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs index a0667c5e0..92ff19282 100644 --- a/test/plugs/ensure_authenticated_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs @@ -2,11 +2,11 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.EnsureAuthenticatedPlugTest do +defmodule Pleroma.Web.Plugs.EnsureAuthenticatedPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.EnsureAuthenticatedPlug alias Pleroma.User + alias Pleroma.Web.Plugs.EnsureAuthenticatedPlug describe "without :if_func / :unless_func options" do test "it halts if user is NOT assigned", %{conn: conn} do diff --git a/test/plugs/ensure_public_or_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs index fc2934369..211443a55 100644 --- a/test/plugs/ensure_public_or_authenticated_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs @@ -2,12 +2,12 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.EnsurePublicOrAuthenticatedPlugTest do +defmodule Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlugTest do use Pleroma.Web.ConnCase, async: true alias Pleroma.Config - alias Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug alias Pleroma.User + alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug setup do: clear_config([:instance, :public]) diff --git a/test/plugs/ensure_user_key_plug_test.exs b/test/pleroma/web/plugs/ensure_user_key_plug_test.exs index 633c05447..f912ef755 100644 --- a/test/plugs/ensure_user_key_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_user_key_plug_test.exs @@ -2,10 +2,10 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.EnsureUserKeyPlugTest do +defmodule Pleroma.Web.Plugs.EnsureUserKeyPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.EnsureUserKeyPlug + alias Pleroma.Web.Plugs.EnsureUserKeyPlug test "if the conn has a user key set, it does nothing", %{conn: conn} do conn = diff --git a/test/web/plugs/federating_plug_test.exs b/test/pleroma/web/plugs/federating_plug_test.exs index 2f8aadadc..a4652f6c5 100644 --- a/test/web/plugs/federating_plug_test.exs +++ b/test/pleroma/web/plugs/federating_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.FederatingPlugTest do +defmodule Pleroma.Web.Plugs.FederatingPlugTest do use Pleroma.Web.ConnCase setup do: clear_config([:instance, :federating]) @@ -12,7 +12,7 @@ defmodule Pleroma.Web.FederatingPlugTest do conn = build_conn() - |> Pleroma.Web.FederatingPlug.call(%{}) + |> Pleroma.Web.Plugs.FederatingPlug.call(%{}) assert conn.status == 404 assert conn.halted @@ -23,7 +23,7 @@ defmodule Pleroma.Web.FederatingPlugTest do conn = build_conn() - |> Pleroma.Web.FederatingPlug.call(%{}) + |> Pleroma.Web.Plugs.FederatingPlug.call(%{}) refute conn.status refute conn.halted diff --git a/test/plugs/frontend_static_test.exs b/test/pleroma/web/plugs/frontend_static_plug_test.exs index 6f4923048..f6f7d7bdb 100644 --- a/test/plugs/frontend_static_test.exs +++ b/test/pleroma/web/plugs/frontend_static_plug_test.exs @@ -2,8 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.FrontendStaticPlugTest do - alias Pleroma.Plugs.FrontendStatic +defmodule Pleroma.Web.Plugs.FrontendStaticPlugTest do use Pleroma.Web.ConnCase @dir "test/tmp/instance_static" @@ -21,7 +20,7 @@ defmodule Pleroma.Web.FrontendStaticPlugTest do at: "/admin", frontend_type: :admin ] - |> FrontendStatic.init() + |> Pleroma.Web.Plugs.FrontendStatic.init() assert opts[:at] == ["admin"] assert opts[:frontend_type] == :admin diff --git a/test/plugs/http_security_plug_test.exs b/test/pleroma/web/plugs/http_security_plug_test.exs index 2297e3dac..2297e3dac 100644 --- a/test/plugs/http_security_plug_test.exs +++ b/test/pleroma/web/plugs/http_security_plug_test.exs diff --git a/test/plugs/http_signature_plug_test.exs b/test/pleroma/web/plugs/http_signature_plug_test.exs index e6cbde803..e6cbde803 100644 --- a/test/plugs/http_signature_plug_test.exs +++ b/test/pleroma/web/plugs/http_signature_plug_test.exs diff --git a/test/plugs/idempotency_plug_test.exs b/test/pleroma/web/plugs/idempotency_plug_test.exs index 21fa0fbcf..4a7835993 100644 --- a/test/plugs/idempotency_plug_test.exs +++ b/test/pleroma/web/plugs/idempotency_plug_test.exs @@ -2,11 +2,11 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.IdempotencyPlugTest do +defmodule Pleroma.Web.Plugs.IdempotencyPlugTest do use ExUnit.Case, async: true use Plug.Test - alias Pleroma.Plugs.IdempotencyPlug + alias Pleroma.Web.Plugs.IdempotencyPlug alias Plug.Conn test "returns result from cache" do diff --git a/test/plugs/instance_static_test.exs b/test/pleroma/web/plugs/instance_static_test.exs index d42ba817e..5b30011d3 100644 --- a/test/plugs/instance_static_test.exs +++ b/test/pleroma/web/plugs/instance_static_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.InstanceStaticPlugTest do +defmodule Pleroma.Web.Plugs.InstanceStaticTest do use Pleroma.Web.ConnCase @dir "test/tmp/instance_static" diff --git a/test/plugs/legacy_authentication_plug_test.exs b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs index 3b8c07627..2016a31a8 100644 --- a/test/plugs/legacy_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs @@ -2,15 +2,15 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.LegacyAuthenticationPlugTest do +defmodule Pleroma.Web.Plugs.LegacyAuthenticationPlugTest do use Pleroma.Web.ConnCase import Pleroma.Factory - alias Pleroma.Plugs.LegacyAuthenticationPlug - alias Pleroma.Plugs.OAuthScopesPlug - alias Pleroma.Plugs.PlugHelper alias Pleroma.User + alias Pleroma.Web.Plugs.LegacyAuthenticationPlug + alias Pleroma.Web.Plugs.OAuthScopesPlug + alias Pleroma.Web.Plugs.PlugHelper setup do user = diff --git a/test/plugs/mapped_identity_to_signature_plug_test.exs b/test/pleroma/web/plugs/mapped_signature_to_identity_plug_test.exs index 0ad3c2929..0ad3c2929 100644 --- a/test/plugs/mapped_identity_to_signature_plug_test.exs +++ b/test/pleroma/web/plugs/mapped_signature_to_identity_plug_test.exs diff --git a/test/plugs/oauth_plug_test.exs b/test/pleroma/web/plugs/o_auth_plug_test.exs index 9d39d3153..b9d722f76 100644 --- a/test/plugs/oauth_plug_test.exs +++ b/test/pleroma/web/plugs/o_auth_plug_test.exs @@ -2,10 +2,10 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.OAuthPlugTest do +defmodule Pleroma.Web.Plugs.OAuthPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.OAuthPlug + alias Pleroma.Web.Plugs.OAuthPlug import Pleroma.Factory @session_opts [ diff --git a/test/plugs/oauth_scopes_plug_test.exs b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs index 334316043..982a70bf9 100644 --- a/test/plugs/oauth_scopes_plug_test.exs +++ b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs @@ -2,11 +2,11 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.OAuthScopesPlugTest do +defmodule Pleroma.Web.Plugs.OAuthScopesPlugTest do use Pleroma.Web.ConnCase - alias Pleroma.Plugs.OAuthScopesPlug alias Pleroma.Repo + alias Pleroma.Web.Plugs.OAuthScopesPlug import Mock import Pleroma.Factory diff --git a/test/web/plugs/plug_test.exs b/test/pleroma/web/plugs/plug_helper_test.exs index 943e484e7..670d699f0 100644 --- a/test/web/plugs/plug_test.exs +++ b/test/pleroma/web/plugs/plug_helper_test.exs @@ -2,12 +2,12 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.PlugTest do +defmodule Pleroma.Web.Plugs.PlugHelperTest do @moduledoc "Tests for the functionality added via `use Pleroma.Web, :plug`" - alias Pleroma.Plugs.ExpectAuthenticatedCheckPlug - alias Pleroma.Plugs.ExpectPublicOrAuthenticatedCheckPlug - alias Pleroma.Plugs.PlugHelper + alias Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug + alias Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug + alias Pleroma.Web.Plugs.PlugHelper import Mock diff --git a/test/plugs/rate_limiter_test.exs b/test/pleroma/web/plugs/rate_limiter_test.exs index 4d3d694f4..249c78b37 100644 --- a/test/plugs/rate_limiter_test.exs +++ b/test/pleroma/web/plugs/rate_limiter_test.exs @@ -2,12 +2,12 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.RateLimiterTest do +defmodule Pleroma.Web.Plugs.RateLimiterTest do use Pleroma.Web.ConnCase alias Phoenix.ConnTest alias Pleroma.Config - alias Pleroma.Plugs.RateLimiter + alias Pleroma.Web.Plugs.RateLimiter alias Plug.Conn import Pleroma.Factory @@ -19,7 +19,7 @@ defmodule Pleroma.Plugs.RateLimiterTest do describe "config" do @limiter_name :test_init - setup do: clear_config([Pleroma.Plugs.RemoteIp, :enabled]) + setup do: clear_config([Pleroma.Web.Plugs.RemoteIp, :enabled]) test "config is required for plug to work" do Config.put([:rate_limit, @limiter_name], {1, 1}) diff --git a/test/plugs/remote_ip_test.exs b/test/pleroma/web/plugs/remote_ip_test.exs index 752ab32e7..0bdb4c168 100644 --- a/test/plugs/remote_ip_test.exs +++ b/test/pleroma/web/plugs/remote_ip_test.exs @@ -2,14 +2,28 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.RemoteIpTest do - use ExUnit.Case, async: true +defmodule Pleroma.Web.Plugs.RemoteIpTest do + use ExUnit.Case use Plug.Test - alias Pleroma.Plugs.RemoteIp - - import Pleroma.Tests.Helpers, only: [clear_config: 1, clear_config: 2] - setup do: clear_config(RemoteIp) + alias Pleroma.Web.Plugs.RemoteIp + + import Pleroma.Tests.Helpers, only: [clear_config: 2] + + setup do: + clear_config(RemoteIp, + enabled: true, + headers: ["x-forwarded-for"], + proxies: [], + reserved: [ + "127.0.0.0/8", + "::1/128", + "fc00::/7", + "10.0.0.0/8", + "172.16.0.0/12", + "192.168.0.0/16" + ] + ) test "disabled" do Pleroma.Config.put(RemoteIp, enabled: false) @@ -25,8 +39,6 @@ defmodule Pleroma.Plugs.RemoteIpTest do end test "enabled" do - Pleroma.Config.put(RemoteIp, enabled: true) - conn = conn(:get, "/") |> put_req_header("x-forwarded-for", "1.1.1.1") @@ -54,8 +66,6 @@ defmodule Pleroma.Plugs.RemoteIpTest do end test "custom proxies" do - Pleroma.Config.put(RemoteIp, enabled: true) - conn = conn(:get, "/") |> put_req_header("x-forwarded-for", "173.245.48.1, 1.1.1.1, 173.245.48.2") @@ -72,4 +82,27 @@ defmodule Pleroma.Plugs.RemoteIpTest do assert conn.remote_ip == {1, 1, 1, 1} end + + test "proxies set without CIDR format" do + Pleroma.Config.put([RemoteIp, :proxies], ["173.245.48.1"]) + + conn = + conn(:get, "/") + |> put_req_header("x-forwarded-for", "173.245.48.1, 1.1.1.1") + |> RemoteIp.call(nil) + + assert conn.remote_ip == {1, 1, 1, 1} + end + + test "proxies set `nonsensical` CIDR" do + Pleroma.Config.put([RemoteIp, :reserved], ["127.0.0.0/8"]) + Pleroma.Config.put([RemoteIp, :proxies], ["10.0.0.3/24"]) + + conn = + conn(:get, "/") + |> put_req_header("x-forwarded-for", "10.0.0.3, 1.1.1.1") + |> RemoteIp.call(nil) + + assert conn.remote_ip == {1, 1, 1, 1} + end end diff --git a/test/plugs/session_authentication_plug_test.exs b/test/pleroma/web/plugs/session_authentication_plug_test.exs index 0949ecfed..2b4d5bc0c 100644 --- a/test/plugs/session_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/session_authentication_plug_test.exs @@ -2,11 +2,11 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.SessionAuthenticationPlugTest do +defmodule Pleroma.Web.Plugs.SessionAuthenticationPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.SessionAuthenticationPlug alias Pleroma.User + alias Pleroma.Web.Plugs.SessionAuthenticationPlug setup %{conn: conn} do session_opts = [ diff --git a/test/plugs/set_format_plug_test.exs b/test/pleroma/web/plugs/set_format_plug_test.exs index 7a1dfe9bf..e95d751fa 100644 --- a/test/plugs/set_format_plug_test.exs +++ b/test/pleroma/web/plugs/set_format_plug_test.exs @@ -2,11 +2,11 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.SetFormatPlugTest do +defmodule Pleroma.Web.Plugs.SetFormatPlugTest do use ExUnit.Case, async: true use Plug.Test - alias Pleroma.Plugs.SetFormatPlug + alias Pleroma.Web.Plugs.SetFormatPlug test "set format from params" do conn = diff --git a/test/plugs/set_locale_plug_test.exs b/test/pleroma/web/plugs/set_locale_plug_test.exs index 7114b1557..773f48a5b 100644 --- a/test/plugs/set_locale_plug_test.exs +++ b/test/pleroma/web/plugs/set_locale_plug_test.exs @@ -2,11 +2,11 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.SetLocalePlugTest do +defmodule Pleroma.Web.Plugs.SetLocalePlugTest do use ExUnit.Case, async: true use Plug.Test - alias Pleroma.Plugs.SetLocalePlug + alias Pleroma.Web.Plugs.SetLocalePlug alias Plug.Conn test "default locale is `en`" do diff --git a/test/plugs/set_user_session_id_plug_test.exs b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs index 7f1a1e98b..a89b5628f 100644 --- a/test/plugs/set_user_session_id_plug_test.exs +++ b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs @@ -2,11 +2,11 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.SetUserSessionIdPlugTest do +defmodule Pleroma.Web.Plugs.SetUserSessionIdPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.SetUserSessionIdPlug alias Pleroma.User + alias Pleroma.Web.Plugs.SetUserSessionIdPlug setup %{conn: conn} do session_opts = [ diff --git a/test/plugs/uploaded_media_plug_test.exs b/test/pleroma/web/plugs/uploaded_media_plug_test.exs index 20b13dfac..7c8313121 100644 --- a/test/plugs/uploaded_media_plug_test.exs +++ b/test/pleroma/web/plugs/uploaded_media_plug_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.UploadedMediaPlugTest do +defmodule Pleroma.Web.Plugs.UploadedMediaPlugTest do use Pleroma.Web.ConnCase alias Pleroma.Upload @@ -11,7 +11,7 @@ defmodule Pleroma.Web.UploadedMediaPlugTest do File.cp!("test/fixtures/image.jpg", "test/fixtures/image_tmp.jpg") file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image_tmp.jpg"), filename: "nice_tf.jpg" } diff --git a/test/plugs/user_enabled_plug_test.exs b/test/pleroma/web/plugs/user_enabled_plug_test.exs index b219d8abf..71c56f03a 100644 --- a/test/plugs/user_enabled_plug_test.exs +++ b/test/pleroma/web/plugs/user_enabled_plug_test.exs @@ -2,10 +2,10 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.UserEnabledPlugTest do +defmodule Pleroma.Web.Plugs.UserEnabledPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.UserEnabledPlug + alias Pleroma.Web.Plugs.UserEnabledPlug import Pleroma.Factory setup do: clear_config([:instance, :account_activation_required]) diff --git a/test/plugs/user_fetcher_plug_test.exs b/test/pleroma/web/plugs/user_fetcher_plug_test.exs index 0496f14dd..b4f875d2d 100644 --- a/test/plugs/user_fetcher_plug_test.exs +++ b/test/pleroma/web/plugs/user_fetcher_plug_test.exs @@ -2,10 +2,10 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.UserFetcherPlugTest do +defmodule Pleroma.Web.Plugs.UserFetcherPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.UserFetcherPlug + alias Pleroma.Web.Plugs.UserFetcherPlug import Pleroma.Factory setup do diff --git a/test/plugs/user_is_admin_plug_test.exs b/test/pleroma/web/plugs/user_is_admin_plug_test.exs index 8bc00e444..b550568c1 100644 --- a/test/plugs/user_is_admin_plug_test.exs +++ b/test/pleroma/web/plugs/user_is_admin_plug_test.exs @@ -2,10 +2,10 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Plugs.UserIsAdminPlugTest do +defmodule Pleroma.Web.Plugs.UserIsAdminPlugTest do use Pleroma.Web.ConnCase, async: true - alias Pleroma.Plugs.UserIsAdminPlug + alias Pleroma.Web.Plugs.UserIsAdminPlug import Pleroma.Factory test "accepts a user that is an admin" do diff --git a/test/web/preload/instance_test.exs b/test/pleroma/web/preload/providers/instance_test.exs index a46f28312..8493f2a94 100644 --- a/test/web/preload/instance_test.exs +++ b/test/pleroma/web/preload/providers/instance_test.exs @@ -45,4 +45,12 @@ defmodule Pleroma.Web.Preload.Providers.InstanceTest do assert metadata.private == false assert metadata.suggestions == %{enabled: false} end + + test "it renders the frontend configurations", %{ + "/api/pleroma/frontend_configurations" => fe_configs + } do + assert %{ + pleroma_fe: %{background: "/images/city.jpg", logo: "/static/logo.png"} + } = fe_configs + end end diff --git a/test/web/preload/timeline_test.exs b/test/pleroma/web/preload/providers/timeline_test.exs index 3b1f2f1aa..3b1f2f1aa 100644 --- a/test/web/preload/timeline_test.exs +++ b/test/pleroma/web/preload/providers/timeline_test.exs diff --git a/test/web/preload/user_test.exs b/test/pleroma/web/preload/providers/user_test.exs index 83f065e27..83f065e27 100644 --- a/test/web/preload/user_test.exs +++ b/test/pleroma/web/preload/providers/user_test.exs diff --git a/test/web/push/impl_test.exs b/test/pleroma/web/push/impl_test.exs index c7c17e156..7d8cc999a 100644 --- a/test/web/push/impl_test.exs +++ b/test/pleroma/web/push/impl_test.exs @@ -5,6 +5,8 @@ defmodule Pleroma.Web.Push.ImplTest do use Pleroma.DataCase + import Pleroma.Factory + alias Pleroma.Notification alias Pleroma.Object alias Pleroma.User @@ -12,10 +14,6 @@ defmodule Pleroma.Web.Push.ImplTest do alias Pleroma.Web.CommonAPI alias Pleroma.Web.Push.Impl alias Pleroma.Web.Push.Subscription - alias Pleroma.Web.WebPushHttpClientMock - - import Mock - import Pleroma.Factory setup do Tesla.Mock.mock(fn @@ -80,22 +78,6 @@ defmodule Pleroma.Web.Push.ImplTest do assert Impl.push_message(@message, @sub, @api_key, %Subscription{}) == :ok end - test_with_mock "uses WebPushHttpClientMock as an HTTP client", WebPushHttpClientMock, - post: fn _, _, _ -> {:ok, %{status_code: 200}} end do - Impl.push_message(@message, @sub, @api_key, %Subscription{}) - assert_called(WebPushHttpClientMock.post("https://example.com/example/1234", :_, :_)) - end - - test_with_mock "uses Pleroma.HTTP as an HTTP client", Pleroma.HTTP, - post: fn _, _, _ -> {:ok, %{status_code: 200}} end do - client = Application.get_env(:web_push_encryption, :http_client) - on_exit(fn -> Application.put_env(:web_push_encryption, :http_client, client) end) - Application.put_env(:web_push_encryption, :http_client, Pleroma.HTTP) - - Impl.push_message(@message, @sub, @api_key, %Subscription{}) - assert_called(Pleroma.HTTP.post("https://example.com/example/1234", :_, :_)) - end - @tag capture_log: true test "fail message sending" do assert Impl.push_message( @@ -237,7 +219,7 @@ defmodule Pleroma.Web.Push.ImplTest do recipient = insert(:user) file = %Plug.Upload{ - content_type: "image/jpg", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), filename: "an_image.jpg" } diff --git a/test/web/rel_me_test.exs b/test/pleroma/web/rel_me_test.exs index 65255916d..65255916d 100644 --- a/test/web/rel_me_test.exs +++ b/test/pleroma/web/rel_me_test.exs diff --git a/test/web/rich_media/helpers_test.exs b/test/pleroma/web/rich_media/helpers_test.exs index 8264a9c41..4c9ee77d0 100644 --- a/test/web/rich_media/helpers_test.exs +++ b/test/pleroma/web/rich_media/helpers_test.exs @@ -6,7 +6,6 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do use Pleroma.DataCase alias Pleroma.Config - alias Pleroma.Object alias Pleroma.Web.CommonAPI alias Pleroma.Web.RichMedia.Helpers @@ -64,41 +63,6 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity) end - test "refuses to crawl URLs from posts marked sensitive" do - user = insert(:user) - - {:ok, activity} = - CommonAPI.post(user, %{ - status: "http://example.com/ogp", - sensitive: true - }) - - %Object{} = object = Object.normalize(activity) - - assert object.data["sensitive"] - - Config.put([:rich_media, :enabled], true) - - assert %{} = Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity) - end - - test "refuses to crawl URLs from posts tagged NSFW" do - user = insert(:user) - - {:ok, activity} = - CommonAPI.post(user, %{ - status: "http://example.com/ogp #nsfw" - }) - - %Object{} = object = Object.normalize(activity) - - assert object.data["sensitive"] - - Config.put([:rich_media, :enabled], true) - - assert %{} = Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity) - end - test "refuses to crawl URLs of private network from posts" do user = insert(:user) diff --git a/test/web/rich_media/aws_signed_url_test.exs b/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs index 1ceae1a31..2f17bebd7 100644 --- a/test/web/rich_media/aws_signed_url_test.exs +++ b/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs @@ -2,7 +2,7 @@ # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only -defmodule Pleroma.Web.RichMedia.TTL.AwsSignedUrlTest do +defmodule Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrlTest do use ExUnit.Case, async: true test "s3 signed url is parsed correct for expiration time" do diff --git a/test/web/rich_media/parser_test.exs b/test/pleroma/web/rich_media/parser_test.exs index 6d00c2af5..6d00c2af5 100644 --- a/test/web/rich_media/parser_test.exs +++ b/test/pleroma/web/rich_media/parser_test.exs diff --git a/test/web/rich_media/parsers/twitter_card_test.exs b/test/pleroma/web/rich_media/parsers/twitter_card_test.exs index 219f005a2..219f005a2 100644 --- a/test/web/rich_media/parsers/twitter_card_test.exs +++ b/test/pleroma/web/rich_media/parsers/twitter_card_test.exs diff --git a/test/web/static_fe/static_fe_controller_test.exs b/test/pleroma/web/static_fe/static_fe_controller_test.exs index 1598bf675..f819a1e52 100644 --- a/test/web/static_fe/static_fe_controller_test.exs +++ b/test/pleroma/web/static_fe/static_fe_controller_test.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Web.StaticFE.StaticFEControllerTest do use Pleroma.Web.ConnCase diff --git a/test/web/streamer/streamer_test.exs b/test/pleroma/web/streamer_test.exs index 185724a9f..185724a9f 100644 --- a/test/web/streamer/streamer_test.exs +++ b/test/pleroma/web/streamer_test.exs diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/pleroma/web/twitter_api/controller_test.exs index 464d0ea2e..464d0ea2e 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/pleroma/web/twitter_api/controller_test.exs diff --git a/test/web/twitter_api/password_controller_test.exs b/test/pleroma/web/twitter_api/password_controller_test.exs index a5e9e2178..a5e9e2178 100644 --- a/test/web/twitter_api/password_controller_test.exs +++ b/test/pleroma/web/twitter_api/password_controller_test.exs diff --git a/test/web/twitter_api/remote_follow_controller_test.exs b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs index 3852c7ce9..3852c7ce9 100644 --- a/test/web/twitter_api/remote_follow_controller_test.exs +++ b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs diff --git a/test/web/twitter_api/twitter_api_test.exs b/test/pleroma/web/twitter_api/twitter_api_test.exs index 20a45cb6f..20a45cb6f 100644 --- a/test/web/twitter_api/twitter_api_test.exs +++ b/test/pleroma/web/twitter_api/twitter_api_test.exs diff --git a/test/web/twitter_api/util_controller_test.exs b/test/pleroma/web/twitter_api/util_controller_test.exs index 60f2fb052..60f2fb052 100644 --- a/test/web/twitter_api/util_controller_test.exs +++ b/test/pleroma/web/twitter_api/util_controller_test.exs diff --git a/test/web/uploader_controller_test.exs b/test/pleroma/web/uploader_controller_test.exs index 21e518236..21e518236 100644 --- a/test/web/uploader_controller_test.exs +++ b/test/pleroma/web/uploader_controller_test.exs diff --git a/test/web/views/error_view_test.exs b/test/pleroma/web/views/error_view_test.exs index 8dbbd18b4..8dbbd18b4 100644 --- a/test/web/views/error_view_test.exs +++ b/test/pleroma/web/views/error_view_test.exs diff --git a/test/web/web_finger/web_finger_controller_test.exs b/test/pleroma/web/web_finger/web_finger_controller_test.exs index 0023f1e81..0023f1e81 100644 --- a/test/web/web_finger/web_finger_controller_test.exs +++ b/test/pleroma/web/web_finger/web_finger_controller_test.exs diff --git a/test/web/web_finger/web_finger_test.exs b/test/pleroma/web/web_finger_test.exs index 96fc0bbaa..96fc0bbaa 100644 --- a/test/web/web_finger/web_finger_test.exs +++ b/test/pleroma/web/web_finger_test.exs diff --git a/test/workers/cron/digest_emails_worker_test.exs b/test/pleroma/workers/cron/digest_emails_worker_test.exs index 65887192e..65887192e 100644 --- a/test/workers/cron/digest_emails_worker_test.exs +++ b/test/pleroma/workers/cron/digest_emails_worker_test.exs diff --git a/test/workers/cron/new_users_digest_worker_test.exs b/test/pleroma/workers/cron/new_users_digest_worker_test.exs index 129534cb1..129534cb1 100644 --- a/test/workers/cron/new_users_digest_worker_test.exs +++ b/test/pleroma/workers/cron/new_users_digest_worker_test.exs diff --git a/test/workers/purge_expired_activity_test.exs b/test/pleroma/workers/purge_expired_activity_test.exs index b5938776d..b5938776d 100644 --- a/test/workers/purge_expired_activity_test.exs +++ b/test/pleroma/workers/purge_expired_activity_test.exs diff --git a/test/workers/purge_expired_token_test.exs b/test/pleroma/workers/purge_expired_token_test.exs index fb7708c3f..fb7708c3f 100644 --- a/test/workers/purge_expired_token_test.exs +++ b/test/pleroma/workers/purge_expired_token_test.exs diff --git a/test/workers/scheduled_activity_worker_test.exs b/test/pleroma/workers/scheduled_activity_worker_test.exs index f3eddf7b1..f3eddf7b1 100644 --- a/test/workers/scheduled_activity_worker_test.exs +++ b/test/pleroma/workers/scheduled_activity_worker_test.exs diff --git a/test/xml_builder_test.exs b/test/pleroma/xml_builder_test.exs index 059384c34..059384c34 100644 --- a/test/xml_builder_test.exs +++ b/test/pleroma/xml_builder_test.exs diff --git a/test/support/captcha_mock.ex b/test/support/captcha/mock.ex index 2ed2ba3b4..2ed2ba3b4 100644 --- a/test/support/captcha_mock.ex +++ b/test/support/captcha/mock.ex diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex index d63a0f06b..114184a9f 100644 --- a/test/support/channel_case.ex +++ b/test/support/channel_case.ex @@ -22,7 +22,7 @@ defmodule Pleroma.Web.ChannelCase do using do quote do # Import conveniences for testing with channels - use Phoenix.ChannelTest + import Phoenix.ChannelTest use Pleroma.Tests.Helpers # The default endpoint for testing diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index 7ef681258..9316a82e4 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -22,7 +22,8 @@ defmodule Pleroma.Web.ConnCase do using do quote do # Import conveniences for testing with connections - use Phoenix.ConnTest + import Plug.Conn + import Phoenix.ConnTest use Pleroma.Tests.Helpers import Pleroma.Web.Router.Helpers diff --git a/test/support/factory.ex b/test/support/factory.ex index fb82be0c4..80b882ee4 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -31,7 +31,7 @@ defmodule Pleroma.Factory do nickname: sequence(:nickname, &"nick#{&1}"), password_hash: Pbkdf2.hash_pwd_salt("test"), bio: sequence(:bio, &"Tester Number #{&1}"), - discoverable: true, + is_discoverable: true, last_digest_emailed_at: NaiveDateTime.utc_now(), last_refreshed_at: NaiveDateTime.utc_now(), notification_settings: %Pleroma.User.NotificationSetting{}, diff --git a/test/support/web_push_http_client_mock.ex b/test/support/web_push_http_client_mock.ex deleted file mode 100644 index 3cd12957d..000000000 --- a/test/support/web_push_http_client_mock.ex +++ /dev/null @@ -1,23 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Web.WebPushHttpClientMock do - def get(url, headers \\ [], options \\ []) do - { - res, - %Tesla.Env{status: status} - } = Pleroma.HTTP.request(:get, url, "", headers, options) - - {res, %{status_code: status}} - end - - def post(url, body, headers \\ [], options \\ []) do - { - res, - %Tesla.Env{status: status} - } = Pleroma.HTTP.request(:post, url, body, headers, options) - - {res, %{status_code: status}} - end -end |