Skip to content

Commit

Permalink
Fix count test
Browse files Browse the repository at this point in the history
  • Loading branch information
egorras committed Feb 1, 2018
1 parent 9ce1c1e commit 64edc92
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
7 changes: 4 additions & 3 deletions features/runner/test_audit_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ def write_line(s)
end

def get_log
total = @total
puts total
@total
end

def clear
@total = ''
total
end
end
5 changes: 3 additions & 2 deletions features/runner/wiremock_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ def count_requests_with_endpoint(endpoint, verb, body)
}

if body
request_json['bodyPatterns'] = [{equalTo: body}]
request_json[:bodyPatterns] = [{equalTo: body}]
end

RestClient.post("#{@base_url}/__admin/requests/count", request_json)
response = RestClient.post("#{@base_url}/__admin/requests/count", request_json.to_json, {content_type: :json, accept: :json})
JSON.parse(response.body)["count"]
end

end
11 changes: 8 additions & 3 deletions features/runner_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
end

When(/^user starts client$/) do
audit_stream.clear

config = TDL::ChallengeSessionConfig.for_journey_id(@journey_id)
.with_server_hostname(@challenge_hostname)
.with_port(@port)
Expand All @@ -92,10 +94,13 @@
end

Then(/^the server interaction should contain the following lines:$/) do |expected_output|
total = audit_stream.get_log
lines = expected_output.split('\n')
total = audit_stream.get_log.strip
lines = expected_output.split("\n")
lines.each do |line|
assert total.include?(line), 'Expected string is not contained in output'
line = line.strip
unless line.empty?
assert total.include?(line), 'Expected string is not contained in output'
end
end
end

Expand Down
1 change: 1 addition & 0 deletions lib/tdl/runner/challenge_server_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def initialize(hostname, port, journey_id, use_colours)
end

def get_journey_progress
puts @base_url
get('journeyProgress')
end

Expand Down

0 comments on commit 64edc92

Please sign in to comment.