Skip to content

Commit

Permalink
refactor(#32): Move anonymizers unit tests data to .testdata directory
Browse files Browse the repository at this point in the history
  • Loading branch information
borisershov committed Nov 13, 2024
1 parent 9d0a3f0 commit 4be6f6a
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
File renamed without changes.
12 changes: 6 additions & 6 deletions modules/anonymizers/mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestMySQL(t *testing.T) {

var r, e bytes.Buffer

fin, err := os.Open("mysql_test.in.sql")
fin, err := os.Open(".testdata/mysql_test.in.sql")
if err != nil {
t.Fatal("open input SQL:", err)
}
Expand Down Expand Up @@ -63,7 +63,7 @@ func TestMySQL(t *testing.T) {
t.Fatal("run MySQL:", err)
}

fout, err := os.Open("mysql_test.out.sql")
fout, err := os.Open(".testdata/mysql_test.out.sql")
if err != nil {
t.Fatal("open output SQL:", err)
}
Expand All @@ -72,7 +72,7 @@ func TestMySQL(t *testing.T) {
t.Fatal("read output SQL:", err)
}

// os.WriteFile("mysql_test.out.sql", r.Bytes(), 0644)
// os.WriteFile(".testdata/mysql_test.out.sql", r.Bytes(), 0644)

if r.String() != e.String() {
t.Fatal("incorrect anonymization result")
Expand All @@ -85,7 +85,7 @@ func TestMySQLDos(t *testing.T) {

var r, e bytes.Buffer

fin, err := os.Open("mysql_test.dos.in.sql")
fin, err := os.Open(".testdata/mysql_test.dos.in.sql")
if err != nil {
t.Fatal("open input SQL:", err)
}
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestMySQLDos(t *testing.T) {
t.Fatal("run MySQL:", err)
}

fout, err := os.Open("mysql_test.dos.out.sql")
fout, err := os.Open(".testdata/mysql_test.dos.out.sql")
if err != nil {
t.Fatal("open output SQL:", err)
}
Expand All @@ -143,7 +143,7 @@ func TestMySQLDos(t *testing.T) {
t.Fatal("read output SQL:", err)
}

// os.WriteFile("mysql_test.dos.out.sql", r.Bytes(), 0644)
// os.WriteFile(".testdata/mysql_test.dos.out.sql", r.Bytes(), 0644)

if r.String() != e.String() {
t.Fatal("incorrect anonymization result")
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions modules/anonymizers/pgsql/pgsql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestPgSQL(t *testing.T) {

var r, e bytes.Buffer

fin, err := os.Open("pgsql_test.in.sql")
fin, err := os.Open(".testdata/pgsql_test.in.sql")
if err != nil {
t.Fatal("open input SQL:", err)
}
Expand Down Expand Up @@ -63,7 +63,7 @@ func TestPgSQL(t *testing.T) {
t.Fatal("run PgSQL:", err)
}

fout, err := os.Open("pgsql_test.out.sql")
fout, err := os.Open(".testdata/pgsql_test.out.sql")
if err != nil {
t.Fatal("open output SQL:", err)
}
Expand All @@ -72,7 +72,7 @@ func TestPgSQL(t *testing.T) {
t.Fatal("read output SQL:", err)
}

// os.WriteFile("pgsql_test.out.sql", r.Bytes(), 0644)
// os.WriteFile(".testdata/pgsql_test.out.sql", r.Bytes(), 0644)

if r.String() != e.String() {
t.Fatal("incorrect anonymization result")
Expand All @@ -85,7 +85,7 @@ func TestPgSQLDos(t *testing.T) {

var r, e bytes.Buffer

fin, err := os.Open("pgsql_test.dos.in.sql")
fin, err := os.Open(".testdata/pgsql_test.dos.in.sql")
if err != nil {
t.Fatal("open input SQL:", err)
}
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestPgSQLDos(t *testing.T) {
t.Fatal("run PgSQL:", err)
}

fout, err := os.Open("pgsql_test.dos.out.sql")
fout, err := os.Open(".testdata/pgsql_test.dos.out.sql")
if err != nil {
t.Fatal("open output SQL:", err)
}
Expand All @@ -143,7 +143,7 @@ func TestPgSQLDos(t *testing.T) {
t.Fatal("read output SQL:", err)
}

// os.WriteFile("pgsql_test.dos.out.sql", r.Bytes(), 0644)
// os.WriteFile(".testdata/pgsql_test.dos.out.sql", r.Bytes(), 0644)

if r.String() != e.String() {
t.Fatal("incorrect anonymization result")
Expand Down

0 comments on commit 4be6f6a

Please sign in to comment.