Skip to content

Commit

Permalink
[api] Make source controller test more reliable
Browse files Browse the repository at this point in the history
test_get_project_meta_history relies on no other test writing to
kde4/_project, but that's not guaranteed. So replace the hard coded
rev=1 with the revision we have before the actual test runs

The underlying reason is that attribute creation and deletion now
stores _attributes in the model (which was lost in cases before)
  • Loading branch information
coolo committed Jun 26, 2018
1 parent f392f32 commit 9b21d67
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/api/test/functional/source_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,10 @@ def test_get_project_meta_history
get '/source/kde4/_project/_history?meta=1'
assert_response :success
assert_xml_tag(tag: 'revisionlist')
# remember the current HEAD so we can check it later
# value depends on the test order
rl = Xmlhash.parse(@response.body)
oldrevision = rl.elements('revision').last['rev']
get '/source/kde4/_meta'
assert_response :success
oldmeta = @response.body
Expand All @@ -1762,7 +1766,7 @@ def test_get_project_meta_history
get '/source/kde4/_project/_meta?meta=1'
assert_response :success
assert_xml_tag(tag: 'project')
get '/source/kde4/_project/_meta?meta=1&rev=1'
get "/source/kde4/_project/_meta?meta=1&rev=#{oldrevision}"
assert_response :success
assert_xml_tag(tag: 'project')
assert_xml_tag(tag: 'title', content: 'blub') # fixture string
Expand Down

0 comments on commit 9b21d67

Please sign in to comment.