- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 56 for pet1 (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/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/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/associations_has_many_test.go
&Pet{Name: "pet-slice-append-1"}, []*Pet{{Name: "pet-slice-append-2-1"}, {Name: "pet-slice-append-2-2"}}, &Pet{Name: "pet-slice-append-3"}, ) AssertAssociationCount(t, users, "Pets", 10, "After Append") // Replace -> same as append DB.Model(&users).Association("Pets").Replace( []*Pet{{Name: "pet-slice-replace-1-1"}, {Name: "pet-slice-replace-1-2"}},
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 16K bytes - Viewed (0) -
tests/create_test.go
} if err := DB.Create(&pet).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } CheckPet(t, pet, pet) var pet2 Pet DB.Preload("Toy").Find(&pet2, "id = ?", pet.ID) CheckPet(t, pet2, pet) }) t.Run("Slice", func(t *testing.T) { pets := []Pet{{ Name: "PolymorphicHasOne-Slice-1", Toy: Toy{Name: "Toy-PolymorphicHasOne-Slice-1"}, }, {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 26.4K 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) -
tests/preload_test.go
} else { sort.Slice(users2[2].Pets, func(i, j int) bool { return users2[2].Pets[i].ID < users2[2].Pets[j].ID }) for _, pet := range users2[2].Pets[0:2] { if pet.Toy.Name != "" { t.Errorf("No toy should for user %v's pet %v but got %v", 3, pet.Name, pet.Toy.Name) } } CheckPet(t, *users2[2].Pets[2], *users[2].Pets[2]) } } func TestPreloadEmptyData(t *testing.T) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:00:47 UTC 2024 - 15.9K bytes - Viewed (0) -
tests/joins_test.go
DB.Joins("inner join pets on pets.user_id = users.id AND pets.name = @Name", user.Pets[0]).Where("users.name = ?", user.Name).First(&users6) if len(users6) != 1 { t.Errorf("should find one users using left join with conditions, but got %v", len(users6)) } dryDB := DB.Session(&gorm.Session{DryRun: true})
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 17 03:58:13 UTC 2024 - 15K bytes - Viewed (0) -
tests/table_test.go
} r = dryDB.Table("(?) as u, (?) as p", DB.Model(&User{}).Select("name"), DB.Model(&Pet{}).Select("name")).Find(&User{}).Statement if !regexp.MustCompile("SELECT \\* FROM \\(SELECT .name. FROM .users. WHERE .users.\\..deleted_at. IS NULL\\) as u, \\(SELECT .name. FROM .pets. WHERE .pets.\\..deleted_at. IS NULL\\) as p WHERE .u.\\..deleted_at. IS NULL").MatchString(r.Statement.SQL.String()) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Mar 09 09:31:28 UTC 2024 - 10.6K 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)