diff --git a/test/cassettes/GitRepositoryTest_test_incorrect_credentials_for_github.yml b/test/cassettes/GitRepositoryTest_test_incorrect_credentials_for_github.yml index 403a47e864797c97ed014a957379b3b2c4aaa36e..9f0f0ca6cdd75583e425f68174d3d72943a35cab 100644 --- a/test/cassettes/GitRepositoryTest_test_incorrect_credentials_for_github.yml +++ b/test/cassettes/GitRepositoryTest_test_incorrect_credentials_for_github.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://api.github.com/repos/username/repository + uri: https://api.github.com/repos/<TEST_GITHUB_REPOSITORY> body: encoding: US-ASCII string: '' @@ -14,7 +14,7 @@ http_interactions: Content-Type: - application/json Authorization: - - token wrong token + - token wrong access token Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 response: @@ -25,7 +25,7 @@ http_interactions: Server: - GitHub.com Date: - - Mon, 21 Feb 2022 17:08:15 GMT + - Thu, 19 May 2022 12:21:49 GMT Content-Type: - application/json; charset=utf-8 Content-Length: @@ -35,11 +35,11 @@ http_interactions: X-Ratelimit-Limit: - '60' X-Ratelimit-Remaining: - - '52' + - '58' X-Ratelimit-Reset: - - '1645464998' + - '1652963903' X-Ratelimit-Used: - - '8' + - '2' X-Ratelimit-Resource: - core Access-Control-Expose-Headers: @@ -64,9 +64,9 @@ http_interactions: Vary: - Accept-Encoding, Accept, X-Requested-With X-Github-Request-Id: - - D21E:952E:6B1ECE:6D1E41:6213C6FE + - E8FB:2C88:7D571A:7FD11B:6286365D body: encoding: UTF-8 string: '{"message":"Bad credentials","documentation_url":"https://docs.github.com/rest"}' - recorded_at: Mon, 21 Feb 2022 17:08:14 GMT -recorded_with: VCR 6.0.0 + recorded_at: Thu, 19 May 2022 12:21:49 GMT +recorded_with: VCR 6.1.0 diff --git a/test/cassettes/GitRepositoryTest_test_incorrect_credentials_for_gitlb.yml b/test/cassettes/GitRepositoryTest_test_incorrect_credentials_for_gitlab.yml similarity index 66% rename from test/cassettes/GitRepositoryTest_test_incorrect_credentials_for_gitlb.yml rename to test/cassettes/GitRepositoryTest_test_incorrect_credentials_for_gitlab.yml index f0e9e583348982b46fb8e95aff652c9c7ec8487b..4b7b393cf4b706b0578a5affa7470e1f602f630c 100644 --- a/test/cassettes/GitRepositoryTest_test_incorrect_credentials_for_gitlb.yml +++ b/test/cassettes/GitRepositoryTest_test_incorrect_credentials_for_gitlab.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: post - uri: https://gitlab.com/api/v4/projects/wrong%20id/repository/commits + uri: https://gitlab.com/api/v4/projects/<TEST_GITLAB_REPOSITORY>/repository/commits body: encoding: UTF-8 string: branch=main&commit_message=this%20is%20a%20commit&actions%5B%5D%5Baction%5D=create&actions%5B%5D%5Bfile_path%5D=%2Fpath.txt&actions%5B%5D%5Bcontent%5D=content @@ -14,7 +14,7 @@ http_interactions: User-Agent: - Gitlab Ruby Gem 4.18.0 Private-Token: - - wrong token + - wrong access_token Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 response: @@ -23,7 +23,7 @@ http_interactions: message: Unauthorized headers: Date: - - Mon, 21 Feb 2022 17:13:43 GMT + - Thu, 19 May 2022 12:21:26 GMT Content-Type: - application/json Content-Length: @@ -39,31 +39,41 @@ http_interactions: X-Frame-Options: - SAMEORIGIN X-Request-Id: - - 01FWEMCP1QMA5G62G9JVXZT97H + - 01G3E480HMNA1WW243XJG7S0BR X-Runtime: - - '0.015819' + - '0.038668' Strict-Transport-Security: - max-age=31536000 Referrer-Policy: - strict-origin-when-cross-origin + Ratelimit-Observed: + - '1' + Ratelimit-Remaining: + - '1999' + Ratelimit-Reset: + - '1652962946' + Ratelimit-Resettime: + - Thu, 19 May 2022 12:22:26 GMT + Ratelimit-Limit: + - '2000' Gitlab-Lb: - - fe-18-lb-gprd + - fe-24-lb-gprd Gitlab-Sv: - - api-gke-us-east1-b + - localhost Cf-Cache-Status: - DYNAMIC Expect-Ct: - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" Report-To: - - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=%2Bf2%2FgmT9DLC4VzfQjHg4AphFp9fAdQO2cyzNz8sycYn9D55r%2BZTU4ygwTDbsWYz2%2Bd6LgJ7epg8rp1ciH4DL7eZxbOBwP5bDVQcweUAAQcOo3AVbjXc4ZoHn0P3l4%2B94nWoFqMW27k0%3D"}],"group":"cf-nel","max_age":604800}' + - '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=vfvVpSgDUjG6ip4GnUGUII9epvnb%2BRgsscvlm0HBfkDNDSIpQIzquThr43ZchKxPCtbsxa%2Fy83hk8o5G58K8mlFL0bCbjFxXDBqtyx%2BVjazYFLShNEn3qJjjml4%3D"}],"group":"cf-nel","max_age":604800}' Nel: - '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}' Server: - cloudflare Cf-Ray: - - 6e119b5ebc493a6f-CDG + - 70dccad50d056958-FRA body: encoding: UTF-8 string: '{"message":"401 Unauthorized"}' - recorded_at: Mon, 21 Feb 2022 17:13:43 GMT -recorded_with: VCR 6.0.0 + recorded_at: Thu, 19 May 2022 12:21:26 GMT +recorded_with: VCR 6.1.0 diff --git a/test/controllers/communication/extranets_controller_test.rb b/test/controllers/communication/extranets_controller_test.rb deleted file mode 100644 index 3e3c20c8bf074e5f67ab68f4a86af24ca9b61f3b..0000000000000000000000000000000000000000 --- a/test/controllers/communication/extranets_controller_test.rb +++ /dev/null @@ -1,48 +0,0 @@ -require "test_helper" - -class Communication::ExtranetsControllerTest < ActionDispatch::IntegrationTest - setup do - @communication_extranet = communication_extranets(:one) - end - - test "should get index" do - get communication_extranets_url - assert_response :success - end - - test "should get new" do - get new_communication_extranet_url - assert_response :success - end - - test "should create communication_extranet" do - assert_difference('Communication::Extranet.count') do - post communication_extranets_url, params: { communication_extranet: { name: @communication_extranet.name, university_id: @communication_extranet.university_id, url: @communication_extranet.url } } - end - - assert_redirected_to communication_extranet_url(Communication::Extranet.last) - end - - test "should show communication_extranet" do - get communication_extranet_url(@communication_extranet) - assert_response :success - end - - test "should get edit" do - get edit_communication_extranet_url(@communication_extranet) - assert_response :success - end - - test "should update communication_extranet" do - patch communication_extranet_url(@communication_extranet), params: { communication_extranet: { name: @communication_extranet.name, university_id: @communication_extranet.university_id, url: @communication_extranet.url } } - assert_redirected_to communication_extranet_url(@communication_extranet) - end - - test "should destroy communication_extranet" do - assert_difference('Communication::Extranet.count', -1) do - delete communication_extranet_url(@communication_extranet) - end - - assert_redirected_to communication_extranets_url - end -end diff --git a/test/controllers/education/academic_years_controller_test.rb b/test/controllers/education/academic_years_controller_test.rb deleted file mode 100644 index 3e5bf7bdceceffbac113d450dac8ad2c3dfb1b54..0000000000000000000000000000000000000000 --- a/test/controllers/education/academic_years_controller_test.rb +++ /dev/null @@ -1,48 +0,0 @@ -require "test_helper" - -class Education::AcademicYearsControllerTest < ActionDispatch::IntegrationTest - setup do - @education_academic_year = education_academic_years(:one) - end - - test "should get index" do - get education_academic_years_url - assert_response :success - end - - test "should get new" do - get new_education_academic_year_url - assert_response :success - end - - test "should create education_academic_year" do - assert_difference('Education::AcademicYear.count') do - post education_academic_years_url, params: { education_academic_year: { university_id: @education_academic_year.university_id, year: @education_academic_year.year } } - end - - assert_redirected_to education_academic_year_url(Education::AcademicYear.last) - end - - test "should show education_academic_year" do - get education_academic_year_url(@education_academic_year) - assert_response :success - end - - test "should get edit" do - get edit_education_academic_year_url(@education_academic_year) - assert_response :success - end - - test "should update education_academic_year" do - patch education_academic_year_url(@education_academic_year), params: { education_academic_year: { university_id: @education_academic_year.university_id, year: @education_academic_year.year } } - assert_redirected_to education_academic_year_url(@education_academic_year) - end - - test "should destroy education_academic_year" do - assert_difference('Education::AcademicYear.count', -1) do - delete education_academic_year_url(@education_academic_year) - end - - assert_redirected_to education_academic_years_url - end -end diff --git a/test/controllers/education/cohorts_controller_test.rb b/test/controllers/education/cohorts_controller_test.rb deleted file mode 100644 index e8e527ad1bbef72912c6509b815a3c842c169ab5..0000000000000000000000000000000000000000 --- a/test/controllers/education/cohorts_controller_test.rb +++ /dev/null @@ -1,48 +0,0 @@ -require "test_helper" - -class Education::CohortsControllerTest < ActionDispatch::IntegrationTest - setup do - @education_cohort = education_cohorts(:one) - end - - test "should get index" do - get education_cohorts_url - assert_response :success - end - - test "should get new" do - get new_education_cohort_url - assert_response :success - end - - test "should create education_cohort" do - assert_difference('Education::Cohort.count') do - post education_cohorts_url, params: { education_cohort: { academic_year_id: @education_cohort.academic_year_id, name: @education_cohort.name, program_id: @education_cohort.program_id, university_id: @education_cohort.university_id } } - end - - assert_redirected_to education_cohort_url(Education::Cohort.last) - end - - test "should show education_cohort" do - get education_cohort_url(@education_cohort) - assert_response :success - end - - test "should get edit" do - get edit_education_cohort_url(@education_cohort) - assert_response :success - end - - test "should update education_cohort" do - patch education_cohort_url(@education_cohort), params: { education_cohort: { academic_year_id: @education_cohort.academic_year_id, name: @education_cohort.name, program_id: @education_cohort.program_id, university_id: @education_cohort.university_id } } - assert_redirected_to education_cohort_url(@education_cohort) - end - - test "should destroy education_cohort" do - assert_difference('Education::Cohort.count', -1) do - delete education_cohort_url(@education_cohort) - end - - assert_redirected_to education_cohorts_url - end -end diff --git a/test/controllers/university/organization/imports_controller_test.rb b/test/controllers/university/organization/imports_controller_test.rb deleted file mode 100644 index 34bbfd4821f696c34af98187bc289b3b816eb969..0000000000000000000000000000000000000000 --- a/test/controllers/university/organization/imports_controller_test.rb +++ /dev/null @@ -1,48 +0,0 @@ -require "test_helper" - -class University::Organization::ImportsControllerTest < ActionDispatch::IntegrationTest - setup do - @university_organization_import = university_organization_imports(:one) - end - - test "should get index" do - get university_organization_imports_url - assert_response :success - end - - test "should get new" do - get new_university_organization_import_url - assert_response :success - end - - test "should create university_organization_import" do - assert_difference('University::Organization::Import.count') do - post university_organization_imports_url, params: { university_organization_import: { university_id: @university_organization_import.university_id, user_id: @university_organization_import.user_id } } - end - - assert_redirected_to university_organization_import_url(University::Organization::Import.last) - end - - test "should show university_organization_import" do - get university_organization_import_url(@university_organization_import) - assert_response :success - end - - test "should get edit" do - get edit_university_organization_import_url(@university_organization_import) - assert_response :success - end - - test "should update university_organization_import" do - patch university_organization_import_url(@university_organization_import), params: { university_organization_import: { university_id: @university_organization_import.university_id, user_id: @university_organization_import.user_id } } - assert_redirected_to university_organization_import_url(@university_organization_import) - end - - test "should destroy university_organization_import" do - assert_difference('University::Organization::Import.count', -1) do - delete university_organization_import_url(@university_organization_import) - end - - assert_redirected_to university_organization_imports_url - end -end diff --git a/test/controllers/university/organizations_controller_test.rb b/test/controllers/university/organizations_controller_test.rb deleted file mode 100644 index 0e30e40fbc40d9e53e25f70c6e02c99bb47c87d4..0000000000000000000000000000000000000000 --- a/test/controllers/university/organizations_controller_test.rb +++ /dev/null @@ -1,48 +0,0 @@ -require "test_helper" - -class University::OrganizationsControllerTest < ActionDispatch::IntegrationTest - setup do - @university_organization = university_organizations(:one) - end - - test "should get index" do - get university_organizations_url - assert_response :success - end - - test "should get new" do - get new_university_organization_url - assert_response :success - end - - test "should create university_organization" do - assert_difference('University::Organization.count') do - post university_organizations_url, params: { university_organization: { active: @university_organization.active, address: @university_organization.address, city: @university_organization.city, country: @university_organization.country, description: @university_organization.description, kind: @university_organization.kind, mail: @university_organization.mail, phone: @university_organization.phone, siren: @university_organization.siren, title: @university_organization.title, website: @university_organization.website, zipcode: @university_organization.zipcode } } - end - - assert_redirected_to university_organization_url(University::Organization.last) - end - - test "should show university_organization" do - get university_organization_url(@university_organization) - assert_response :success - end - - test "should get edit" do - get edit_university_organization_url(@university_organization) - assert_response :success - end - - test "should update university_organization" do - patch university_organization_url(@university_organization), params: { university_organization: { active: @university_organization.active, address: @university_organization.address, city: @university_organization.city, country: @university_organization.country, description: @university_organization.description, kind: @university_organization.kind, mail: @university_organization.mail, phone: @university_organization.phone, siren: @university_organization.siren, title: @university_organization.title, website: @university_organization.website, zipcode: @university_organization.zipcode } } - assert_redirected_to university_organization_url(@university_organization) - end - - test "should destroy university_organization" do - assert_difference('University::Organization.count', -1) do - delete university_organization_url(@university_organization) - end - - assert_redirected_to university_organizations_url - end -end diff --git a/test/controllers/university/person/alumnus/imports_controller_test.rb b/test/controllers/university/person/alumnus/imports_controller_test.rb deleted file mode 100644 index 8585a49c7011147fefa9cbd786ca351bb596c732..0000000000000000000000000000000000000000 --- a/test/controllers/university/person/alumnus/imports_controller_test.rb +++ /dev/null @@ -1,48 +0,0 @@ -require "test_helper" - -class University::Person::Alumnus::ImportsControllerTest < ActionDispatch::IntegrationTest - setup do - @university_person_alumnus_import = university_person_alumnus_imports(:one) - end - - test "should get index" do - get university_person_alumnus_imports_url - assert_response :success - end - - test "should get new" do - get new_university_person_alumnus_import_url - assert_response :success - end - - test "should create university_person_alumnus_import" do - assert_difference('University::Person::Alumnus::Import.count') do - post university_person_alumnus_imports_url, params: { university_person_alumnus_import: { university_id: @university_person_alumnus_import.university_id, user_id: @university_person_alumnus_import.user_id } } - end - - assert_redirected_to university_person_alumnus_import_url(University::Person::Alumnus::Import.last) - end - - test "should show university_person_alumnus_import" do - get university_person_alumnus_import_url(@university_person_alumnus_import) - assert_response :success - end - - test "should get edit" do - get edit_university_person_alumnus_import_url(@university_person_alumnus_import) - assert_response :success - end - - test "should update university_person_alumnus_import" do - patch university_person_alumnus_import_url(@university_person_alumnus_import), params: { university_person_alumnus_import: { university_id: @university_person_alumnus_import.university_id, user_id: @university_person_alumnus_import.user_id } } - assert_redirected_to university_person_alumnus_import_url(@university_person_alumnus_import) - end - - test "should destroy university_person_alumnus_import" do - assert_difference('University::Person::Alumnus::Import.count', -1) do - delete university_person_alumnus_import_url(@university_person_alumnus_import) - end - - assert_redirected_to university_person_alumnus_imports_url - end -end diff --git a/test/fixtures/communication/extranets.yml b/test/fixtures/communication/extranets.yml index 776fd724dd5f024e021fce80b2a6c2d36c36bae3..67008e68b84634849c8a0ed42ded99acb00fbab4 100644 --- a/test/fixtures/communication/extranets.yml +++ b/test/fixtures/communication/extranets.yml @@ -23,10 +23,10 @@ one: name: MyString - university: one - url: MyString + university: default_university + domain: MyString two: name: MyString - university: two - url: MyString + university: default_university + domain: MyString diff --git a/test/fixtures/education/academic_years.yml b/test/fixtures/education/academic_years.yml index 2a7ea54e6ec792f1e370cda239c158f95f011a32..ede802b5266f17befabe1b26fffb7af3fb9d08bf 100644 --- a/test/fixtures/education/academic_years.yml +++ b/test/fixtures/education/academic_years.yml @@ -18,9 +18,9 @@ # one: - university: one - year: 1 + university: default_university + year: 2022 two: - university: two - year: 1 + university: default_university + year: 2023 diff --git a/test/fixtures/education/cohorts.yml b/test/fixtures/education/cohorts.yml index 48a543db806f22f20ffa9dc40bd512758f52a9e5..c8f91dc321cdf74db15034a038b712ec022aa4a2 100644 --- a/test/fixtures/education/cohorts.yml +++ b/test/fixtures/education/cohorts.yml @@ -24,13 +24,13 @@ # one: - university: one + university: default_university program: one academic_year: one name: MyString two: - university: two + university: default_university program: two academic_year: two name: MyString diff --git a/test/fixtures/education/diplomas.yml b/test/fixtures/education/diplomas.yml index 00700635aebd67e206d2cae946015c0eea4525d1..51010bb01429dbabc9c8c44b218848ff125e2931 100644 --- a/test/fixtures/education/diplomas.yml +++ b/test/fixtures/education/diplomas.yml @@ -23,12 +23,14 @@ # one: + university: default_university name: MyString short_name: MyString level: 1 slug: MyString two: + university: default_university name: MyString short_name: MyString level: 1 diff --git a/test/fixtures/university/organization/imports.yml b/test/fixtures/university/organization/imports.yml deleted file mode 100644 index 2a23235c7fe4b2fe464b2ce04257af0a2f769635..0000000000000000000000000000000000000000 --- a/test/fixtures/university/organization/imports.yml +++ /dev/null @@ -1,28 +0,0 @@ -# == Schema Information -# -# Table name: university_organization_imports -# -# id :uuid not null, primary key -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed -# user_id :uuid not null, indexed -# -# Indexes -# -# index_university_organization_imports_on_university_id (university_id) -# index_university_organization_imports_on_user_id (user_id) -# -# Foreign Keys -# -# fk_rails_31152af0cd (university_id => universities.id) -# fk_rails_da057ff44d (user_id => users.id) -# - -one: - university: one - user: one - -two: - university: two - user: two diff --git a/test/fixtures/university/organizations.yml b/test/fixtures/university/organizations.yml index 6f12c363ea2abdacd2de78df30d42a59652b9c17..e692022061fa2b47eeeeb8670b045dcaeeb51371 100644 --- a/test/fixtures/university/organizations.yml +++ b/test/fixtures/university/organizations.yml @@ -33,29 +33,31 @@ # one: - title: MyString + university: default_university + name: MyString description: MyText address: MyString zipcode: MyString city: MyString country: MyString - website: MyString + url: MyString phone: MyString - mail: MyString + email: MyString active: false siren: MyString kind: 1 two: - title: MyString + university: default_university + name: MyString description: MyText address: MyString zipcode: MyString city: MyString country: MyString - website: MyString + url: MyString phone: MyString - mail: MyString + email: MyString active: false siren: MyString kind: 1 diff --git a/test/fixtures/university/person/alumnus/imports.yml b/test/fixtures/university/person/alumnus/imports.yml deleted file mode 100644 index f8533f0e62b8768e40b987dc28aad4f609d1950a..0000000000000000000000000000000000000000 --- a/test/fixtures/university/person/alumnus/imports.yml +++ /dev/null @@ -1,28 +0,0 @@ -# == Schema Information -# -# Table name: university_person_alumnus_imports -# -# id :uuid not null, primary key -# created_at :datetime not null -# updated_at :datetime not null -# university_id :uuid not null, indexed -# user_id :uuid not null, indexed -# -# Indexes -# -# index_university_person_alumnus_imports_on_university_id (university_id) -# index_university_person_alumnus_imports_on_user_id (user_id) -# -# Foreign Keys -# -# fk_rails_3ff74ac195 (user_id => users.id) -# fk_rails_d14eb003f9 (university_id => universities.id) -# - -one: - university: one - user: one - -two: - university: two - user: two diff --git a/test/fixtures/university/person/experiences.yml b/test/fixtures/university/person/experiences.yml deleted file mode 100644 index 86e34b760d55bae544404b5e4c8f152a65095999..0000000000000000000000000000000000000000 --- a/test/fixtures/university/person/experiences.yml +++ /dev/null @@ -1,42 +0,0 @@ -# == Schema Information -# -# Table name: university_person_experiences -# -# id :uuid not null, primary key -# description :text -# from_year :integer -# to_year :integer -# created_at :datetime not null -# updated_at :datetime not null -# organization_id :uuid not null, indexed -# person_id :uuid not null, indexed -# university_id :uuid not null, indexed -# -# Indexes -# -# index_university_person_experiences_on_organization_id (organization_id) -# index_university_person_experiences_on_person_id (person_id) -# index_university_person_experiences_on_university_id (university_id) -# -# Foreign Keys -# -# fk_rails_18125d90df (person_id => university_people.id) -# fk_rails_38aaa18a3b (organization_id => university_organizations.id) -# fk_rails_923d0b71fd (university_id => universities.id) -# - -one: - university: one - person: one - organization: one - description: MyText - from_year: 1 - to_year: - -two: - university: two - person: two - organization: two - description: MyText - from_year: 1 - to_year: diff --git a/test/integration/summernote_test.rb b/test/integration/summernote_test.rb index 9638ccacf98ce24ab9a1a1227d09b319f35eb579..83c73965382455ce1e9cb20e6a2c3ec60ac3d6f9 100644 --- a/test/integration/summernote_test.rb +++ b/test/integration/summernote_test.rb @@ -2,6 +2,7 @@ require "test_helper" class SummernoteTest < ActiveSupport::TestCase HTML_HYDRATED = "<action-text-attachment sgid=\"sgid\" content-type=\"image/jpeg\" url=\"http://localhost:3000/dan-gold.jpeg\" filename=\"test.jpg\" filesize=\"352931\" width=\"588\" height=\"746\" previewable=\"true\" presentation=\"gallery\"><figure class=\"attachment attachment--preview\">\n <img width=\"588\" height=\"746\" src=\"http://localhost:3000/dan-gold.jpeg\">\n</figure></action-text-attachment>\n" + HTML_DEHYDRATED = "<action-text-attachment sgid=\"sgid\" content-type=\"image/jpeg\" url=\"http://localhost:3000/dan-gold.jpeg\" filename=\"test.jpg\" filesize=\"352931\" width=\"588\" height=\"746\" previewable=\"true\" presentation=\"gallery\"></action-text-attachment>" test "dehydrate actiontext" do diff --git a/test/services/git_repository_test.rb b/test/services/git_repository_test.rb index d3044a41e3d60ae22c8680c132b15da44d2d9224..a9221d751ceb641fba94b989dd915b80e9e7073f 100644 --- a/test/services/git_repository_test.rb +++ b/test/services/git_repository_test.rb @@ -4,18 +4,22 @@ class GitRepositoryTest < ActiveSupport::TestCase test "incorrect credentials for github" do VCR.use_cassette(location) do exception = assert_raises(Exception) do - provider = Git::Providers::Github.new 'wrong token', 'username/repository' + provider = Git::Providers::Github.new ENV['TEST_GITHUB_ENDPOINT'], + 'wrong access token', + ENV['TEST_GITHUB_REPOSITORY'] provider.create_file '/path.txt', 'content' provider.push 'this is a commit' end - assert_equal exception.class, Octokit::Unauthorized + assert_equal Octokit::Unauthorized, exception.class end end test "file creation on github" do VCR.use_cassette(location) do assert_nothing_raised do - provider = Git::Providers::Github.new ENV['TEST_GITHUB_TOKEN'], ENV['TEST_GITHUB_REPOSITORY'] + provider = Git::Providers::Github.new ENV['TEST_GITHUB_ENDPOINT'], + ENV['TEST_GITHUB_TOKEN'], + ENV['TEST_GITHUB_REPOSITORY'] provider.create_file 'test.txt', 'content' result = provider.push 'Creating test.txt file' end @@ -25,7 +29,9 @@ class GitRepositoryTest < ActiveSupport::TestCase test "file update on github" do VCR.use_cassette(location) do assert_nothing_raised do - provider = Git::Providers::Github.new ENV['TEST_GITHUB_TOKEN'], ENV['TEST_GITHUB_REPOSITORY'] + provider = Git::Providers::Github.new ENV['TEST_GITHUB_ENDPOINT'], + ENV['TEST_GITHUB_TOKEN'], + ENV['TEST_GITHUB_REPOSITORY'] provider.update_file 'test.txt', 'test.txt', 'new content' result = provider.push 'Updating test.txt file' end @@ -35,7 +41,9 @@ class GitRepositoryTest < ActiveSupport::TestCase test "file move on github" do VCR.use_cassette(location) do assert_nothing_raised do - provider = Git::Providers::Github.new ENV['TEST_GITHUB_TOKEN'], ENV['TEST_GITHUB_REPOSITORY'] + provider = Git::Providers::Github.new ENV['TEST_GITHUB_ENDPOINT'], + ENV['TEST_GITHUB_TOKEN'], + ENV['TEST_GITHUB_REPOSITORY'] provider.update_file 'new_test.txt', 'test.txt', 'new content' result = provider.push 'Moving test.txt file' end @@ -45,17 +53,21 @@ class GitRepositoryTest < ActiveSupport::TestCase test "file destroy on github" do VCR.use_cassette(location) do assert_nothing_raised do - provider = Git::Providers::Github.new ENV['TEST_GITHUB_TOKEN'], ENV['TEST_GITHUB_REPOSITORY'] + provider = Git::Providers::Github.new ENV['TEST_GITHUB_ENDPOINT'], + ENV['TEST_GITHUB_TOKEN'], + ENV['TEST_GITHUB_REPOSITORY'] provider.destroy_file 'new_test.txt' result = provider.push 'Destroying new_test.txt file' end end end - test "incorrect credentials for gitlb" do + test "incorrect credentials for gitlab" do VCR.use_cassette(location) do exception = assert_raises(Exception) do - provider = Git::Providers::Gitlab.new 'wrong token', 'wrong id' + provider = Git::Providers::Gitlab.new ENV['TEST_GITLAB_ENDPOINT'], + 'wrong access_token', + ENV['TEST_GITLAB_REPOSITORY'] provider.create_file '/path.txt', 'content' provider.push 'this is a commit' end @@ -66,7 +78,9 @@ class GitRepositoryTest < ActiveSupport::TestCase test "file creation on gitlab" do VCR.use_cassette(location) do assert_nothing_raised do - provider = Git::Providers::Gitlab.new ENV['TEST_GITLAB_TOKEN'], ENV['TEST_GITLAB_REPOSITORY'] + provider = Git::Providers::Gitlab.new ENV['TEST_GITLAB_ENDPOINT'], + ENV['TEST_GITLAB_TOKEN'], + ENV['TEST_GITLAB_REPOSITORY'] provider.create_file 'test.txt', 'content' result = provider.push 'Creating test.txt file' end @@ -76,7 +90,9 @@ class GitRepositoryTest < ActiveSupport::TestCase test "file update on gitlab" do VCR.use_cassette(location) do assert_nothing_raised do - provider = Git::Providers::Gitlab.new ENV['TEST_GITLAB_TOKEN'], ENV['TEST_GITLAB_REPOSITORY'] + provider = Git::Providers::Gitlab.new ENV['TEST_GITLAB_ENDPOINT'], + ENV['TEST_GITLAB_TOKEN'], + ENV['TEST_GITLAB_REPOSITORY'] provider.update_file 'test.txt', 'test.txt', 'new content' result = provider.push 'Updating test.txt file' end @@ -86,7 +102,9 @@ class GitRepositoryTest < ActiveSupport::TestCase test "file move on gitlab" do VCR.use_cassette(location) do assert_nothing_raised do - provider = Git::Providers::Gitlab.new ENV['TEST_GITLAB_TOKEN'], ENV['TEST_GITLAB_REPOSITORY'] + provider = Git::Providers::Gitlab.new ENV['TEST_GITLAB_ENDPOINT'], + ENV['TEST_GITLAB_TOKEN'], + ENV['TEST_GITLAB_REPOSITORY'] provider.update_file 'new_test.txt', 'test.txt', 'new content' result = provider.push 'Moving test.txt file' end @@ -96,7 +114,9 @@ class GitRepositoryTest < ActiveSupport::TestCase test "file destroy on gitlab" do VCR.use_cassette(location) do assert_nothing_raised do - provider = Git::Providers::Gitlab.new ENV['TEST_GITLAB_TOKEN'], ENV['TEST_GITLAB_REPOSITORY'] + provider = Git::Providers::Gitlab.new ENV['TEST_GITLAB_ENDPOINT'], + ENV['TEST_GITLAB_TOKEN'], + ENV['TEST_GITLAB_REPOSITORY'] provider.destroy_file 'new_test.txt' result = provider.push 'Destroying new_test.txt file' end diff --git a/test/services/summernote_cleaner_test.rb b/test/services/summernote_cleaner_test.rb new file mode 100644 index 0000000000000000000000000000000000000000..37fe2bc4af4c533be4c0ac742e80948ffc39ca6a --- /dev/null +++ b/test/services/summernote_cleaner_test.rb @@ -0,0 +1,9 @@ +require "test_helper" + +class SummernoteCleanerTest < ActiveSupport::TestCase + test "add p around text if missing" do + text = 'Les étudiants doivent s\'acquitter des droits universitaires annuels (170€ pour 2021/2022) ainsi que de la Contribution de la Vie Étudiante et de Campus (92€ pour 2021/2022). Ils doivent également justifier d\'une assurance responsabilité civile.<br>Plus d\'informations dans la rubrique → <a href="https://bordeauxmontaigne-iut.netlify.app/vie-etudiante/scolarite/frais-dinscription">Scolarité</a>' + assert_equal '<p>Les étudiants doivent s\'acquitter des droits universitaires annuels (170€ pour 2021/2022) ainsi que de la Contribution de la Vie Étudiante et de Campus (92€ pour 2021/2022). Ils doivent également justifier d\'une assurance responsabilité civile.<br>Plus d\'informations dans la rubrique → <a href="https://bordeauxmontaigne-iut.netlify.app/vie-etudiante/scolarite/frais-dinscription">Scolarité</a></p>', SummernoteCleaner.clean(text) + end + +end