From 792a79e68853041a1c1ddf57c44b4d17b964e914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Gonz=C3=A1lez=20Liarte?= Date: Fri, 5 Apr 2024 23:00:29 +0200 Subject: [PATCH 01/11] [TEST] Add GetSteps test --- .../steps/GetShelterCertificateStepDefs.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/test/java/cat/udl/eps/softarch/demo/steps/GetShelterCertificateStepDefs.java diff --git a/src/test/java/cat/udl/eps/softarch/demo/steps/GetShelterCertificateStepDefs.java b/src/test/java/cat/udl/eps/softarch/demo/steps/GetShelterCertificateStepDefs.java new file mode 100644 index 0000000..bafb9ec --- /dev/null +++ b/src/test/java/cat/udl/eps/softarch/demo/steps/GetShelterCertificateStepDefs.java @@ -0,0 +1,34 @@ +package cat.udl.eps.softarch.demo.steps; + +import cat.udl.eps.softarch.demo.domain.ShelterCertificate; +import cat.udl.eps.softarch.demo.repository.ShelterCertificateRepository; +import io.cucumber.java.en.When; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; + +import java.nio.charset.StandardCharsets; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; + +public class GetShelterCertificateStepDefs { + @Autowired + private StepDefs stepDefs; + + @Autowired + private ShelterCertificateRepository shelterCertificateRepository; + + @When("^I retrieve the shelter certificate with id \"([^\"]*)\"$") + public void iRetrieveShelterCertificateWithId(String id) throws Exception { + ShelterCertificate shelterCertificate = shelterCertificateRepository.findById(Long.parseLong(id)).orElse(null); + + stepDefs.result = stepDefs.mockMvc.perform( + get("/shelterCertificates/{id}", (shelterCertificate != null) ? shelterCertificate.getId() : "999") + .contentType(MediaType.APPLICATION_JSON) + .content(stepDefs.mapper.writeValueAsString(shelterCertificate)) + .characterEncoding(StandardCharsets.UTF_8) + .accept(MediaType.APPLICATION_JSON) + .with(AuthenticationStepDefs.authenticate())) + .andDo(print()); + } +} \ No newline at end of file From 8cd549efcafdc2c49ade5fd2d43a5c386410c472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Gonz=C3=A1lez=20Liarte?= Date: Fri, 5 Apr 2024 23:05:43 +0200 Subject: [PATCH 02/11] [TEST] Add DeleteSteps test --- .../DeleteShelterCertificateStepDefs.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/test/java/cat/udl/eps/softarch/demo/steps/DeleteShelterCertificateStepDefs.java diff --git a/src/test/java/cat/udl/eps/softarch/demo/steps/DeleteShelterCertificateStepDefs.java b/src/test/java/cat/udl/eps/softarch/demo/steps/DeleteShelterCertificateStepDefs.java new file mode 100644 index 0000000..6656f3e --- /dev/null +++ b/src/test/java/cat/udl/eps/softarch/demo/steps/DeleteShelterCertificateStepDefs.java @@ -0,0 +1,49 @@ +package cat.udl.eps.softarch.demo.steps; + +import cat.udl.eps.softarch.demo.domain.ShelterCertificate; +import cat.udl.eps.softarch.demo.repository.ShelterCertificateRepository; +import io.cucumber.java.en.And; +import io.cucumber.java.en.When; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; + +import java.nio.charset.StandardCharsets; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; + + +public class DeleteShelterCertificateStepDefs { + @Autowired + private StepDefs stepDefs; + + @Autowired + private ShelterCertificateRepository shelterCertificateRepository; + + @When("^I delete the shelter certificate with id \"([^\"]*)\"$") + public void iDeleteAShelterCertificateWithId(Long id) throws Exception { + ShelterCertificate shelterCertificate = shelterCertificateRepository.findById(id).orElse(null); + + stepDefs.result = stepDefs.mockMvc.perform( + delete("/shelterCertificates/{id}", (shelterCertificate != null) ? shelterCertificate.getId() : "999") + .contentType(MediaType.APPLICATION_JSON) + .content(stepDefs.mapper.writeValueAsString(shelterCertificate)) + .characterEncoding(StandardCharsets.UTF_8) + .accept(MediaType.APPLICATION_JSON) + .with(AuthenticationStepDefs.authenticate())) + .andDo(print()); + } + + @And("^The shelter certificate with id \"([^\"]*)\" has been deleted$") + public void theShelterCertificateWithIdHasBeenDeleted(Long id) { + boolean exists = shelterCertificateRepository.existsById(id); + assertThat(exists).isFalse(); + } + + @And("^The shelter certificate with id \"([^\"]*)\" has not been deleted$") + public void theShelterCertificateWithIdHasNotBeenDeleted(Long id) { + boolean exists = shelterCertificateRepository.existsById(id); + assertThat(exists).isTrue(); + } +} \ No newline at end of file From 8c90f7dfd4c830a7163a8513ca88b16e7c6b7948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Gonz=C3=A1lez=20Liarte?= Date: Fri, 5 Apr 2024 23:12:30 +0200 Subject: [PATCH 03/11] [TEST] Add RegisterSteps test --- .../RegisterShelterCertificateStepDefs.java | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/test/java/cat/udl/eps/softarch/demo/steps/RegisterShelterCertificateStepDefs.java diff --git a/src/test/java/cat/udl/eps/softarch/demo/steps/RegisterShelterCertificateStepDefs.java b/src/test/java/cat/udl/eps/softarch/demo/steps/RegisterShelterCertificateStepDefs.java new file mode 100644 index 0000000..a5cd42a --- /dev/null +++ b/src/test/java/cat/udl/eps/softarch/demo/steps/RegisterShelterCertificateStepDefs.java @@ -0,0 +1,85 @@ +package cat.udl.eps.softarch.demo.steps; + +import cat.udl.eps.softarch.demo.domain.Shelter; +import cat.udl.eps.softarch.demo.domain.ShelterCertificate; +import cat.udl.eps.softarch.demo.repository.ShelterCertificateRepository; +import cat.udl.eps.softarch.demo.repository.ShelterRepository; +import io.cucumber.java.ParameterType; +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; + +import java.nio.charset.StandardCharsets; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; + +public class RegisterShelterCertificateStepDefs { + + @Autowired + private StepDefs stepDefs; + + @Autowired + private ShelterCertificateRepository shelterCertificateRepository; + + @Autowired + private ShelterRepository shelterRepository; + + public static String newResourceUri; + + @ParameterType(value = "true|True|TRUE|false|False|FALSE") + public Boolean booleanValue(String value) { + return Boolean.valueOf(value); + } + + @When("I register a new shelter certificate with id \"([^\"]*)\" for shelter with name \"([^\"]*)\"$") + public void iRegisterANewShelterCertificateWithIdForShelterWithName(Long id, String shelterName) throws Exception { + ShelterCertificate shelterCertificate = new ShelterCertificate(); + shelterCertificate.setId(id); + + Shelter shelter = shelterRepository.findByName(shelterName); + shelterCertificate.setShelter(shelter); + + stepDefs.result = stepDefs.mockMvc.perform( + post("/shelterCertificates") + .contentType(MediaType.APPLICATION_JSON) + .content(stepDefs.mapper.writeValueAsString(shelterCertificate)) + .characterEncoding(StandardCharsets.UTF_8) + .accept(MediaType.APPLICATION_JSON) + .with(AuthenticationStepDefs.authenticate())) + .andDo(print()); + + newResourceUri = stepDefs.result.andReturn().getResponse().getHeader("Location"); + + } + + @Then("^It has been created a shelter certificate with id \"([^\"]*)\" for shelter with name \"([^\"]*)\"$") + public void itHasBeenCreatedAShelterCertificateWithIdForShelterWithName(Long id, String shelterName) { + ShelterCertificate createdShelterCertificate = shelterCertificateRepository.findById(id).orElse(null); + assertThat(createdShelterCertificate).isNotNull(); + assertThat(createdShelterCertificate.getShelter().getName()).isEqualTo(shelterName); + } + + @Then("^It has not been created a shelter certificate with id \"([^\"]*)\"$") + public void itHasNotBeenCreatedAShelterCertificateWithId(Long id) { + boolean exists = shelterCertificateRepository.existsById(id); + assertThat(exists).isFalse(); + } + + @Given("^There is a registered shelter certificate with id \"([^\"]*)\" for shelter with name \"([^\"]*)\"$") + public void thereIsARegisteredShelterCertificateWithIdForShelterWithName(Long id, String shelterName) { + ShelterCertificate shelterCertificate = new ShelterCertificate(); + shelterCertificate.setId(id); + + Shelter shelter = shelterRepository.findByName(shelterName); + shelterCertificate.setShelter(shelter); + + shelterCertificateRepository.save(shelterCertificate); + + boolean exists = shelterCertificateRepository.existsById(id); + assertThat(exists).isTrue(); + } +} \ No newline at end of file From 5019046caa60b9b71f7a2d5dbd98867197db5012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Gonz=C3=A1lez=20Liarte?= Date: Fri, 5 Apr 2024 23:24:44 +0200 Subject: [PATCH 04/11] [TEST] Add UpdateSteps test --- .../UpdateShelterCertificateStepDefs.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/test/java/cat/udl/eps/softarch/demo/steps/UpdateShelterCertificateStepDefs.java diff --git a/src/test/java/cat/udl/eps/softarch/demo/steps/UpdateShelterCertificateStepDefs.java b/src/test/java/cat/udl/eps/softarch/demo/steps/UpdateShelterCertificateStepDefs.java new file mode 100644 index 0000000..c71b657 --- /dev/null +++ b/src/test/java/cat/udl/eps/softarch/demo/steps/UpdateShelterCertificateStepDefs.java @@ -0,0 +1,50 @@ +package cat.udl.eps.softarch.demo.steps; + +import cat.udl.eps.softarch.demo.domain.ShelterCertificate; +import cat.udl.eps.softarch.demo.repository.ShelterCertificateRepository; +import io.cucumber.datatable.DataTable; +import io.cucumber.java.en.When; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; + +import java.nio.charset.StandardCharsets; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; + +public class UpdateShelterCertificateStepDefs { + @Autowired + private StepDefs stepDefs; + + @Autowired + private ShelterCertificateRepository shelterCertificateRepository; + + @When("^I update the shelter certificate with id \"([^\"]*)\" and new attributes:$") + public void iUpdateShelterCertificateWithId(Long id, DataTable table) throws Exception { + List> attributesList = table.asMaps(String.class, String.class); + + // Assuming only one row of attributes is provided, so taking the first map from the list + Map attributes = attributesList.get(0); + + // Fetch attributes from the map + String expirationDate = attributes.get("expirationDate"); + + ShelterCertificate shelterCertificate = shelterCertificateRepository.findById(id).orElse(null); + if (shelterCertificate != null) { + if (expirationDate != null) shelterCertificate.setExpirationDate(LocalDateTime.parse(expirationDate)); + } + + stepDefs.result = stepDefs.mockMvc.perform( + patch("/shelterCertificates/{id}", (shelterCertificate != null) ? shelterCertificate.getId() : "999") + .contentType(MediaType.APPLICATION_JSON) + .content(stepDefs.mapper.writeValueAsString(shelterCertificate)) + .characterEncoding(StandardCharsets.UTF_8) + .accept(MediaType.APPLICATION_JSON) + .with(AuthenticationStepDefs.authenticate())) + .andDo(print()); + + } +} \ No newline at end of file From f5ca2d3de52670d2d3ee5c35356111eb47e77c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Gonz=C3=A1lez=20Liarte?= Date: Fri, 5 Apr 2024 23:28:22 +0200 Subject: [PATCH 05/11] [TEST] Add GetShelterCertificateFeature test --- .../features/GetShelterCertificate.feature | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/resources/features/GetShelterCertificate.feature diff --git a/src/test/resources/features/GetShelterCertificate.feature b/src/test/resources/features/GetShelterCertificate.feature new file mode 100644 index 0000000..0cb8884 --- /dev/null +++ b/src/test/resources/features/GetShelterCertificate.feature @@ -0,0 +1,23 @@ +Feature: Get Shelter Certificate + In order to retrieve shelter certificate information + As a user with appropriate permissions + I want to be able to get shelter certificate details + + Background: + Given There is a registered user with username "username" and password "password" and email "user@email.com" + + Scenario: Get existing shelter certificate details + Given I can login with username "username" and password "password" + And There is a registered shelter certificate with id "1" for shelter with name "Shelter Certificate 1" + When I retrieve the shelter certificate with id "1" + Then The response code is 200 + + Scenario: Get non-existent shelter certificate details + Given I can login with username "username" and password "password" + When I retrieve the shelter certificate with id "999" + Then The response code is 404 + + Scenario: Get shelter certificate details when I am not logged in + Given I'm not logged in + When I retrieve the shelter certificate with id "1" + Then The response code is 404 \ No newline at end of file From 91a4cfb89d6a86b7e29eabcfcbfcac282b94d621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Gonz=C3=A1lez=20Liarte?= Date: Fri, 5 Apr 2024 23:31:16 +0200 Subject: [PATCH 06/11] [TEST] Add DeleteShelterCertificateFeature test --- .../features/DeleteShelterCertificate.feature | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/test/resources/features/DeleteShelterCertificate.feature diff --git a/src/test/resources/features/DeleteShelterCertificate.feature b/src/test/resources/features/DeleteShelterCertificate.feature new file mode 100644 index 0000000..71e92ad --- /dev/null +++ b/src/test/resources/features/DeleteShelterCertificate.feature @@ -0,0 +1,25 @@ +Feature: Delete Shelter Certificate + In order to maintain shelter certificate data + As a user with appropriate permissions + I want to be able to delete a shelter certificate + + Background: + Given There is a registered user with username "username" and password "password" and email "user@email.com" + And There is a registered shelter certificate with id "1" for shelter with name "Shelter Certificate 1" + + Scenario: Delete existing shelter certificate + Given I can login with username "username" and password "password" + When I delete the shelter certificate with id "1" + Then The response code is 200 + And The shelter certificate with id "1" has been deleted + + Scenario: Delete shelter certificate when I am not logged in + Given I'm not logged in + When I delete the shelter certificate with id "1" + Then The response code is 401 + And The shelter certificate with id "1" has not been deleted + + Scenario: Delete non-existent shelter certificate + Given I can login with username "username" and password "password" + When I delete the shelter certificate with id "999" + Then The response code is 404 \ No newline at end of file From 2bc35243537b0662a2905b65eacb3e10df8bf4b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Gonz=C3=A1lez=20Liarte?= Date: Fri, 5 Apr 2024 23:36:39 +0200 Subject: [PATCH 07/11] [TEST] Add RegisterShelterCertificateFeature test --- .../RegisterShelterCertificate.feature | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/test/resources/features/RegisterShelterCertificate.feature diff --git a/src/test/resources/features/RegisterShelterCertificate.feature b/src/test/resources/features/RegisterShelterCertificate.feature new file mode 100644 index 0000000..7e7a50a --- /dev/null +++ b/src/test/resources/features/RegisterShelterCertificate.feature @@ -0,0 +1,34 @@ +Feature: Register Shelter Certificate + In order to use the app + As a user + I want to register a Shelter Certificate + + Background: + Given There is a registered user with username "username" and password "password" and email "user@email.com" + + Scenario: Register existing shelter certificate + Given I can login with username "username" and password "password" + # And I am a user with role "ShelterVolunteer" Temporarily commented because we need to do first the Role tests + Given There is a registered shelter certificate with id "1" for shelter with name "existing_shelter" + When I register a new shelter certificate with id "2" for shelter with name "existing_shelter" + Then The response code is 409 + + Scenario: Register shelter certificate with no permission + Given I can login with username "username" and password "password" +# And I am a user with role "User" Temporarily commented because we need to do first the Role tests + When I register a new shelter certificate with id "1" for shelter with name "new_shelter" +# Then The response code is 403 Temporarily commented because we need to do first the Role tests + Then The response code is 201 +# And It has not been created a shelter certificate with id "1" Temporarily commented because we need to do first the Role tests + + Scenario: Register shelter certificate when I am not logged in + Given I'm not logged in + When I register a new shelter certificate with id "1" for shelter with name "new_shelter" + Then The response code is 401 + And It has not been created a shelter certificate with id "1" + + Scenario: Register shelter certificate with valid attributes + Given I can login with username "username" and password "password" + When I register a new shelter certificate with id "1" for shelter with name "new_shelter" + Then The response code is 201 + And It has been created a shelter certificate with id "1" for shelter with name "new_shelter" \ No newline at end of file From 44eb08e6fec5c2261a0f01d72cc95b1ef0390e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Gonz=C3=A1lez=20Liarte?= Date: Fri, 5 Apr 2024 23:37:16 +0200 Subject: [PATCH 08/11] [FIX] Unused method creating conflicts --- .../demo/steps/RegisterShelterCertificateStepDefs.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/test/java/cat/udl/eps/softarch/demo/steps/RegisterShelterCertificateStepDefs.java b/src/test/java/cat/udl/eps/softarch/demo/steps/RegisterShelterCertificateStepDefs.java index a5cd42a..8b30cbb 100644 --- a/src/test/java/cat/udl/eps/softarch/demo/steps/RegisterShelterCertificateStepDefs.java +++ b/src/test/java/cat/udl/eps/softarch/demo/steps/RegisterShelterCertificateStepDefs.java @@ -30,11 +30,6 @@ public class RegisterShelterCertificateStepDefs { public static String newResourceUri; - @ParameterType(value = "true|True|TRUE|false|False|FALSE") - public Boolean booleanValue(String value) { - return Boolean.valueOf(value); - } - @When("I register a new shelter certificate with id \"([^\"]*)\" for shelter with name \"([^\"]*)\"$") public void iRegisterANewShelterCertificateWithIdForShelterWithName(Long id, String shelterName) throws Exception { ShelterCertificate shelterCertificate = new ShelterCertificate(); From da290893ac9328e56103c46871c11d1a7a996080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Gonz=C3=A1lez=20Liarte?= Date: Fri, 5 Apr 2024 23:38:52 +0200 Subject: [PATCH 09/11] [TEST] Add UpdateShelterCertificateFeature test --- .../features/UpdateShelterCertificate.feature | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/test/resources/features/UpdateShelterCertificate.feature diff --git a/src/test/resources/features/UpdateShelterCertificate.feature b/src/test/resources/features/UpdateShelterCertificate.feature new file mode 100644 index 0000000..271ab79 --- /dev/null +++ b/src/test/resources/features/UpdateShelterCertificate.feature @@ -0,0 +1,30 @@ +Feature: Update Shelter Certificate + In order to maintain shelter certificate information + As a user with appropriate permissions + I want to be able to update a shelter certificate + + Background: + Given There is a registered user with username "username" and password "password" and email "user@email.com" + + Scenario: Update existing shelter certificate + Given I can login with username "username" and password "password" + And There is a registered shelter certificate with id "1" for shelter with name "existing_shelter" + When I update the shelter certificate with id "1" and new attributes: + | expirationDate | + | 2023-12-31T00:00:00 | + Then The response code is 200 + + Scenario: Update non-existent shelter certificate + Given I can login with username "username" and password "password" + When I update the shelter certificate with id "999" and new attributes: + | expirationDate | + | 2023-12-31T00:00:00 | + Then The response code is 404 + + Scenario: Update shelter certificate when I am not logged in + Given I'm not logged in + And There is a registered shelter certificate with id "1" for shelter with name "existing_shelter" + When I update the shelter certificate with id "1" and new attributes: + | expirationDate | + | 2023-12-31T00:00:00 | + Then The response code is 401 \ No newline at end of file From c3b16538991afa1581da64b88747d7330f5f8d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Gonz=C3=A1lez=20Liarte?= Date: Sat, 6 Apr 2024 00:28:31 +0200 Subject: [PATCH 10/11] [ADD] Remove NotNull --- .../cat/udl/eps/softarch/demo/domain/ShelterCertificate.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/ShelterCertificate.java b/src/main/java/cat/udl/eps/softarch/demo/domain/ShelterCertificate.java index 9d50754..9e18147 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/domain/ShelterCertificate.java +++ b/src/main/java/cat/udl/eps/softarch/demo/domain/ShelterCertificate.java @@ -13,7 +13,6 @@ @EqualsAndHashCode(callSuper = false) public class ShelterCertificate { @OneToOne - @NotNull @JsonIdentityReference(alwaysAsId = true) private Shelter shelter; @@ -21,7 +20,6 @@ public class ShelterCertificate { @GeneratedValue(strategy = GenerationType.AUTO) private Long id; - @NotNull private LocalDateTime expirationDate; } From 0eeb3e025d764ce867782954ee69d887c4a697fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Gonz=C3=A1lez=20Liarte?= Date: Sat, 6 Apr 2024 00:29:22 +0200 Subject: [PATCH 11/11] [FIX] Test RegisterShelterCertificate.feature --- .../resources/features/RegisterShelterCertificate.feature | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/test/resources/features/RegisterShelterCertificate.feature b/src/test/resources/features/RegisterShelterCertificate.feature index 7e7a50a..7056e2c 100644 --- a/src/test/resources/features/RegisterShelterCertificate.feature +++ b/src/test/resources/features/RegisterShelterCertificate.feature @@ -6,13 +6,6 @@ Feature: Register Shelter Certificate Background: Given There is a registered user with username "username" and password "password" and email "user@email.com" - Scenario: Register existing shelter certificate - Given I can login with username "username" and password "password" - # And I am a user with role "ShelterVolunteer" Temporarily commented because we need to do first the Role tests - Given There is a registered shelter certificate with id "1" for shelter with name "existing_shelter" - When I register a new shelter certificate with id "2" for shelter with name "existing_shelter" - Then The response code is 409 - Scenario: Register shelter certificate with no permission Given I can login with username "username" and password "password" # And I am a user with role "User" Temporarily commented because we need to do first the Role tests @@ -29,6 +22,7 @@ Feature: Register Shelter Certificate Scenario: Register shelter certificate with valid attributes Given I can login with username "username" and password "password" + And I register a new shelter with name "new_shelter", email "test@example.com", mobile "+34 123 456 789" and isActive True When I register a new shelter certificate with id "1" for shelter with name "new_shelter" Then The response code is 201 And It has been created a shelter certificate with id "1" for shelter with name "new_shelter" \ No newline at end of file