Project

General

Profile

Defect #31388

Updated by Go MAEDA over 5 years ago

ApiTest fails if config.time_zone is set. The tests suppose that time in API response is always in UTC, but it varies depending on the value of config.time_zone is set. 

 Set @config.time_zone@ in @config/additional_environment.rb@. 

 <pre> 
 config.time_zone = 'Tokyo' 
 </pre> 

 Run @test/integration/api_test/api_test.rb@. It fails. In the following example, the test expected that created_on in the response was "2006-07-19T17:12:21Z", but actually it was "2006-07-20T02:12:21+09:00". 

 <pre> 
 $ bin/rails test test/integration/api_test/api_test.rb 
 Run options: --seed 57420 

 # Running: 

 .F 

 Failure: 
 Redmine::ApiTest::ApiTest#test_json_datetime_format [/Users/maeda/redmines/redmine-trunk/test/integration/api_test/api_test.rb:43]: 
 ""created_on":"2006-07-19T17:12:21Z"" not found in "{"user":{"id":1,"login":"admin","admin":true,"firstname":"Redmine","lastname":"Admin","mail":"admin@somenet.foo","created_on":"2006-07-20T02:12:21+09:00","last_login_on":"2019-05-18T08:30:27+09:00","api_key":"9b0dd9bb5f4dcb890696137385999b2569f24631","status":1,"custom_fields":[{"id":4,"name":"Phone number","value":null},{"id":5,"name":"Money","value":null}]}}" 


 bin/rails test test/integration/api_test/api_test.rb:41 

 .F 

 Failure: 
 Redmine::ApiTest::ApiTest#test_xml_datetime_format [/Users/maeda/redmines/redmine-trunk/test/integration/api_test/api_test.rb:48]: 
 "<created_on>2006-07-19T17:12:21Z</created_on>" not found in "<?xml version="1.0" encoding="UTF-8"?><user><id>1</id><login>admin</login><admin>true</admin><firstname>Redmine</firstname><lastname>Admin</lastname><mail>admin@somenet.foo</mail><created_on>2006-07-20T02:12:21+09:00</created_on><last_login_on>2019-05-18T08:30:27+09:00</last_login_on><api_key>4bfca692e987af9ce73c77b1f31f79a11bbd3e4c</api_key><status>1</status><custom_fields type="array"><custom_field id="4" name="Phone number"><value/></custom_field><custom_field id="5" name="Money"><value/></custom_field></custom_fields></user>" 


 bin/rails test test/integration/api_test/api_test.rb:46 



 Finished in 1.001562s, 3.9938 runs/s, 5.9906 assertions/s. 
 4 runs, 6 assertions, 2 failures, 0 errors, 0 skips 
 </pre>

Back