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

update mdtranslator branch; add valid and invalid controller tests #4

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.2
3.3.4
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.2.2
FROM ruby:3.3.4

RUN apt-get update -q

Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.2.2'
ruby '3.3.4'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main'
gem 'rails', '~> 6.0.6', '>= 6.0.6.1'
Expand All @@ -23,7 +23,7 @@ gem 'psych', '< 4.0.0'

gem 'adiwg-mdtranslator',
git: 'https://github.com/GSA/mdTranslator.git',
branch: 'datagov'
branch: 'master'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
Expand Down
134 changes: 83 additions & 51 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GIT
remote: https://github.com/GSA/mdTranslator.git
revision: fe10f1d66171757f87be54e3053e0c09821500b4
branch: datagov
revision: 95b5c77ed64700e21c2cf0fc48158c9259eba8cf
branch: master
specs:
adiwg-mdtranslator (2.20.0.pre.beta.5)
adiwg-mdcodes (= 2.10.0)
Expand Down Expand Up @@ -74,76 +74,93 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
adiwg-mdcodes (2.10.0)
json (~> 2.0)
adiwg-mdjson_schemas (2.9.5)
ast (2.4.2)
bootsnap (1.17.0)
bootsnap (1.18.4)
msgpack (~> 1.2)
builder (3.2.4)
builder (3.3.0)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.2.2)
concurrent-ruby (1.3.4)
crass (1.0.6)
date (3.3.4)
erubi (1.12.0)
ffi (1.16.3)
date (3.4.0)
erubi (1.13.0)
ffi (1.17.0-aarch64-linux-gnu)
ffi (1.17.0-aarch64-linux-musl)
ffi (1.17.0-arm-linux-gnu)
ffi (1.17.0-arm-linux-musl)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86-linux-gnu)
ffi (1.17.0-x86-linux-musl)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
ffi (1.17.0-x86_64-linux-musl)
globalid (1.1.0)
activesupport (>= 5.0)
i18n (1.14.1)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
jbuilder (2.12.0)
jbuilder (2.13.0)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
json (2.7.1)
json (2.8.2)
json-schema (2.8.1)
addressable (>= 2.4)
kramdown (2.4.0)
rexml
language_server-protocol (3.17.0.3)
listen (3.8.0)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.22.0)
loofah (2.23.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
method_source (1.0.0)
marcel (1.0.4)
method_source (1.1.0)
mini_mime (1.1.5)
minitest (5.20.0)
msgpack (1.7.2)
net-imap (0.4.8)
minitest (5.25.1)
msgpack (1.7.5)
net-imap (0.5.1)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0)
net-smtp (0.5.0)
net-protocol
nio4r (2.7.0)
nokogiri (1.15.5-arm64-darwin)
nio4r (2.7.4)
nokogiri (1.16.7-aarch64-linux)
racc (~> 1.4)
nokogiri (1.15.5-x86_64-linux)
nokogiri (1.16.7-arm-linux)
racc (~> 1.4)
parallel (1.24.0)
parser (3.2.2.4)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86-linux)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
parallel (1.26.3)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
psych (3.3.4)
public_suffix (5.0.5)
public_suffix (6.0.1)
puma (4.3.12)
nio4r (~> 2.0)
racc (1.7.3)
rack (2.2.8)
racc (1.8.1)
rack (2.2.10)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.0.6.1)
Expand Down Expand Up @@ -175,30 +192,29 @@ GEM
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rainbow (3.1.1)
rake (13.1.0)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
rb-inotify (0.11.1)
ffi (~> 1.0)
regexp_parser (2.8.3)
rexml (3.2.6)
rubocop (1.59.0)
regexp_parser (2.9.2)
rexml (3.3.9)
rubocop (1.68.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-rails (2.23.1)
rubocop-ast (1.36.1)
parser (>= 3.3.1.0)
rubocop-rails (2.27.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
spring (2.1.1)
spring-watcher-listen (2.0.1)
Expand All @@ -211,25 +227,41 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.6.9-arm64-darwin)
sqlite3 (1.6.9-x86_64-linux)
sqlite3 (1.7.3-aarch64-linux)
sqlite3 (1.7.3-arm-linux)
sqlite3 (1.7.3-arm64-darwin)
sqlite3 (1.7.3-x86-linux)
sqlite3 (1.7.3-x86_64-darwin)
sqlite3 (1.7.3-x86_64-linux)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
thor (0.20.3)
thread_safe (0.3.6)
timeout (0.4.1)
timeout (0.4.2)
tzinfo (1.2.11)
thread_safe (~> 0.1)
unicode-display_width (2.5.0)
unicode-display_width (2.6.0)
uuidtools (2.2.0)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.12)
zeitwerk (2.7.1)

PLATFORMS
arm64-darwin-23
aarch64-linux
aarch64-linux-gnu
aarch64-linux-musl
arm-linux
arm-linux-gnu
arm-linux-musl
arm64-darwin
x86-linux
x86-linux-gnu
x86-linux-musl
x86_64-darwin
x86_64-linux
x86_64-linux-gnu
x86_64-linux-musl

DEPENDENCIES
adiwg-mdtranslator!
Expand All @@ -247,7 +279,7 @@ DEPENDENCIES
tzinfo-data

RUBY VERSION
ruby 3.2.2p53
ruby 3.3.4p94

BUNDLED WITH
2.4.21
2.5.18
1 change: 1 addition & 0 deletions config/initializers/application_controller_renderer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# ActiveSupport::Reloader.to_prepare do
Expand Down
1 change: 1 addition & 0 deletions config/initializers/backtrace_silencers.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
Expand Down
1 change: 1 addition & 0 deletions config/initializers/cors.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Avoid CORS issues when API is called from the frontend app.
Expand Down
1 change: 1 addition & 0 deletions config/initializers/inflections.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Add new inflection rules using the following format. Inflections
Expand Down
1 change: 1 addition & 0 deletions config/initializers/mime_types.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Add new mime types for use in respond_to blocks:
Expand Down
1 change: 1 addition & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
Expand Down
36 changes: 34 additions & 2 deletions test/controllers/translates_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TranslatesControllerTest < ActionDispatch::IntegrationTest
writer: @translate.writer
},
as: :json
assert_response 200
assert_response :ok
end

test 'post invalid transformation of fgdc to iso19115_3' do
Expand All @@ -32,6 +32,38 @@ class TranslatesControllerTest < ActionDispatch::IntegrationTest
writer: @translate.writer
},
as: :json
assert_response 422
assert_response :unprocessable_entity
end

test 'post valid transformation of iso19115_2_datagov to dcat_us' do
@translate = translates(:valid_iso19115_2_datagov_to_dcatus)
@file =
File.read(
File.join(File.dirname(__FILE__), "../fixtures/#{@translate.file}")
)
post '/translates',
params: {
file: @file,
reader: @translate.reader,
writer: @translate.writer
},
as: :json
assert_response :ok
end

test 'post invalid transformation of iso19115_2_datagov to dcat_us' do
@translate = translates(:invalid_iso19115_2_datagov_to_dcatus)
@file =
File.read(
File.join(File.dirname(__FILE__), "../fixtures/#{@translate.file}")
)
post '/translates',
params: {
file: @file,
reader: @translate.reader,
writer: @translate.writer
},
as: :json
assert_response :unprocessable_entity
end
end
Loading
Loading