From 90a6302a6565d208a6ab298fda41a47836a63d9c Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 21 Feb 2019 16:49:28 +0800 Subject: [PATCH] rename test files to conform to style guide (#2206) --- .../codegen/languages/RClientCodegen.java | 4 +- .../{test_category.R => category_test.R} | 0 ...i_response.R => model_api_response_test.R} | 0 .../testthat/{test_order.R => order_test.R} | 12 +++--- .../{test_pet_api.R => pet_api_test.R} | 42 +++++++++---------- .../tests/testthat/{test_pet.R => pet_test.R} | 6 +-- .../{test_store_api.R => store_api_test.R} | 14 +++---- .../tests/testthat/{test_tag.R => tag_test.R} | 0 .../{test_user_api.R => user_api_test.R} | 34 +++++++-------- .../testthat/{test_user.R => user_test.R} | 18 ++++---- 10 files changed, 65 insertions(+), 65 deletions(-) rename samples/client/petstore/R/tests/testthat/{test_category.R => category_test.R} (100%) rename samples/client/petstore/R/tests/testthat/{test_model_api_response.R => model_api_response_test.R} (100%) rename samples/client/petstore/R/tests/testthat/{test_order.R => order_test.R} (78%) rename samples/client/petstore/R/tests/testthat/{test_pet_api.R => pet_api_test.R} (61%) rename samples/client/petstore/R/tests/testthat/{test_pet.R => pet_test.R} (88%) rename samples/client/petstore/R/tests/testthat/{test_store_api.R => store_api_test.R} (76%) rename samples/client/petstore/R/tests/testthat/{test_tag.R => tag_test.R} (100%) rename samples/client/petstore/R/tests/testthat/{test_user_api.R => user_api_test.R} (68%) rename samples/client/petstore/R/tests/testthat/{test_user.R => user_test.R} (73%) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java index 6b04efc0b0b5..bb49968142fe 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java @@ -626,11 +626,11 @@ public String modelTestFileFolder() { @Override public String toApiTestFilename(String name) { - return "test_" + toApiFilename(name); + return toApiFilename(name) + "_test"; } @Override public String toModelTestFilename(String name) { - return "test_" + toModelFilename(name); + return toModelFilename(name) + "_test"; } } diff --git a/samples/client/petstore/R/tests/testthat/test_category.R b/samples/client/petstore/R/tests/testthat/category_test.R similarity index 100% rename from samples/client/petstore/R/tests/testthat/test_category.R rename to samples/client/petstore/R/tests/testthat/category_test.R diff --git a/samples/client/petstore/R/tests/testthat/test_model_api_response.R b/samples/client/petstore/R/tests/testthat/model_api_response_test.R similarity index 100% rename from samples/client/petstore/R/tests/testthat/test_model_api_response.R rename to samples/client/petstore/R/tests/testthat/model_api_response_test.R diff --git a/samples/client/petstore/R/tests/testthat/test_order.R b/samples/client/petstore/R/tests/testthat/order_test.R similarity index 78% rename from samples/client/petstore/R/tests/testthat/test_order.R rename to samples/client/petstore/R/tests/testthat/order_test.R index 5fb144f9372b..33b87520254d 100644 --- a/samples/client/petstore/R/tests/testthat/test_order.R +++ b/samples/client/petstore/R/tests/testthat/order_test.R @@ -12,11 +12,11 @@ test_that("id", { #expect_equal(model.instance$`id`, "EXPECTED_RESULT") }) -test_that("pet_id", { - # tests for the property `pet_id` (integer) +test_that("petId", { + # tests for the property `petId` (integer) # uncomment below to test the property - #expect_equal(model.instance$`pet_id`, "EXPECTED_RESULT") + #expect_equal(model.instance$`petId`, "EXPECTED_RESULT") }) test_that("quantity", { @@ -26,11 +26,11 @@ test_that("quantity", { #expect_equal(model.instance$`quantity`, "EXPECTED_RESULT") }) -test_that("ship_date", { - # tests for the property `ship_date` (character) +test_that("shipDate", { + # tests for the property `shipDate` (character) # uncomment below to test the property - #expect_equal(model.instance$`ship_date`, "EXPECTED_RESULT") + #expect_equal(model.instance$`shipDate`, "EXPECTED_RESULT") }) test_that("status", { diff --git a/samples/client/petstore/R/tests/testthat/test_pet_api.R b/samples/client/petstore/R/tests/testthat/pet_api_test.R similarity index 61% rename from samples/client/petstore/R/tests/testthat/test_pet_api.R rename to samples/client/petstore/R/tests/testthat/pet_api_test.R index 021f6228af90..95f773d590dd 100644 --- a/samples/client/petstore/R/tests/testthat/test_pet_api.R +++ b/samples/client/petstore/R/tests/testthat/pet_api_test.R @@ -7,9 +7,9 @@ api.instance <- PetApi$new() test_that("AddPet", { # tests for AddPet + # base path: http://petstore.swagger.io/v2 # Add a new pet to the store - # @param body Pet object that needs to be added to the store - # @param [Hash] opts the optional parameters + # @param Pet body Pet object that needs to be added to the store # @return [Void] # uncomment below to test the operation @@ -18,10 +18,10 @@ test_that("AddPet", { test_that("DeletePet", { # tests for DeletePet + # base path: http://petstore.swagger.io/v2 # Deletes a pet - # @param pet.id Pet id to delete - # @param [Hash] opts the optional parameters - # @option opts [character] :api.key + # @param integer pet.id Pet id to delete + # @param character api.key (optional) # @return [Void] # uncomment below to test the operation @@ -30,10 +30,10 @@ test_that("DeletePet", { test_that("FindPetsByStatus", { # tests for FindPetsByStatus + # base path: http://petstore.swagger.io/v2 # Finds Pets by status # Multiple status values can be provided with comma separated strings - # @param status Status values that need to be considered for filter - # @param [Hash] opts the optional parameters + # @param character status Status values that need to be considered for filter # @return [Pet] # uncomment below to test the operation @@ -42,10 +42,10 @@ test_that("FindPetsByStatus", { test_that("FindPetsByTags", { # tests for FindPetsByTags + # base path: http://petstore.swagger.io/v2 # Finds Pets by tags # Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - # @param tags Tags to filter by - # @param [Hash] opts the optional parameters + # @param character tags Tags to filter by # @return [Pet] # uncomment below to test the operation @@ -54,10 +54,10 @@ test_that("FindPetsByTags", { test_that("GetPetById", { # tests for GetPetById + # base path: http://petstore.swagger.io/v2 # Find pet by ID # Returns a single pet - # @param pet.id ID of pet to return - # @param [Hash] opts the optional parameters + # @param integer pet.id ID of pet to return # @return [Pet] # uncomment below to test the operation @@ -66,9 +66,9 @@ test_that("GetPetById", { test_that("UpdatePet", { # tests for UpdatePet + # base path: http://petstore.swagger.io/v2 # Update an existing pet - # @param body Pet object that needs to be added to the store - # @param [Hash] opts the optional parameters + # @param Pet body Pet object that needs to be added to the store # @return [Void] # uncomment below to test the operation @@ -77,11 +77,11 @@ test_that("UpdatePet", { test_that("UpdatePetWithForm", { # tests for UpdatePetWithForm + # base path: http://petstore.swagger.io/v2 # Updates a pet in the store with form data - # @param pet.id ID of pet that needs to be updated - # @param [Hash] opts the optional parameters - # @option opts [character] :name Updated name of the pet - # @option opts [character] :status Updated status of the pet + # @param integer pet.id ID of pet that needs to be updated + # @param character name Updated name of the pet (optional) + # @param character status Updated status of the pet (optional) # @return [Void] # uncomment below to test the operation @@ -90,11 +90,11 @@ test_that("UpdatePetWithForm", { test_that("UploadFile", { # tests for UploadFile + # base path: http://petstore.swagger.io/v2 # uploads an image - # @param pet.id ID of pet to update - # @param [Hash] opts the optional parameters - # @option opts [character] :additional.metadata Additional data to pass to server - # @option opts [data.frame] :file file to upload + # @param integer pet.id ID of pet to update + # @param character additional.metadata Additional data to pass to server (optional) + # @param data.frame file file to upload (optional) # @return [ModelApiResponse] # uncomment below to test the operation diff --git a/samples/client/petstore/R/tests/testthat/test_pet.R b/samples/client/petstore/R/tests/testthat/pet_test.R similarity index 88% rename from samples/client/petstore/R/tests/testthat/test_pet.R rename to samples/client/petstore/R/tests/testthat/pet_test.R index 8d3ce54a55d1..3120af1e2b6d 100644 --- a/samples/client/petstore/R/tests/testthat/test_pet.R +++ b/samples/client/petstore/R/tests/testthat/pet_test.R @@ -26,11 +26,11 @@ test_that("name", { #expect_equal(model.instance$`name`, "EXPECTED_RESULT") }) -test_that("photo_urls", { - # tests for the property `photo_urls` (character) +test_that("photoUrls", { + # tests for the property `photoUrls` (character) # uncomment below to test the property - #expect_equal(model.instance$`photo_urls`, "EXPECTED_RESULT") + #expect_equal(model.instance$`photoUrls`, "EXPECTED_RESULT") }) test_that("tags", { diff --git a/samples/client/petstore/R/tests/testthat/test_store_api.R b/samples/client/petstore/R/tests/testthat/store_api_test.R similarity index 76% rename from samples/client/petstore/R/tests/testthat/test_store_api.R rename to samples/client/petstore/R/tests/testthat/store_api_test.R index e1290358b43f..730a825e103d 100644 --- a/samples/client/petstore/R/tests/testthat/test_store_api.R +++ b/samples/client/petstore/R/tests/testthat/store_api_test.R @@ -7,10 +7,10 @@ api.instance <- StoreApi$new() test_that("DeleteOrder", { # tests for DeleteOrder + # base path: http://petstore.swagger.io/v2 # Delete purchase order by ID # For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - # @param order.id ID of the order that needs to be deleted - # @param [Hash] opts the optional parameters + # @param character order.id ID of the order that needs to be deleted # @return [Void] # uncomment below to test the operation @@ -19,9 +19,9 @@ test_that("DeleteOrder", { test_that("GetInventory", { # tests for GetInventory + # base path: http://petstore.swagger.io/v2 # Returns pet inventories by status # Returns a map of status codes to quantities - # @param [Hash] opts the optional parameters # @return [integer] # uncomment below to test the operation @@ -30,10 +30,10 @@ test_that("GetInventory", { test_that("GetOrderById", { # tests for GetOrderById + # base path: http://petstore.swagger.io/v2 # Find purchase order by ID # For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - # @param order.id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters + # @param integer order.id ID of pet that needs to be fetched # @return [Order] # uncomment below to test the operation @@ -42,9 +42,9 @@ test_that("GetOrderById", { test_that("PlaceOrder", { # tests for PlaceOrder + # base path: http://petstore.swagger.io/v2 # Place an order for a pet - # @param body order placed for purchasing the pet - # @param [Hash] opts the optional parameters + # @param Order body order placed for purchasing the pet # @return [Order] # uncomment below to test the operation diff --git a/samples/client/petstore/R/tests/testthat/test_tag.R b/samples/client/petstore/R/tests/testthat/tag_test.R similarity index 100% rename from samples/client/petstore/R/tests/testthat/test_tag.R rename to samples/client/petstore/R/tests/testthat/tag_test.R diff --git a/samples/client/petstore/R/tests/testthat/test_user_api.R b/samples/client/petstore/R/tests/testthat/user_api_test.R similarity index 68% rename from samples/client/petstore/R/tests/testthat/test_user_api.R rename to samples/client/petstore/R/tests/testthat/user_api_test.R index 283c7c7e964f..33d45a585a17 100644 --- a/samples/client/petstore/R/tests/testthat/test_user_api.R +++ b/samples/client/petstore/R/tests/testthat/user_api_test.R @@ -7,10 +7,10 @@ api.instance <- UserApi$new() test_that("CreateUser", { # tests for CreateUser + # base path: http://petstore.swagger.io/v2 # Create user # This can only be done by the logged in user. - # @param body Created user object - # @param [Hash] opts the optional parameters + # @param User body Created user object # @return [Void] # uncomment below to test the operation @@ -19,9 +19,9 @@ test_that("CreateUser", { test_that("CreateUsersWithArrayInput", { # tests for CreateUsersWithArrayInput + # base path: http://petstore.swagger.io/v2 # Creates list of users with given input array - # @param body List of user object - # @param [Hash] opts the optional parameters + # @param User body List of user object # @return [Void] # uncomment below to test the operation @@ -30,9 +30,9 @@ test_that("CreateUsersWithArrayInput", { test_that("CreateUsersWithListInput", { # tests for CreateUsersWithListInput + # base path: http://petstore.swagger.io/v2 # Creates list of users with given input array - # @param body List of user object - # @param [Hash] opts the optional parameters + # @param User body List of user object # @return [Void] # uncomment below to test the operation @@ -41,10 +41,10 @@ test_that("CreateUsersWithListInput", { test_that("DeleteUser", { # tests for DeleteUser + # base path: http://petstore.swagger.io/v2 # Delete user # This can only be done by the logged in user. - # @param username The name that needs to be deleted - # @param [Hash] opts the optional parameters + # @param character username The name that needs to be deleted # @return [Void] # uncomment below to test the operation @@ -53,9 +53,9 @@ test_that("DeleteUser", { test_that("GetUserByName", { # tests for GetUserByName + # base path: http://petstore.swagger.io/v2 # Get user by user name - # @param username The name that needs to be fetched. Use user1 for testing. - # @param [Hash] opts the optional parameters + # @param character username The name that needs to be fetched. Use user1 for testing. # @return [User] # uncomment below to test the operation @@ -64,10 +64,10 @@ test_that("GetUserByName", { test_that("LoginUser", { # tests for LoginUser + # base path: http://petstore.swagger.io/v2 # Logs user into the system - # @param username The user name for login - # @param password The password for login in clear text - # @param [Hash] opts the optional parameters + # @param character username The user name for login + # @param character password The password for login in clear text # @return [character] # uncomment below to test the operation @@ -76,8 +76,8 @@ test_that("LoginUser", { test_that("LogoutUser", { # tests for LogoutUser + # base path: http://petstore.swagger.io/v2 # Logs out current logged in user session - # @param [Hash] opts the optional parameters # @return [Void] # uncomment below to test the operation @@ -86,11 +86,11 @@ test_that("LogoutUser", { test_that("UpdateUser", { # tests for UpdateUser + # base path: http://petstore.swagger.io/v2 # Updated user # This can only be done by the logged in user. - # @param username name that need to be deleted - # @param body Updated user object - # @param [Hash] opts the optional parameters + # @param character username name that need to be deleted + # @param User body Updated user object # @return [Void] # uncomment below to test the operation diff --git a/samples/client/petstore/R/tests/testthat/test_user.R b/samples/client/petstore/R/tests/testthat/user_test.R similarity index 73% rename from samples/client/petstore/R/tests/testthat/test_user.R rename to samples/client/petstore/R/tests/testthat/user_test.R index 401196a90d76..9929623b42f8 100644 --- a/samples/client/petstore/R/tests/testthat/test_user.R +++ b/samples/client/petstore/R/tests/testthat/user_test.R @@ -19,18 +19,18 @@ test_that("username", { #expect_equal(model.instance$`username`, "EXPECTED_RESULT") }) -test_that("first_name", { - # tests for the property `first_name` (character) +test_that("firstName", { + # tests for the property `firstName` (character) # uncomment below to test the property - #expect_equal(model.instance$`first_name`, "EXPECTED_RESULT") + #expect_equal(model.instance$`firstName`, "EXPECTED_RESULT") }) -test_that("last_name", { - # tests for the property `last_name` (character) +test_that("lastName", { + # tests for the property `lastName` (character) # uncomment below to test the property - #expect_equal(model.instance$`last_name`, "EXPECTED_RESULT") + #expect_equal(model.instance$`lastName`, "EXPECTED_RESULT") }) test_that("email", { @@ -54,11 +54,11 @@ test_that("phone", { #expect_equal(model.instance$`phone`, "EXPECTED_RESULT") }) -test_that("user_status", { - # tests for the property `user_status` (integer) +test_that("userStatus", { + # tests for the property `userStatus` (integer) # User Status # uncomment below to test the property - #expect_equal(model.instance$`user_status`, "EXPECTED_RESULT") + #expect_equal(model.instance$`userStatus`, "EXPECTED_RESULT") })