Fix another bug with one_to_one
This commit is contained in:
parent
7084ce6c9f
commit
43ec917a57
2 changed files with 37 additions and 2 deletions
|
@ -34,7 +34,7 @@ func TestTextsFromForeignKey(t *testing.T) {
|
|||
|
||||
expect.Function.PackageName = "models"
|
||||
expect.Function.Name = "Pilot"
|
||||
expect.Function.ForeignName = "Jets"
|
||||
expect.Function.ForeignName = "Jet"
|
||||
expect.Function.Varname = "pilot"
|
||||
expect.Function.Receiver = "j"
|
||||
expect.Function.ReverseInserts = false
|
||||
|
@ -45,6 +45,37 @@ func TestTextsFromForeignKey(t *testing.T) {
|
|||
if !reflect.DeepEqual(expect, texts) {
|
||||
t.Errorf("Want:\n%s\nGot:\n%s\n", spew.Sdump(expect), spew.Sdump(texts))
|
||||
}
|
||||
|
||||
texts = textsFromForeignKey("models", tables, jets, jets.FKeys[1])
|
||||
expect = RelationshipToOneTexts{}
|
||||
expect.ForeignKey = jets.FKeys[1]
|
||||
|
||||
expect.LocalTable.NameGo = "Jet"
|
||||
expect.LocalTable.ColumnNameGo = "AirportID"
|
||||
|
||||
expect.ForeignTable.Name = "airports"
|
||||
expect.ForeignTable.NameGo = "Airport"
|
||||
expect.ForeignTable.NamePluralGo = "Airports"
|
||||
expect.ForeignTable.ColumnName = "id"
|
||||
expect.ForeignTable.ColumnNameGo = "ID"
|
||||
|
||||
expect.Function.PackageName = "models"
|
||||
expect.Function.Name = "Airport"
|
||||
expect.Function.ForeignName = "Jets"
|
||||
expect.Function.Varname = "airport"
|
||||
expect.Function.Receiver = "j"
|
||||
expect.Function.ReverseInserts = false
|
||||
|
||||
expect.Function.LocalAssignment = "AirportID"
|
||||
expect.Function.ForeignAssignment = "ID"
|
||||
|
||||
if !reflect.DeepEqual(expect, texts) {
|
||||
t.Errorf("Want:\n%s\nGot:\n%s\n", spew.Sdump(expect), spew.Sdump(texts))
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(expect, texts) {
|
||||
t.Errorf("Want:\n%s\nGot:\n%s\n", spew.Sdump(expect), spew.Sdump(texts))
|
||||
}
|
||||
}
|
||||
|
||||
func TestTextsFromOneToOneRelationship(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue