- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 23 for pet2 (0.07 sec)
-
tests/test_response_model_data_filter_no_inheritance.py
hashed_password="secrethashed", ) pet1 = PetDB(name="Nibbler", owner=user) pet2 = PetDB(name="Zoidberg", owner=user) return [pet1, pet2] client = TestClient(app) def test_filter_top_level_model(): response = client.post( "/users", json={"email": "******@****.***", "password": "secret"} ) assert response.json() == {"email": "******@****.***"}
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 1.7K bytes - Viewed (0) -
tests/update_has_one_test.go
pet.Toy.Name += "new" if err := DB.Save(&pet).Error; err != nil { t.Fatalf("errors happened when update: %v", err) } var pet3 Pet DB.Preload("Toy").Find(&pet3, "id = ?", pet.ID) CheckPet(t, pet2, pet3) if err := DB.Session(&gorm.Session{FullSaveAssociations: true}).Save(&pet).Error; err != nil { t.Fatalf("errors happened when update: %v", err) } var pet4 Pet DB.Preload("Toy").Find(&pet4, "id = ?", pet.ID)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jul 14 06:55:54 UTC 2022 - 3.6K bytes - Viewed (0) -
tests/associations_has_one_test.go
func TestPolymorphicHasOneAssociation(t *testing.T) { pet := Pet{Name: "hasone", Toy: Toy{Name: "toy-has-one"}} if err := DB.Create(&pet).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } CheckPet(t, pet, pet) // Find var pet2 Pet DB.Find(&pet2, "id = ?", pet.ID) DB.Model(&pet2).Association("Toy").Find(&pet2.Toy) CheckPet(t, pet2, pet) // Count
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 7.1K bytes - Viewed (0) -
tests/test_response_model_data_filter.py
hashed_password="secrethashed", ) pet1 = PetDB(name="Nibbler", owner=user) pet2 = PetDB(name="Zoidberg", owner=user) return [pet1, pet2] client = TestClient(app) def test_filter_top_level_model(): response = client.post( "/users", json={"email": "******@****.***", "password": "secret"} ) assert response.json() == {"email": "******@****.***"}
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 1.7K bytes - Viewed (0) -
tests/update_has_many_test.go
t.Fatalf("errors happened when create: %v", err) } user.Pets = []*Pet{{Name: "pet1"}, {Name: "pet2"}} if err := DB.Save(&user).Error; err != nil { t.Fatalf("errors happened when update: %v", err) } var user2 User DB.Preload("Pets").Find(&user2, "id = ?", user.ID) CheckUser(t, user2, user) for _, pet := range user.Pets { pet.Name += "new" } if err := DB.Save(&user).Error; err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 2K bytes - Viewed (0) -
tests/helper_test.go
} } }) t.Run("Pets", func(t *testing.T) { if len(user.Pets) != len(expect.Pets) { t.Fatalf("pets should equal, expect: %v, got %v", len(expect.Pets), len(user.Pets)) } sort.Slice(user.Pets, func(i, j int) bool { return user.Pets[i].ID > user.Pets[j].ID }) sort.Slice(expect.Pets, func(i, j int) bool { return expect.Pets[i].ID > expect.Pets[j].ID })
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 8K bytes - Viewed (0) -
utils/tests/models.go
) // User has one `Account` (has one), many `Pets` (has many) and `Toys` (has many - polymorphic) // He works in a Company (belongs to), he has a Manager (belongs to - single-table), and also managed a Team (has many - single-table) // He speaks many languages (many to many) and has many friends (many to many - single-table) // His pet also has one Toy (has one - polymorphic) // NamedPet is a reference to a named `Pet` (has one) type User struct { gorm.Model
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Dec 15 08:36:08 UTC 2023 - 2.1K bytes - Viewed (0) -
schema/model_test.go
"database/sql" "time" "gorm.io/gorm" "gorm.io/gorm/utils/tests" ) type User struct { *gorm.Model Name *string Age *uint Birthday *time.Time Account *tests.Account Pets []*tests.Pet Toys []*tests.Toy `gorm:"polymorphic:Owner"` CompanyID *int Company *tests.Company ManagerID *uint Manager *User Team []*User `gorm:"foreignkey:ManagerID"`
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 1.1K bytes - Viewed (0) -
tests/delete_test.go
*GetUser("delete_slice_with_associations1", Config{Account: true, Pets: 4, Toys: 1, Company: true, Manager: true, Team: 1, Languages: 1, Friends: 4}), *GetUser("delete_slice_with_associations2", Config{Account: true, Pets: 3, Toys: 2, Company: true, Manager: true, Team: 2, Languages: 2, Friends: 3}), *GetUser("delete_slice_with_associations3", Config{Account: true, Pets: 2, Toys: 3, Company: true, Manager: true, Team: 3, Languages: 3, Friends: 2}),
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Oct 10 07:03:34 UTC 2023 - 9.4K bytes - Viewed (0) -
tests/test_jsonable_encoder.py
person = Person(name="Foo") pet = Pet(owner=person, name="Firulais") assert jsonable_encoder(pet) == {"name": "Firulais", "owner": {"name": "Foo"}} assert jsonable_encoder(pet, include={"name"}) == {"name": "Firulais"} assert jsonable_encoder(pet, exclude={"owner"}) == {"name": "Firulais"} assert jsonable_encoder(pet, include={}) == {} assert jsonable_encoder(pet, exclude={}) == { "name": "Firulais",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 21:56:59 UTC 2024 - 9K bytes - Viewed (0)