Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for AssertAssociationCount (0.08 sec)

  1. tests/associations_many2many_test.go

    	}
    
    	user.Languages = []Language{language2}
    	CheckUser(t, user2, user)
    
    	AssertAssociationCount(t, user2, "Languages", 1, "AfterReplace")
    
    	// Delete
    	if err := DB.Model(&user2).Association("Languages").Delete(&Language{}); err != nil {
    		t.Fatalf("Error happened when delete language, got %v", err)
    	}
    	AssertAssociationCount(t, user2, "Languages", 1, "after delete non-existing data")
    
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Sat Jun 10 13:05:19 UTC 2023
    - 13.2K bytes
    - Viewed (0)
  2. tests/associations_has_many_test.go

    	}
    
    	user.Pets = []*Pet{&pet2}
    	CheckUser(t, user2, user)
    
    	AssertAssociationCount(t, user2, "Pets", 1, "AfterReplace")
    
    	// Delete
    	if err := DB.Model(&user2).Association("Pets").Delete(&Pet{}); err != nil {
    		t.Fatalf("Error happened when delete pet, got %v", err)
    	}
    	AssertAssociationCount(t, user2, "Pets", 1, "after delete non-existing data")
    
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Fri Sep 12 04:33:27 UTC 2025
    - 16.3K bytes
    - Viewed (0)
  3. tests/associations_has_one_test.go

    	}
    
    	user.Account = account2
    	CheckUser(t, user2, user)
    
    	AssertAssociationCount(t, user2, "Account", 1, "AfterReplace")
    
    	// Delete
    	if err := DB.Model(&user2).Association("Account").Delete(&Account{}); err != nil {
    		t.Fatalf("Error happened when delete account, got %v", err)
    	}
    	AssertAssociationCount(t, user2, "Account", 1, "after delete non-existing data")
    
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Wed Jun 12 10:49:45 UTC 2024
    - 7.1K bytes
    - Viewed (0)
  4. tests/associations_belongs_to_test.go

    	user.ManagerID = &manager2.ID
    	CheckUser(t, user2, user)
    
    	AssertAssociationCount(t, user2, "Company", 1, "AfterReplace")
    	AssertAssociationCount(t, user2, "Manager", 1, "AfterReplace")
    
    	// Delete
    	if err := DB.Model(&user2).Association("Company").Delete(&Company{}); err != nil {
    		t.Fatalf("Error happened when delete Company, got %v", err)
    	}
    	AssertAssociationCount(t, user2, "Company", 1, "after delete non-existing data")
    
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Mon Oct 30 09:15:49 UTC 2023
    - 9.3K bytes
    - Viewed (0)
  5. tests/association_generics_test.go

    		t.Fatalf("expected 0 rows affected for association-only update, got %d", rows)
    	}
    
    	// Verify both associations were created using real database queries
    	AssertAssociationCount(t, &user, "Pets", 1, "after Set Update with multiple associations")
    	AssertAssociationCount(t, &user, "Toys", 1, "after Set Update with multiple associations")
    }
    
    // Test Set + Update with multiple associations using real database
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Fri Sep 12 05:42:26 UTC 2025
    - 37.9K bytes
    - Viewed (0)
  6. tests/associations_test.go

    		t.Fatalf("prime append: %v", err)
    	}
    	AssertAssociationCount(t, user, "Languages", 1, "before replace")
    
    	// Replace with a new map value
    	if err := DB.Model(&user).Association("Languages").Replace(map[string]interface{}{
    		"code": "rm2m_map_1", "name": "ReplaceMap1",
    	}); err != nil {
    		t.Fatalf("replace map: %v", err)
    	}
    	AssertAssociationCount(t, user, "Languages", 1, "after replace with 1 map")
    
    Registered: Sun Dec 28 09:35:17 UTC 2025
    - Last Modified: Fri Sep 12 04:33:27 UTC 2025
    - 13.3K bytes
    - Viewed (0)
Back to top