Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spec for Converter #17

Merged
merged 11 commits into from
Apr 29, 2024
Merged

Add spec for Converter #17

merged 11 commits into from
Apr 29, 2024

Conversation

moozzi
Copy link
Member

@moozzi moozzi commented Feb 1, 2024

#1

spec/converter_spec.rb Outdated Show resolved Hide resolved
context 'when there is no output' do
context 'and format is csv' do
let(:expected_csv) do
"type,status.status,status.protocol,status.port,status.reason,status.ttl,status.ip,status.timestamp,banner.protocol,banner.port,banner.ip,banner.timestamp,banner.app_protocol,banner.payload\nstatus,open,tcp,80,\"syn,ack\",54,93.184.216.34,2021-08-26 08:50:21 +0200\n"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to make it multi-line but without adding some unnecessary \n's?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the last newline? You can do either:

<<~CSV.chomp
  foo,bar,baz
  ...
CSV

or

[
  "foo,bar,baz",
  "..."
].join("\n")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the last one. I don't want this expected_csv to be too long but saving it as <<CSV.chomp ... fails when I want to compare it with result of .convert

Copy link
Member

@postmodern postmodern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should rebase the branch against main to get the new spec/fixtures/converters/input.json file. Also I think we need an input.csv file as well so we can test input_format: :csv.

@@ -0,0 +1,3 @@
[
{ "ip": "93.184.216.34", "timestamp": "1629960621", "ports": [ {"port": 80, "proto": "tcp", "status": "open", "reason": "syn-ack", "ttl": 54} ] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should rebase this branch to get the new spec/fixtures/converter/input.json.

spec/converter_spec.rb Show resolved Hide resolved
@moozzi moozzi force-pushed the add_converter_spec branch from a22b72e to 14d5bf6 Compare February 15, 2024 12:52
@moozzi
Copy link
Member Author

moozzi commented Feb 15, 2024

If we had a spec/fixtures/converters/input.csv file, we could then test input_format: :csv, format: :json.

I'll add it later.

Make the spec variables more consistent.
@postmodern postmodern merged commit 1381ac3 into main Apr 29, 2024
14 checks passed
@postmodern postmodern added this to the 0.1.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants