Skip to content

Commit 9c0f01a

Browse files
committed
Add integration test for validation of unique country slug.
Fix #495
1 parent acdbf24 commit 9c0f01a

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

src/main/resources/liquibase/version/0.4.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
<include file="0.4/2016-11-29--add-unique-key-transaction_participants-table.xml" relativeToChangelogFile="true" />
2525
<include file="0.4/2016-12-05--make_name_ru_optional.xml" relativeToChangelogFile="true" />
2626
<include file="0.4/2017-01-06--top_categories.xml" relativeToChangelogFile="true" />
27+
<include file="0.4/2017-01-25--united_kingdom_country.xml" relativeToChangelogFile="true" />
2728

2829
</databaseChangeLog>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
7+
8+
<changeSet id="add-united-kingdom-country" author="php-coder" context="test-data">
9+
10+
<insert tableName="countries">
11+
<column name="name" value="United Kingdom" />
12+
<column name="name_ru" value="Великобритания" />
13+
<column name="slug" value="united-kingdom" />
14+
<column name="created_at" valueComputed="${NOW}" />
15+
<column name="created_by" valueComputed="(SELECT id FROM users WHERE role = 'ADMIN' ORDER by id LIMIT 1)" />
16+
<column name="updated_at" valueComputed="${NOW}" />
17+
<column name="updated_by" valueComputed="(SELECT id FROM users WHERE role = 'ADMIN' ORDER by id LIMIT 1)" />
18+
</insert>
19+
20+
</changeSet>
21+
22+
</databaseChangeLog>

src/test/robotframework/country/creation/validation.robot

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ Create country with existing name but in a different case
7272
Element Text Should Be id=name.errors Country already exists
7373
Element Text Should Be id=nameRu.errors Country already exists
7474

75+
Create country with non-existing name but existing slug
76+
[Documentation] Verify validation of non-unique slug
77+
Input Text id=name United - Kingdom
78+
# clear a value after a previous test to prevent its validation and looking up in database
79+
Clear Element Text id=nameRu
80+
Submit Form id=add-country-form
81+
Element Text Should Be id=name.errors Country with similar name already exists
82+
7583
*** Keywords ***
7684
Before Test Suite
7785
[Documentation] Login as admin and go to create country page

0 commit comments

Comments
 (0)