Skip to content

Commit

Permalink
Fixing dates
Browse files Browse the repository at this point in the history
test 1
  • Loading branch information
jesutorrr committed Oct 8, 2024
1 parent 78ab2b4 commit b1fb953
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
20 changes: 4 additions & 16 deletions log/vcr_debug.log
Original file line number Diff line number Diff line change
Expand Up @@ -3231,14 +3231,8 @@
[Cassette: 'snyk_v2_task_run'] uri (matched): current request [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29] vs [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29]
[Cassette: 'snyk_v2_task_run'] Found matching interaction for [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29] at index 0: [200 "{\"jsonapi\":{\"version\":\"1.0\"},\"data\":[{\"type\":\"project\",\"id\":\"abcd5678-1234-efgh-"]
[webmock] Identified request type (stubbed_by_vcr) for [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29]
[webmock] Handling request: [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] (disabled: false)
[Cassette: 'snyk_v2_task_run'] Checking if [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] matches [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-14T00:00:00Z&created_before=2024-08-13T00:00:00Z&limit=10&version=2024-04-29] using [:method, :uri]
[Cassette: 'snyk_v2_task_run'] method (matched): current request [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] vs [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-14T00:00:00Z&created_before=2024-08-13T00:00:00Z&limit=10&version=2024-04-29]
[Cassette: 'snyk_v2_task_run'] uri (did not match): current request [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] vs [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-14T00:00:00Z&created_before=2024-08-13T00:00:00Z&limit=10&version=2024-04-29]
[webmock] Identified request type (unhandled) for [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29]
[Cassette: 'snyk_v2_task_run'] Checking if [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] matches [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29] using [:method, :uri]
[Cassette: 'snyk_v2_task_run'] method (matched): current request [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] vs [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29]
[Cassette: 'snyk_v2_task_run'] uri (did not match): current request [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] vs [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29]
[webmock] Handling request: [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-09-08T00:00:00Z&created_before=2024-10-08T00:00:00Z&limit=10&version=2024-04-29] (disabled: false)
[webmock] Identified request type (externally_stubbed) for [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-09-08T00:00:00Z&created_before=2024-10-08T00:00:00Z&limit=10&version=2024-04-29]
[Cassette: 'snyk_v2_task_run'] Initialized with options: {:record=>:once, :record_on_error=>true, :match_requests_on=>[:method, :uri], :allow_unused_http_interactions=>true, :serialize_with=>:yaml, :persist_with=>:file_system, :persister_options=>{}}
[webmock] Handling request: [get http://169.254.169.254/latest/metadata/] (disabled: false)
[webmock] Identified request type (externally_stubbed) for [get http://169.254.169.254/latest/metadata/]
Expand All @@ -3261,14 +3255,8 @@
[Cassette: 'snyk_v2_task_run'] uri (matched): current request [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29] vs [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29]
[Cassette: 'snyk_v2_task_run'] Found matching interaction for [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29] at index 0: [200 "{\"jsonapi\":{\"version\":\"1.0\"},\"data\":[{\"type\":\"project\",\"id\":\"abcd5678-1234-efgh-"]
[webmock] Identified request type (stubbed_by_vcr) for [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29]
[webmock] Handling request: [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] (disabled: false)
[Cassette: 'snyk_v2_task_run'] Checking if [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] matches [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-14T00:00:00Z&created_before=2024-08-13T00:00:00Z&limit=10&version=2024-04-29] using [:method, :uri]
[Cassette: 'snyk_v2_task_run'] method (matched): current request [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] vs [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-14T00:00:00Z&created_before=2024-08-13T00:00:00Z&limit=10&version=2024-04-29]
[Cassette: 'snyk_v2_task_run'] uri (did not match): current request [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] vs [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-14T00:00:00Z&created_before=2024-08-13T00:00:00Z&limit=10&version=2024-04-29]
[webmock] Identified request type (unhandled) for [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29]
[Cassette: 'snyk_v2_task_run'] Checking if [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] matches [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29] using [:method, :uri]
[Cassette: 'snyk_v2_task_run'] method (matched): current request [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] vs [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29]
[Cassette: 'snyk_v2_task_run'] uri (did not match): current request [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-07-13T00:00:00Z&created_before=2024-08-12T00:00:00Z&limit=10&version=2024-04-29] vs [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/projects?limit=100&version=2024-04-29]
[webmock] Handling request: [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-09-08T00:00:00Z&created_before=2024-10-08T00:00:00Z&limit=10&version=2024-04-29] (disabled: false)
[webmock] Identified request type (externally_stubbed) for [get https://api.eu.snyk.io/rest/orgs/abcd1234-5678-90ef-ghij-klmnopqrstuv/issues?created_after=2024-09-08T00:00:00Z&created_before=2024-10-08T00:00:00Z&limit=10&version=2024-04-29]
[webmock] Handling request: [get http://169.254.169.254/latest/metadata/] (disabled: false)
[webmock] Identified request type (externally_stubbed) for [get http://169.254.169.254/latest/metadata/]
[webmock] Handling request: [get http://169.254.169.254/latest/metadata/] (disabled: false)
Expand Down
2 changes: 1 addition & 1 deletion spec/tasks/connectors/snyk_v2/snyk_v2_stubs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def stub_projects_request
end

def stub_issues_request
stub_request(:get, Addressable::Template.new("https://api.eu.snyk.io/rest/orgs/{orgId}/issues?created_after=2024-09-07T00:00:00Z&created_before=2024-10-07T00:00:00Z&limit=10&version=2024-04-29"))
stub_request(:get, Addressable::Template.new("https://api.eu.snyk.io/rest/orgs/{orgId}/issues?created_after=2024-09-08T00:00:00Z&created_before=2024-10-08T00:00:00Z&limit=10&version=2024-04-29"))
.to_return_json(body: read_fixture_file("issues.json"))
end
end
4 changes: 4 additions & 0 deletions spec/tasks/connectors/snyk_v2/snyk_v2_task_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "rspec_helper"
require "timecop"
require_relative "snyk_v2_stubs"

RSpec.describe Kenna::Toolkit::SnykV2Task do
Expand All @@ -13,6 +14,9 @@
let(:options) { { snyk_api_token: '2dfbc991-a5e2-487b-a19c-eeb213bd0c7c', import_type: } }

before do
@now = Date.new(2024, 10, 8)
Timecop.freeze(@now)

stub_orgs_request
stub_projects_request
stub_issues_request
Expand Down
4 changes: 2 additions & 2 deletions tasks/connectors/snyk_v2/snyk_v2_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def self.metadata
default: nil,
description: "Snyk API Token" },
{ name: "retrieve_from",
type: "date",
type: "integer",
required: false,
default: 30,
description: "Default will be 30 days before today format: YYYY-MM-DD" },
description: "Default will be 30 days before today, format: integer" },
{ name: "include_license",
type: "boolean",
required: false,
Expand Down

0 comments on commit b1fb953

Please sign in to comment.