From f9ae0870d622016bcd92870478a2ce8b758cc593 Mon Sep 17 00:00:00 2001 From: Ikhtiyor Ahmedov Date: Fri, 31 Aug 2018 17:02:50 +0500 Subject: [PATCH] code quality --- main_test.go | 16 ++++++++-------- migration_test.go | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/main_test.go b/main_test.go index 369cc2d3..ae483971 100644 --- a/main_test.go +++ b/main_test.go @@ -913,7 +913,7 @@ func TestSaveAssociations(t *testing.T) { // owner address should be created, place address should be reused place1 := &Place{ - PlaceAddressId: placeAddress.ID, + PlaceAddressID: placeAddress.ID, PlaceAddress: placeAddress, OwnerAddress: ownerAddress1, } @@ -925,13 +925,13 @@ func TestSaveAssociations(t *testing.T) { // owner address should be created again, place address should be reused place2 := &Place{ - PlaceAddressId: placeAddress.ID, + PlaceAddressID: placeAddress.ID, PlaceAddress: &Address{ ID: 777, Address1: "address1", }, OwnerAddress: ownerAddress2, - OwnerAddressId: 778, + OwnerAddressID: 778, } err = db.Create(place2).Error if err != nil { @@ -941,8 +941,8 @@ func TestSaveAssociations(t *testing.T) { count := 0 db.Model(&Place{}).Where(&Place{ - PlaceAddressId: placeAddress.ID, - OwnerAddressId: ownerAddress1.ID, + PlaceAddressID: placeAddress.ID, + OwnerAddressID: ownerAddress1.ID, }).Count(&count) if count != 1 { t.Errorf("only one instance of (%d, %d) should be available, found: %d", @@ -950,8 +950,8 @@ func TestSaveAssociations(t *testing.T) { } db.Model(&Place{}).Where(&Place{ - PlaceAddressId: placeAddress.ID, - OwnerAddressId: ownerAddress2.ID, + PlaceAddressID: placeAddress.ID, + OwnerAddressID: ownerAddress2.ID, }).Count(&count) if count != 1 { t.Errorf("only one instance of (%d, %d) should be available, found: %d", @@ -959,7 +959,7 @@ func TestSaveAssociations(t *testing.T) { } db.Model(&Place{}).Where(&Place{ - PlaceAddressId: placeAddress.ID, + PlaceAddressID: placeAddress.ID, }).Count(&count) if count != 2 { t.Errorf("two instances of (%d) should be available, found: %d", diff --git a/migration_test.go b/migration_test.go index 6ba4f134..3fb06648 100644 --- a/migration_test.go +++ b/migration_test.go @@ -120,9 +120,9 @@ type Company struct { type Place struct { Id int64 - PlaceAddressId int + PlaceAddressID int PlaceAddress *Address `gorm:"save_associations:false"` - OwnerAddressId int + OwnerAddressID int OwnerAddress *Address `gorm:"save_associations:true"` }