From: Tom Hughes Date: Thu, 16 Mar 2017 19:02:35 +0000 (+0000) Subject: Merge remote-tracking branch 'openstreetmap/pull/1492' X-Git-Tag: live~4038 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/834a821d3cc6cbcbc5f267799ede419047740854?hp=6331e346384d3cc2639aaeec35eaa10a26f7ddf6 Merge remote-tracking branch 'openstreetmap/pull/1492' --- diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 68a7566d9..5b6145de3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -64,7 +64,7 @@ Metrics/BlockNesting: # Offense count: 62 # Configuration parameters: CountComments. Metrics/ClassLength: - Max: 1660 + Max: 1665 # Offense count: 69 Metrics/CyclomaticComplexity: diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 3e5241688..099cf7a5d 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -109,6 +109,8 @@ bg: relation_paginated: Релации(%{x}-%{y} от %{count}) comment: Коментари (%{count}) osmchangexml: osmChange XML + feed: + title: Списък с промени %{id} join_discussion: Впишете се, за да се присъедините към обсъждането discussion: Обсъждане node: @@ -126,6 +128,7 @@ bg: history_title: 'Историята на релация: %{name}' members: Членове relation_member: + entry_role: '%{type} %{name} като %{role}' type: node: Възел way: Път @@ -176,6 +179,7 @@ bg: changeset: anonymous: Анонимен no_edits: (без промяна) + view_changeset_details: Подробности за списъка с промени changesets: id: Номер saved_at: Записан на @@ -194,6 +198,7 @@ bg: full: Пълно обсъждане diary_entry: new: + title: Нов запис в дневника publish_button: Публикуване list: title: Дневници на потребителите @@ -241,6 +246,7 @@ bg: view: Преглед edit: Редактиране comments: + post: Публикация when: Кога comment: Коментар ago: преди %{ago} @@ -257,6 +263,8 @@ bg: too_large: advice: 'Ако изнасянето по-горе не сработи, моля, използвайте един от следните източници:' + planet: + title: Planet OSM overpass: title: Overpass API other: @@ -270,6 +278,7 @@ bg: add_marker: Добавяне на маркер на картата latitude: 'Геогр. шир:' longitude: 'Геогр. дълж:' + output: Изход export_button: Изнасяне geocoder: search: @@ -303,6 +312,7 @@ bg: bbq: Барбекю bench: Пейка bicycle_parking: Паркинг за велосипеди + bicycle_rental: Велосипеди под наем bureau_de_change: Обменно бюро bus_station: Автобусна спирка cafe: Кафене @@ -323,10 +333,12 @@ bg: embassy: Посолство emergency_phone: Телефон за спешни повиквания fast_food: Заведения за бързо хранене + ferry_terminal: Фериботен терминал fire_hydrant: Пожарен кран fire_station: Пожарна станция fountain: Фонтан fuel: Гориво + gambling: Хазартни игри grave_yard: Гробище gym: Фитнес зала hospital: Болница @@ -349,6 +361,7 @@ bg: public_building: Обществена сграда reception_area: Рецепция restaurant: Ресторант + retirement_home: Старчески дом sauna: Сауна school: Училище shelter: Подслон @@ -365,6 +378,7 @@ bg: vending_machine: Автомат veterinary: Ветеринарна клиника village_hall: Кметство + waste_basket: Кошче за боклук youth_centre: Младежки център boundary: administrative: Административна граница @@ -390,6 +404,7 @@ bg: "yes": Работилница emergency: ambulance_station: Пожарна + defibrillator: Дефибрилатор landing_site: Място за аварийно кацане phone: Телефон за спешни повиквания highway: @@ -449,8 +464,11 @@ bg: stone: Камък tomb: Гробница tower: Кула + wreck: Потънал кораб landuse: + allotments: Градини basin: Басейн + brownfield: Място за строеж cemetery: Гробище commercial: Търговска зона conservation: Резерват @@ -477,6 +495,7 @@ bg: club: Клуб dog_park: Парк за кучета fishing: Място за риболов + fitness_centre: Фитнес център garden: Градина golf_course: Игрище за голф horse_riding: Конна езда @@ -537,11 +556,14 @@ bg: architect: Архитект company: Фирма employment_agency: Агенцията по заетостта + estate_agent: Агент по недвижими имоти insurance: Застрахователно бюро lawyer: Адвокат + ngo: Офис на НПО travel_agent: Туристическа агенция "yes": Офис place: + allotments: Градини airport: Летище city: Град country: Страна @@ -558,6 +580,7 @@ bg: postcode: Пощенски код region: Регион sea: Море + state: Държава suburb: Предградие town: Град village: Село @@ -566,7 +589,7 @@ bg: abandoned: Изоставена железопътна линия construction: Железопътна линия в строеж disused_station: изоставена гара - halt: железопътна спирка + halt: Железопътна спирка historic_station: Гара с историческо значение junction: Железопътен възел level_crossing: Прелез @@ -598,6 +621,7 @@ bg: department_store: Универсален магазин dry_cleaning: Химическо чистене fish: Рибен магазин + florist: Цветарски магазин food: Хранителни стоки furniture: Мебели gallery: Галерия @@ -650,6 +674,7 @@ bg: waterfall: Водопад admin_levels: level2: Държавна граница + level4: Държавна граница level5: Граница на региона level6: Държавна граница level8: Граница на града @@ -713,6 +738,8 @@ bg: title: Правилата! questions: title: Въпроси? + add_a_note: + title: Нямате време за редактиране? Добавете бележка! fixthemap: how_to_help: title: Как да помогна @@ -721,6 +748,8 @@ bg: title: Добре дошли в OSM beginners_guide: title: Наръчник за начинаещи + help: + url: https://help.openstreetmap.org/ mailing_lists: title: Пощенски списъци forums: @@ -740,6 +769,8 @@ bg: hi: Здравейте %{to_user}, message_notification: hi: Здравейте %{to_user}, + friend_notification: + hi: Здравейте %{to_user}, gpx_notification: greeting: Здравейте, your_gpx_file: Това изглежда като GPX файла Ви @@ -795,6 +826,7 @@ bg: delete_button: Изтрий new: title: Изпратете съобщение + send_message_to: Изпратете ново съобщение на %{name} subject: Тема send_button: Изпращане message_sent: Съобщението е изпратено @@ -803,6 +835,8 @@ bg: heading: Няма такова съобщение outbox: title: Изпратени + my_inbox: Моят %{inbox_link} + inbox: входящи messages: one: Вие имате %{count} изпратено съобщение other: Вие имате %{count} изпратени съобщения @@ -810,6 +844,7 @@ bg: subject: Тема date: Дата read: + title: Прочетете съобщението from: От subject: Тема date: Дата @@ -819,6 +854,8 @@ bg: to: До sent_message_summary: delete_button: Изтриване + delete: + deleted: Съобщението беше изтрито site: index: createnote: Добавяне на бележка @@ -844,7 +881,7 @@ bg: bridleway: Конен път cycleway: Велосипедна пътека footway: Пътека - rail: Железопът + rail: Железен път subway: Метро tram: - Бърз трамвай @@ -873,13 +910,16 @@ bg: lake: - Езеро farm: Земеделско стопанство + brownfield: Място за строеж cemetery: Гробище + allotments: Градини pitch: Спортна площадка centre: Спортен център reserve: Природен резерват military: Военна зона school: - Училище + - университет building: Значима сграда station: Железопътна гара summit: @@ -889,6 +929,7 @@ bg: bridge: Мост (плътна линия) construction: Пътища в изграждане bicycle_shop: Магазин за велосипеди + toilets: Тоалетни richtext_area: edit: Редактиране preview: Преглед @@ -898,6 +939,8 @@ bg: subheading: Подзаглавие unordered: Неподреден списък ordered: Подреден списък + first: Първа точка + second: Втора точка link: Препратка text: Текст image: Изображение @@ -906,17 +949,22 @@ bg: trace: edit: filename: 'Име на файл:' + download: сваляне + uploaded_at: 'Качени:' map: карта edit: редактиране owner: 'Собственик:' description: 'Описание:' tags: 'Етикети:' + tags_help: разделени със запетая save_button: Съхраняване на промените visibility: 'Видимост:' trace_form: + upload_gpx: 'Качване на GPX файл:' description: 'Описание:' tags: 'Етикети:' visibility: 'Видимост:' + visibility_help: какво означава това? upload_button: Качване help: Помощ trace_header: @@ -961,6 +1009,9 @@ bg: submit: Редактиране show: allow_write_api: промяна на картата. + index: + title: Моите данни за OAuth + my_apps: Моите клиентски приложения form: name: Име allow_write_api: промяна на картата. @@ -980,16 +1031,35 @@ bg: title: Вписване с Гугъл facebook: title: Вписване с Фейсбук + github: + title: Вход чрез GitHub + alt: Вход чрез профила ви в GitHub wikipedia: title: Вписване с Уикипедия alt: Вписване със сметка от Уикипедия yahoo: title: Вписване с Яху + alt: Вход чрез OpenID Yahoo wordpress: title: Вписване с Уърдпрес + alt: Вход чрез OpenID Wordpress + aol: + title: Вход чрез AOL + alt: Вход чрез AOL OpenID + logout: + title: Изход + heading: Изход от OpenStreetMap + logout_button: Изход lost_password: + title: Възстановяване на парола + heading: Забравена парола? email address: 'Електронна поща:' + new password button: Нова парола + help_text: Въведете имейл адреса, който сте използвали при регистрацията, и + ние ще Ви изпратим връзка, която можете да използвате, за да промените паролата + си. reset_password: + title: Нова парола password: 'Парола:' confirm password: 'Потвърждаване на паролата:' flash changed: Паролата е променена успешно. @@ -1003,7 +1073,14 @@ bg: password: 'Парола:' confirm password: 'Потвърждаване на паролата:' continue: Регистриране + terms accepted: Благодарим Ви за приемането на новите Условия за участие! terms: + heading: Условия за участие + consider_pd_why: какво е това? + agree: Съгласен + decline: Отхвърли + you need to accept or decline: Моля, прочетете, а след това или се съгласете + или откажете новите Условия за участие, за да продължите. legale_select: 'Държава на пребиваване:' legale_names: france: Франция @@ -1015,6 +1092,7 @@ bg: view: my edits: Mоите редакции my traces: Моите следи + my notes: Моите бележки my messages: Съобщения my profile: Профил my settings: Настройки @@ -1024,11 +1102,15 @@ bg: edits: Редакции traces: Следи notes: Бележки + add as friend: Добави като приятел mapper since: 'Картограф от:' + ct status: 'Условия за участие:' latest edit: 'Последна редакция %{ago}:' email address: 'Електронна поща:' + created from: 'Създадено от:' description: Описание user location: Местоположение + settings_link_text: настройки your friends: Вашите приятели no friends: Все още нямате добавени приятели. km away: '%{count} км от вас' @@ -1048,7 +1130,9 @@ bg: enabled: Разрешено. Не е анонимно и можете да редактирате данните. enabled link text: Какво е това? contributor terms: + heading: 'Условия за участие:' agreed: Вие се съгласихте с новите условия за участие. + not yet agreed: Все още не сте се съгласили с новите Условия за участие. link text: Какво е това? profile description: 'Описание на профила:' preferred languages: 'Предпочитани езици:' @@ -1123,7 +1207,7 @@ bg: locate: title: Моето местоположение base: - standard: Стандартен + standard: Стандартна карта cycle_map: Колоездачна карта transport_map: Превозна карта hot: Хуманитарна карта diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 1e8c8e2d1..a56fd0d35 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -1,6 +1,7 @@ # Messages for Hungarian (magyar) # Exported from translatewiki.net # Export driver: phpyaml +# Author: Athoss # Author: BanKris # Author: BáthoryPéter # Author: City-busz @@ -1096,6 +1097,10 @@ hu: folyamat leírását vagy jelentsd be közvetlenül az online bejelentő oldalon. trademarks_title_html: Védjegyek + trademarks_1_html: OpenStreetMap, a nagyító ikon és a State of the Map az OpenStreetMap + Foundation bejegyzett védjegyei. Ha kérdése van ezek felhasználásával kapcsolatban, + kérem küldje el a kérdéseit a Licence + Working Group részére. welcome_page: title: Üdvözlet! introduction_html: Üdvözöl az OpenStreetMap - a szabad és szerkeszthető világtérkép @@ -1177,6 +1182,8 @@ hu: title: Fórumok irc: title: IRC + switch2osm: + title: válts osm-re wiki: url: https://wiki.openstreetmap.org/wiki/Hu:Main_Page title: wiki.openstreetmap.org @@ -1307,7 +1314,7 @@ hu: old_messages: one: egy régi üzeneted other: '%{count} régi üzeneted' - from: Feladó + from: Innen subject: Tárgy date: Érkezett no_messages_yet: Nincs még üzeneted. Miért nem veszed fel a kapcsolatot néhány @@ -1340,7 +1347,7 @@ hu: messages: one: Egy elküldött üzeneted van other: '%{count} elküldött üzeneted van' - to: Címzett + to: Ide subject: Tárgy date: Elküldve no_sent_messages: Nincs még elküldött üzeneted. Miért nem veszed fel a kapcsolatot @@ -1352,13 +1359,13 @@ hu: jelentkezz be a helyes felhasználóval. read: title: Üzenet olvasása - from: Feladó + from: Innen subject: Tárgy date: Érkezett reply_button: Válasz unread_button: Jelölés olvasatlanként back: Vissza - to: Címzett + to: Ide wrong_user: „%{user}” néven jelentkeztél be, de a levelet, amit lekérdeztél olvasásra, nem ez a felhasználó küldte vagy kapta. Annak érdekében, hogy elolvashasd a levelet, jelentkezz be a helyes felhasználóval. @@ -1408,8 +1415,8 @@ hu: search: Keresés get_directions: Útvonalterv get_directions_title: Útirány keresése két pont között - from: Feladó - to: Címzett + from: Innen + to: Ide where_am_i: Hol vagyok? where_am_i_title: A jelenlegi helyszín leírása a keresőmotor segítségével submit_text: Menj @@ -2330,6 +2337,8 @@ hu: error: 'Hiba a %{server} szerverhez való kapcsolódáshoz: %{error}' timeout: Időtúllépés a %{server}szerverhez kapcsolódás során context: + directions_from: Útvonaltervezés innen + directions_to: Útvonaltervezés ide add_note: Jegyzet hozzáadása itt show_address: Cím megjelenítése query_features: Lekérdezési funkciók diff --git a/config/locales/ko.yml b/config/locales/ko.yml index b8087b851..bb344648f 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -1640,6 +1640,8 @@ ko: require_moderator: not_a_moderator: 해당 동작을 수행하려면 운영자 권한이 필요합니다. setup_user_auth: + blocked_zero_hour: OpenStreetMap 웹 사이트에 긴급 메시지가 있습니다. 편집을 저장하기 전에 이 메시지를 읽어야 + 합니다. blocked: API에 대한 접근을 차단했습니다. 자세한 내용을 알아보려면 웹 인터페이스에 로그인하세요. need_to_see_terms: API에 대한 접근을 일시적으로 중지했습니다. 기여자 약관을 보려면 웹 인터페이스에 로그인하세요. 기여자 약관에 동의할 필요는 없습니다만 기여자 약관을 보아야 합니다. @@ -2331,9 +2333,12 @@ ko: error: '%{server} 연결에 오류: %{error}' timeout: '%{server} 연결에 시간 초과' context: - add_note: 여기에 설명 추가 + directions_from: 여기를 출발 지점으로 지정 + directions_to: 여기를 도착 지점으로 지정 + add_note: 여기에 참고 추가하기 show_address: 주소 보기 - query_features: 의문 지물 + query_features: 이 지형지물 보기 + centre_map: 여기를 정중앙으로 지정 redaction: edit: description: 설명 diff --git a/config/locales/ro.yml b/config/locales/ro.yml index 0b68f9c99..8510a3c45 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -259,6 +259,7 @@ ro: diary_entry: new: title: O nouă înregistrare în jurnal + publish_button: Publică list: title: Jurnalele utilizatorilor title_friends: Jurnalele prietenilor @@ -710,6 +711,7 @@ ro: clothes: Magazin de haine confectionery: Cofetărie cosmetics: Magazin de cosmetice + deli: Deli dry_cleaning: Curățătorie chimică electronics: Magazin de electronice estate_agent: Agent imobiliar @@ -787,6 +789,10 @@ ro: edit: Modificare history: Istoric export: Exportă + data: Date + export_data: Exportă datele + gps_traces: Track-uri GPS + user_diaries: Jurnalele utilizatorilor edit_with: Modificare cu %{editor} intro_header: Bine ați venit la OpenStreetMap! partners_partners: parteneri @@ -811,12 +817,14 @@ ro: legal_babble: title_html: Drepturi de autor și licență infringement_title_html: Încălcarea drepturilor de autor + trademarks_title_html: Mărci înregistrate welcome_page: title: Bun venit! rules: title: Reguli questions: title: Întrebări? + start_mapping: Începeți să cartografiați fixthemap: how_to_help: join_the_community: @@ -840,14 +848,22 @@ ro: note_comment_notification: greeting: Salut, changeset_comment_notification: + hi: Salut %{to_user}, greeting: Salut, + commented: + partial_changeset_without_comment: fără comentarii message: inbox: + title: Mesaje primite from: De la + subject: Subiect + date: Dată message_summary: delete_button: Şterge new: subject: Subiect + send_button: Trimite + back_to_inbox: Înapoi la mesaje primite message_sent: Mesaj trimis outbox: title: Mesaje trimise @@ -867,6 +883,7 @@ ro: date: Dată reply_button: Răspunde unread_button: Marchează ca necitit + back: Înapoi to: Către sent_message_summary: delete_button: Şterge @@ -876,15 +893,26 @@ ro: index: permalink: Legătură permanentă shortlink: Legătură scurtată + createnote: Adaugă o notă edit: user_page_link: pagină de utilizator sidebar: close: Închide search: + search: Căutare from: De la to: Către where_am_i: Unde sunt eu? where_am_i_title: Descrie locaţia curentă folosind motorul de căutare + key: + table: + entry: + tram: + 1: tramvai + apron: + 1: terminal + markdown_help: + title_html: Parsat cu Markdown trace: edit: visibility: 'Vizibilitate:' diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 0f4c66664..f4dbf0c24 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -1383,10 +1383,10 @@ ru: пакетов правок' subject_other: '[OpenStreetMap] %{commenter} прокомментировал пакет правок, который вас интересует' - your_changeset: '%{commenter} оставил комментарий на один из ваших пакетов - правок, созданный %{time}' - commented_changeset: '%{commenter} оставил комментарий к пакету правок, который - вы отслеживаете и созданный %{changeset_author} %{time}' + your_changeset: '%{commenter} оставил комментарий %{time} к одному из ваших + пакетов правок' + commented_changeset: '%{commenter} оставил комментарий к пакету правок, созданному + %{changeset_author} %{time}, и который вы отслеживаете' partial_changeset_with_comment: с комментарием '%{changeset_comment}' partial_changeset_without_comment: без комментария details: Дополнительные сведения о пакете правок можно найти на %{url}. diff --git a/config/locales/uk.yml b/config/locales/uk.yml index e7d281fea..e65465b9d 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -673,7 +673,7 @@ uk: dog_park: Майданчик для собак fishing: Район риболовлі fitness_centre: Фітнес-центр - fitness_station: Фітнес-центр + fitness_station: Тренажери garden: Сад golf_course: Поле для гольфу horse_riding: Верхова їзда @@ -1354,8 +1354,8 @@ uk: details: |2- Більше деталей про зміни, які можуть бути знайдені в %{url}. - unsubscribe: Щоб відписатися від оновлень за цим набором змін, перейдіть за - посиланням %{url} й натисніть кнопку „Відписатись“. + unsubscribe: Щоб відмовитись від отримання повідомлень для цього набору змін, + перейдіть за посиланням %{url} й натисніть кнопку „Відписатись“. message: inbox: title: Вхідні @@ -1865,8 +1865,8 @@ uk: title: Реєстрація no_auto_account_create: На жаль, ми в даний час не в змозі створити для вас обліковий запис автоматично. - contact_webmaster: Будь-ласка, зверніться до вебмастера - з проханням створити подібний обліковий запис. Ми спробуємо це зробити і + contact_webmaster: Будь ласка, зверніться до вебмайстра + з проханням створити подібний обліковий запис. Ми спробуємо це зробити та відповісти настільки швидко, наскільки це можливо. about: header: Вільні й доступні для редагування diff --git a/test/controllers/changeset_controller_test.rb b/test/controllers/changeset_controller_test.rb index ca2ff8e15..9d39a8555 100644 --- a/test/controllers/changeset_controller_test.rb +++ b/test/controllers/changeset_controller_test.rb @@ -98,7 +98,7 @@ class ChangesetControllerTest < ActionController::TestCase # ----------------------- def test_create - basic_authorization users(:normal_user).email, "test" + basic_authorization create(:user, :data_public => false).email, "test" # Create the first user's changeset content "" + "" + @@ -106,7 +106,7 @@ class ChangesetControllerTest < ActionController::TestCase put :create assert_require_public_data - basic_authorization users(:public_user).email, "test" + basic_authorization create(:user).email, "test" # Create the first user's changeset content "" + "" + @@ -133,13 +133,13 @@ class ChangesetControllerTest < ActionController::TestCase end def test_create_invalid - basic_authorization users(:normal_user).email, "test" + basic_authorization create(:user, :data_public => false).email, "test" content "" put :create assert_require_public_data ## Try the public user - basic_authorization users(:public_user).email, "test" + basic_authorization create(:user).email, "test" content "" put :create assert_response :bad_request, "creating a invalid changeset should fail" @@ -150,24 +150,24 @@ class ChangesetControllerTest < ActionController::TestCase put :create assert_response :unauthorized, "shouldn't be able to create a changeset with no auth" - ## Now try to with the non-public user - basic_authorization users(:normal_user).email, "test" + ## Now try to with a non-public user + basic_authorization create(:user, :data_public => false).email, "test" put :create assert_require_public_data - ## Try the inactive user - basic_authorization users(:inactive_user).email, "test" + ## Try an inactive user + basic_authorization create(:user, :pending).email, "test" put :create assert_inactive_user - ## Now try to use the public user - basic_authorization users(:public_user).email, "test" + ## Now try to use a normal user + basic_authorization create(:user).email, "test" put :create assert_response :bad_request, "creating a changeset with no content should fail" end def test_create_wrong_method - basic_authorization users(:public_user).email, "test" + basic_authorization create(:user).email, "test" get :create assert_response :method_not_allowed post :create @@ -228,12 +228,12 @@ class ChangesetControllerTest < ActionController::TestCase assert_response :unauthorized ## Try using the non-public user - basic_authorization users(:normal_user).email, "test" + basic_authorization changesets(:normal_user_first_change).user.email, "test" put :close, :id => changesets(:normal_user_first_change).id assert_require_public_data ## The try with the public user - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" cs_id = changesets(:public_user_first_change).id put :close, :id => cs_id @@ -248,7 +248,7 @@ class ChangesetControllerTest < ActionController::TestCase ## # test that a different user can't close another user's changeset def test_close_invalid - basic_authorization users(:public_user).email, "test" + basic_authorization create(:user).email, "test" put :close, :id => changesets(:normal_user_first_change).id assert_response :conflict @@ -258,7 +258,7 @@ class ChangesetControllerTest < ActionController::TestCase ## # test that you can't close using another method def test_close_method_invalid - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" cs_id = changesets(:public_user_first_change).id get :close, :id => cs_id @@ -284,7 +284,7 @@ class ChangesetControllerTest < ActionController::TestCase end # Now try with auth - basic_authorization users(:public_user).email, "test" + basic_authorization create(:user).email, "test" cs_ids.each do |id| begin put :close, :id => id @@ -330,7 +330,7 @@ EOF "shouldnn't be able to upload a simple valid diff to changeset: #{@response.body}" ## Now try with a private user - basic_authorization users(:normal_user).email, "test" + basic_authorization changesets(:normal_user_first_change).user.email, "test" changeset_id = changesets(:normal_user_first_change).id # simple diff to change a node, way and relation by removing @@ -360,7 +360,7 @@ EOF "can't upload a simple valid diff to changeset: #{@response.body}" ## Now try with the public user - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" changeset_id = changesets(:public_user_first_change).id # simple diff to change a node, way and relation by removing @@ -398,7 +398,7 @@ EOF ## # upload something which creates new objects using placeholders def test_upload_create_valid - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" cs_id = changesets(:public_user_first_change).id # simple diff to create a node way and relation using placeholders @@ -461,7 +461,7 @@ EOF # test a complex delete where we delete elements which rely on eachother # in the same transaction. def test_upload_delete - basic_authorization users(:public_user).display_name, "test" + basic_authorization changesets(:public_user_first_change).user.display_name, "test" diff = XML::Document.new diff.root = XML::Node.new "osmChange" @@ -502,7 +502,7 @@ EOF # test uploading a delete with no lat/lon, as they are optional in # the osmChange spec. def test_upload_nolatlon_delete - basic_authorization users(:public_user).display_name, "test" + basic_authorization changesets(:public_user_first_change).user.display_name, "test" node = current_nodes(:public_visible_node) cs = changesets(:public_user_first_change) @@ -523,7 +523,7 @@ EOF def test_repeated_changeset_create 30.times do - basic_authorization users(:public_user).email, "test" + basic_authorization create(:user).email, "test" # create a temporary changeset content "" + @@ -537,7 +537,7 @@ EOF end def test_upload_large_changeset - basic_authorization users(:public_user).email, "test" + basic_authorization create(:user).email, "test" # create a changeset content "" @@ -591,7 +591,8 @@ EOF # test that deleting stuff in a transaction doesn't bypass the checks # to ensure that used elements are not deleted. def test_upload_delete_invalid - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" + cs = changesets(:public_user_first_change) diff = XML::Document.new diff.root = XML::Node.new "osmChange" @@ -603,7 +604,7 @@ EOF # upload it content diff - post :upload, :id => 2 + post :upload, :id => cs.id assert_response :precondition_failed, "shouldn't be able to upload a invalid deletion diff: #{@response.body}" assert_equal "Precondition failed: Way 3 is still used by relations 1.", @response.body @@ -617,7 +618,8 @@ EOF ## # test that a conditional delete of an in use object works. def test_upload_delete_if_unused - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" + cs = changesets(:public_user_first_change) diff = XML::Document.new diff.root = XML::Node.new "osmChange" @@ -630,7 +632,7 @@ EOF # upload it content diff - post :upload, :id => 2 + post :upload, :id => cs.id assert_response :success, "can't do a conditional delete of in use objects: #{@response.body}" @@ -667,7 +669,7 @@ EOF ## # upload an element with a really long tag value def test_upload_invalid_too_long_tag - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" cs_id = changesets(:public_user_first_change).id # simple diff to create a node way and relation using placeholders @@ -692,7 +694,7 @@ EOF # upload something which creates new objects and inserts them into # existing containers using placeholders. def test_upload_complex - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" cs_id = changesets(:public_user_first_change).id # simple diff to create a node way and relation using placeholders @@ -748,7 +750,7 @@ EOF # create a diff which references several changesets, which should cause # a rollback and none of the diff gets committed def test_upload_invalid_changesets - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" cs_id = changesets(:public_user_first_change).id # simple diff to create a node way and relation using placeholders @@ -795,7 +797,7 @@ EOF ## # upload multiple versions of the same element in the same diff. def test_upload_multiple_valid - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" cs_id = changesets(:public_user_first_change).id # change the location of a node multiple times, each time referencing @@ -832,7 +834,7 @@ EOF # upload multiple versions of the same element in the same diff, but # keep the version numbers the same. def test_upload_multiple_duplicate - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" cs_id = changesets(:public_user_first_change).id diff = <" + "" + @@ -1137,7 +1139,7 @@ EOF ## # test what happens if a diff is uploaded adding a node to a way. def test_upload_way_extend - basic_authorization users(:public_user).email, "test" + basic_authorization create(:user).email, "test" content "" + "" + @@ -1176,7 +1178,7 @@ EOF ## # test for more issues in #1568 def test_upload_empty_invalid - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" ["", "", @@ -1193,7 +1195,8 @@ EOF ## # test that the X-Error-Format header works to request XML errors def test_upload_xml_errors - basic_authorization users(:public_user).email, "test" + basic_authorization changesets(:public_user_first_change).user.email, "test" + cs = changesets(:public_user_first_change) # try and delete a node that is in use diff = XML::Document.new @@ -1205,7 +1208,7 @@ EOF # upload it content diff error_format "xml" - post :upload, :id => 2 + post :upload, :id => cs.id assert_response :success, "failed to return error in XML format" @@ -1219,8 +1222,8 @@ EOF # when we make some simple changes we get the same changes back from the # diff download. def test_diff_download_simple - ## First try with the normal user, which should get a forbidden - basic_authorization(users(:normal_user).email, "test") + ## First try with a non-public user, which should get a forbidden + basic_authorization(create(:user, :data_public => false).email, "test") # create a temporary changeset content "" + @@ -1229,8 +1232,8 @@ EOF put :create assert_response :forbidden - ## Now try with the public user - basic_authorization(users(:public_user).email, "test") + ## Now try with a normal user + basic_authorization(create(:user).email, "test") # create a temporary changeset content "" + @@ -1276,7 +1279,7 @@ EOF # # NOTE: the error turned out to be something else completely! def test_josm_upload - basic_authorization(users(:public_user).email, "test") + basic_authorization(create(:user).email, "test") # create a temporary changeset content "" + @@ -1335,7 +1338,7 @@ OSMFILE # when we make some complex changes we get the same changes back from the # diff download. def test_diff_download_complex - basic_authorization(users(:public_user).email, "test") + basic_authorization(create(:user).email, "test") # create a temporary changeset content "" + @@ -1409,7 +1412,7 @@ EOF # check that the bounding box of a changeset gets updated correctly # FIXME: This should really be moded to a integration test due to the with_controller def test_changeset_bbox - basic_authorization users(:public_user).email, "test" + basic_authorization create(:user).email, "test" # create a new changeset content "" @@ -1468,7 +1471,7 @@ EOF ## # test that the changeset :include method works as it should def test_changeset_include - basic_authorization users(:public_user).display_name, "test" + basic_authorization create(:user).display_name, "test" # create a new changeset content "" @@ -1490,7 +1493,7 @@ EOF ## # test that a not found, wrong method with the expand bbox works as expected def test_changeset_expand_bbox_error - basic_authorization users(:public_user).display_name, "test" + basic_authorization create(:user).display_name, "test" # create a new changeset content "" @@ -1626,7 +1629,7 @@ EOF ## # check updating tags on a changeset def test_changeset_update - ## First try with the non-public user + ## First try with a non-public user changeset = changesets(:normal_user_first_change) new_changeset = changeset.to_xml new_tag = XML::Node.new "tag" @@ -1640,12 +1643,12 @@ EOF assert_response :unauthorized # try with the wrong authorization - basic_authorization users(:public_user).email, "test" + basic_authorization create(:user).email, "test" put :update, :id => changeset.id assert_response :conflict # now this should get an unauthorized - basic_authorization users(:normal_user).email, "test" + basic_authorization changeset.user.email, "test" put :update, :id => changeset.id assert_require_public_data "user with their data non-public, shouldn't be able to edit their changeset" @@ -1665,12 +1668,12 @@ EOF assert_response :unauthorized # try with the wrong authorization - basic_authorization users(:second_public_user).email, "test" + basic_authorization create(:user).email, "test" put :update, :id => changeset.id assert_response :conflict # now this should work... - basic_authorization users(:public_user).email, "test" + basic_authorization changeset.user.email, "test" put :update, :id => changeset.id assert_response :success @@ -1683,7 +1686,7 @@ EOF # check that a user different from the one who opened the changeset # can't modify it. def test_changeset_update_invalid - basic_authorization users(:public_user).email, "test" + basic_authorization create(:user).email, "test" changeset = changesets(:normal_user_first_change) new_changeset = changeset.to_xml @@ -1701,7 +1704,7 @@ EOF # check that a changeset can contain a certain max number of changes. ## FIXME should be changed to an integration test due to the with_controller def test_changeset_limits - basic_authorization users(:public_user).email, "test" + basic_authorization create(:user).email, "test" # open a new changeset content "" @@ -2038,7 +2041,7 @@ EOF post :comment, :id => changesets(:normal_user_closed_change).id, :text => "This is a comment" assert_response :unauthorized - basic_authorization(users(:public_user).email, "test") + basic_authorization(create(:user).email, "test") # bad changeset id assert_no_difference "ChangesetComment.count" do @@ -2068,7 +2071,7 @@ EOF ## # test subscribe success def test_subscribe_success - basic_authorization(users(:public_user).email, "test") + basic_authorization(create(:user).email, "test") changeset = changesets(:normal_user_closed_change) assert_difference "changeset.subscribers.count", 1 do @@ -2080,6 +2083,8 @@ EOF ## # test subscribe fail def test_subscribe_fail + user = create(:user) + # unauthorized changeset = changesets(:normal_user_closed_change) assert_no_difference "changeset.subscribers.count" do @@ -2087,7 +2092,7 @@ EOF end assert_response :unauthorized - basic_authorization(users(:public_user).email, "test") + basic_authorization(user.email, "test") # bad changeset id assert_no_difference "changeset.subscribers.count" do @@ -2104,7 +2109,7 @@ EOF # trying to subscribe when already subscribed changeset = changesets(:normal_user_subscribed_change) - changeset.subscribers.push(users(:public_user)) + changeset.subscribers.push(user) assert_no_difference "changeset.subscribers.count" do post :subscribe, :id => changeset.id end @@ -2114,9 +2119,10 @@ EOF ## # test unsubscribe success def test_unsubscribe_success - basic_authorization(users(:public_user).email, "test") + user = create(:user) + basic_authorization(user.email, "test") changeset = changesets(:normal_user_subscribed_change) - changeset.subscribers.push(users(:public_user)) + changeset.subscribers.push(user) assert_difference "changeset.subscribers.count", -1 do post :unsubscribe, :id => changeset.id @@ -2134,7 +2140,7 @@ EOF end assert_response :unauthorized - basic_authorization(users(:public_user).email, "test") + basic_authorization(create(:user).email, "test") # bad changeset id assert_no_difference "changeset.subscribers.count" do @@ -2168,14 +2174,14 @@ EOF assert_response :unauthorized assert_equal true, comment.reload.visible - basic_authorization(users(:public_user).email, "test") + basic_authorization(create(:user).email, "test") # not a moderator post :hide_comment, :id => comment.id assert_response :forbidden assert_equal true, comment.reload.visible - basic_authorization(users(:moderator_user).email, "test") + basic_authorization(create(:moderator_user).email, "test") # bad comment id post :hide_comment, :id => 999111 @@ -2189,7 +2195,7 @@ EOF comment = create(:changeset_comment) assert_equal true, comment.visible - basic_authorization(users(:moderator_user).email, "test") + basic_authorization(create(:moderator_user).email, "test") post :hide_comment, :id => comment.id assert_response :success @@ -2207,14 +2213,14 @@ EOF assert_response :unauthorized assert_equal false, comment.reload.visible - basic_authorization(users(:public_user).email, "test") + basic_authorization(create(:user).email, "test") # not a moderator post :unhide_comment, :id => comment.id assert_response :forbidden assert_equal false, comment.reload.visible - basic_authorization(users(:moderator_user).email, "test") + basic_authorization(create(:moderator_user).email, "test") # bad comment id post :unhide_comment, :id => 999111 @@ -2228,7 +2234,7 @@ EOF comment = create(:changeset_comment, :visible => false) assert_equal false, comment.visible - basic_authorization(users(:moderator_user).email, "test") + basic_authorization(create(:moderator_user).email, "test") post :unhide_comment, :id => comment.id assert_response :success diff --git a/test/factories/client_applications.rb b/test/factories/client_applications.rb index 413dc57c9..5535ee2e7 100644 --- a/test/factories/client_applications.rb +++ b/test/factories/client_applications.rb @@ -2,5 +2,7 @@ FactoryGirl.define do factory :client_application do sequence(:name) { |n| "Client application #{n}" } sequence(:url) { |n| "http://example.com/app/#{n}" } + + user end end diff --git a/test/integration/oauth_test.rb b/test/integration/oauth_test.rb index 8971b7a2b..9eedd1ff4 100644 --- a/test/integration/oauth_test.rb +++ b/test/integration/oauth_test.rb @@ -1,8 +1,6 @@ require "test_helper" class OAuthTest < ActionDispatch::IntegrationTest - fixtures :users - include OAuth::Helper def setup @@ -10,7 +8,7 @@ class OAuthTest < ActionDispatch::IntegrationTest end def test_oauth10_web_app - client = create(:client_application, :callback_url => "http://some.web.app.example.org/callback", :user => users(:public_user), :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true) + client = create(:client_application, :callback_url => "http://some.web.app.example.org/callback", :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true) post_via_redirect "/login", :username => client.user.email, :password => "test" assert_response :success @@ -21,7 +19,7 @@ class OAuthTest < ActionDispatch::IntegrationTest end def test_oauth10_desktop_app - client = create(:client_application, :user => users(:public_user), :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true) + client = create(:client_application, :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true) post_via_redirect "/login", :username => client.user.email, :password => "test" assert_response :success @@ -31,7 +29,7 @@ class OAuthTest < ActionDispatch::IntegrationTest end def test_oauth10a_web_app - client = create(:client_application, :callback_url => "http://some.web.app.example.org/callback", :user => users(:public_user), :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true) + client = create(:client_application, :callback_url => "http://some.web.app.example.org/callback", :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true) post_via_redirect "/login", :username => client.user.email, :password => "test" assert_response :success @@ -42,7 +40,7 @@ class OAuthTest < ActionDispatch::IntegrationTest end def test_oauth10a_desktop_app - client = create(:client_application, :user => users(:public_user), :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true) + client = create(:client_application, :allow_read_prefs => true, :allow_write_api => true, :allow_read_gpx => true) post_via_redirect "/login", :username => client.user.email, :password => "test" assert_response :success @@ -167,7 +165,7 @@ class OAuthTest < ActionDispatch::IntegrationTest assert_nil token.invalidated_at assert_allowed token, [:allow_write_api, :allow_read_gpx] - trace = create(:trace, :user => users(:public_user)) + trace = create(:trace, :user => client.user) signed_get "/api/0.6/gpx/#{trace.id}", :consumer => client, :token => token assert_response :success @@ -230,7 +228,7 @@ class OAuthTest < ActionDispatch::IntegrationTest signed_get "/api/0.6/user/preferences", :consumer => client, :token => token assert_response :success - trace = create(:trace, :user => users(:public_user)) + trace = create(:trace, :user => client.user) signed_get "/api/0.6/gpx/#{trace.id}", :consumer => client, :token => token assert_response :forbidden @@ -279,7 +277,7 @@ class OAuthTest < ActionDispatch::IntegrationTest assert_nil token.invalidated_at assert_allowed token, [:allow_write_api, :allow_read_gpx] - trace = create(:trace, :user => users(:public_user)) + trace = create(:trace, :user => client.user) signed_get "/api/0.6/gpx/#{trace.id}", :consumer => client, :token => token assert_response :success diff --git a/test/integration/user_terms_seen_test.rb b/test/integration/user_terms_seen_test.rb index e8d3df07a..ad0c3b211 100644 --- a/test/integration/user_terms_seen_test.rb +++ b/test/integration/user_terms_seen_test.rb @@ -1,15 +1,13 @@ require "test_helper" class UserTermsSeenTest < ActionDispatch::IntegrationTest - fixtures :users - def setup stub_hostip_requests end def test_api_blocked with_terms_seen(true) do - user = users(:terms_not_seen_user) + user = create(:user, :terms_seen => false) get "/api/#{API_VERSION}/user/preferences", nil, auth_header(user.display_name, "test") assert_response :forbidden @@ -25,7 +23,7 @@ class UserTermsSeenTest < ActionDispatch::IntegrationTest def test_terms_presented_at_login with_terms_seen(true) do - user = users(:terms_not_seen_user) + user = create(:user, :terms_seen => false) # try to log in get_via_redirect "/login" @@ -51,7 +49,7 @@ class UserTermsSeenTest < ActionDispatch::IntegrationTest def test_terms_cant_be_circumvented with_terms_seen(true) do - user = users(:terms_not_seen_user) + user = create(:user, :terms_seen => false) # try to log in get_via_redirect "/login"