Commit 9f86be57352f1004444fbedadb30ffe6f9f4383c
1 parent
2026abeb
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
fix tests
Showing
2 changed files
with
17 additions
and
1 deletions
Show diff stats
test/unit/api/helpers_test.rb
... | ... | @@ -236,7 +236,7 @@ class APIHelpersTest < ActiveSupport::TestCase |
236 | 236 | |
237 | 237 | end |
238 | 238 | |
239 | - should 'captcha serpro say Name or service not known' do | |
239 | + should 'captcha serpro say name or service not known' do | |
240 | 240 | environment = Environment.new |
241 | 241 | environment.api_captcha_settings = { |
242 | 242 | enabled: true, | ... | ... |
test/unit/api/session_test.rb
... | ... | @@ -39,4 +39,20 @@ class SessionTest < ActiveSupport::TestCase |
39 | 39 | assert_equal 400, last_response.status |
40 | 40 | end |
41 | 41 | |
42 | + should 'detected error, Name or service not known, for Serpro Captcha communication' do | |
43 | + environment = Environment.default | |
44 | + environment.api_captcha_settings = { | |
45 | + enabled: true, | |
46 | + provider: 'serpro', | |
47 | + serpro_client_id: '0000000000000000', | |
48 | + verify_uri: 'http://someserverthatdoesnotexist.mycompanythatdoesnotexist.com/validate', | |
49 | + } | |
50 | + environment.save! | |
51 | + params = {:login => "newuserapi", :password => "newuserapi", :password_confirmation => "newuserapi", :email => "newuserapi@email.com", | |
52 | + :txtToken_captcha_serpro_gov_br => '4324343', :captcha_text => '4030320'} | |
53 | + post "/api/v1/register?#{params.to_query}" | |
54 | + assert_equal "Serpro captcha error: getaddrinfo: Name or service not known", JSON.parse(last_response.body)["message"] | |
55 | + end | |
56 | + | |
57 | + | |
42 | 58 | end | ... | ... |