func testUserRelationshipsCount(t *testing.T) {
	t.Parallel()

	var err error
	seed := randomize.NewSeed()
	userRelationshipOne := &UserRelationship{}
	userRelationshipTwo := &UserRelationship{}
	if err = randomize.Struct(seed, userRelationshipOne, userRelationshipDBTypes, false, userRelationshipColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize UserRelationship struct: %s", err)
	}
	if err = randomize.Struct(seed, userRelationshipTwo, userRelationshipDBTypes, false, userRelationshipColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize UserRelationship struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = userRelationshipOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = userRelationshipTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	count, err := UserRelationships(tx).Count()
	if err != nil {
		t.Error(err)
	}

	if count != 2 {
		t.Error("want 2 records, got:", count)
	}
}
示例#2
0
func testThumbnailsCount(t *testing.T) {
	t.Parallel()

	var err error
	seed := randomize.NewSeed()
	thumbnailOne := &Thumbnail{}
	thumbnailTwo := &Thumbnail{}
	if err = randomize.Struct(seed, thumbnailOne, thumbnailDBTypes, false, thumbnailColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Thumbnail struct: %s", err)
	}
	if err = randomize.Struct(seed, thumbnailTwo, thumbnailDBTypes, false, thumbnailColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Thumbnail struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = thumbnailOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = thumbnailTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	count, err := Thumbnails(tx).Count()
	if err != nil {
		t.Error(err)
	}

	if count != 2 {
		t.Error("want 2 records, got:", count)
	}
}
示例#3
0
func testPubauthorsCount(t *testing.T) {
	t.Parallel()

	var err error
	seed := randomize.NewSeed()
	pubauthorOne := &Pubauthor{}
	pubauthorTwo := &Pubauthor{}
	if err = randomize.Struct(seed, pubauthorOne, pubauthorDBTypes, false, pubauthorColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Pubauthor struct: %s", err)
	}
	if err = randomize.Struct(seed, pubauthorTwo, pubauthorDBTypes, false, pubauthorColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Pubauthor struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = pubauthorOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = pubauthorTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	count, err := Pubauthors(tx).Count()
	if err != nil {
		t.Error(err)
	}

	if count != 2 {
		t.Error("want 2 records, got:", count)
	}
}
func testFeaturePhenotypesCount(t *testing.T) {
	t.Parallel()

	var err error
	seed := randomize.NewSeed()
	featurePhenotypeOne := &FeaturePhenotype{}
	featurePhenotypeTwo := &FeaturePhenotype{}
	if err = randomize.Struct(seed, featurePhenotypeOne, featurePhenotypeDBTypes, false, featurePhenotypeColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize FeaturePhenotype struct: %s", err)
	}
	if err = randomize.Struct(seed, featurePhenotypeTwo, featurePhenotypeDBTypes, false, featurePhenotypeColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize FeaturePhenotype struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = featurePhenotypeOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = featurePhenotypeTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	count, err := FeaturePhenotypes(tx).Count()
	if err != nil {
		t.Error(err)
	}

	if count != 2 {
		t.Error("want 2 records, got:", count)
	}
}
示例#5
0
func testStockpropPubsCount(t *testing.T) {
	t.Parallel()

	var err error
	seed := randomize.NewSeed()
	stockpropPubOne := &StockpropPub{}
	stockpropPubTwo := &StockpropPub{}
	if err = randomize.Struct(seed, stockpropPubOne, stockpropPubDBTypes, false, stockpropPubColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize StockpropPub struct: %s", err)
	}
	if err = randomize.Struct(seed, stockpropPubTwo, stockpropPubDBTypes, false, stockpropPubColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize StockpropPub struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = stockpropPubOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = stockpropPubTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	count, err := StockpropPubs(tx).Count()
	if err != nil {
		t.Error(err)
	}

	if count != 2 {
		t.Error("want 2 records, got:", count)
	}
}
func testPhenotypeCvtermsAll(t *testing.T) {
	t.Parallel()

	seed := randomize.NewSeed()
	var err error
	phenotypeCvtermOne := &PhenotypeCvterm{}
	phenotypeCvtermTwo := &PhenotypeCvterm{}
	if err = randomize.Struct(seed, phenotypeCvtermOne, phenotypeCvtermDBTypes, false, phenotypeCvtermColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize PhenotypeCvterm struct: %s", err)
	}
	if err = randomize.Struct(seed, phenotypeCvtermTwo, phenotypeCvtermDBTypes, false, phenotypeCvtermColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize PhenotypeCvterm struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = phenotypeCvtermOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = phenotypeCvtermTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	slice, err := PhenotypeCvterms(tx).All()
	if err != nil {
		t.Error(err)
	}

	if len(slice) != 2 {
		t.Error("want 2 records, got:", len(slice))
	}
}
func testEnvironmentCvtermsCount(t *testing.T) {
	t.Parallel()

	var err error
	seed := randomize.NewSeed()
	environmentCvtermOne := &EnvironmentCvterm{}
	environmentCvtermTwo := &EnvironmentCvterm{}
	if err = randomize.Struct(seed, environmentCvtermOne, environmentCvtermDBTypes, false, environmentCvtermColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize EnvironmentCvterm struct: %s", err)
	}
	if err = randomize.Struct(seed, environmentCvtermTwo, environmentCvtermDBTypes, false, environmentCvtermColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize EnvironmentCvterm struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = environmentCvtermOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = environmentCvtermTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	count, err := EnvironmentCvterms(tx).Count()
	if err != nil {
		t.Error(err)
	}

	if count != 2 {
		t.Error("want 2 records, got:", count)
	}
}
示例#8
0
func testAuthRoleOneToOneSetOpAuthRolePermissionUsingAuthRolePermission(t *testing.T) {
	var err error

	tx := MustTx(boil.Begin())
	defer tx.Rollback()

	var a AuthRole
	var b, c AuthRolePermission

	seed := randomize.NewSeed()
	if err = randomize.Struct(seed, &a, authRoleDBTypes, false, strmangle.SetComplement(authRolePrimaryKeyColumns, authRoleColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}
	if err = randomize.Struct(seed, &b, authRolePermissionDBTypes, false, strmangle.SetComplement(authRolePermissionPrimaryKeyColumns, authRolePermissionColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}
	if err = randomize.Struct(seed, &c, authRolePermissionDBTypes, false, strmangle.SetComplement(authRolePermissionPrimaryKeyColumns, authRolePermissionColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}

	if err := a.Insert(tx); err != nil {
		t.Fatal(err)
	}
	if err = b.Insert(tx); err != nil {
		t.Fatal(err)
	}

	for i, x := range []*AuthRolePermission{&b, &c} {
		err = a.SetAuthRolePermission(tx, i != 0, x)
		if err != nil {
			t.Fatal(err)
		}

		if a.R.AuthRolePermission != x {
			t.Error("relationship struct not set to correct value")
		}
		if x.R.AuthRole != &a {
			t.Error("failed to append to foreign relationship struct")
		}

		if a.AuthRoleID != x.AuthRoleID {
			t.Error("foreign key was wrong value", a.AuthRoleID)
		}

		zero := reflect.Zero(reflect.TypeOf(x.AuthRoleID))
		reflect.Indirect(reflect.ValueOf(&x.AuthRoleID)).Set(zero)

		if err = x.Reload(tx); err != nil {
			t.Fatal("failed to reload", err)
		}

		if a.AuthRoleID != x.AuthRoleID {
			t.Error("foreign key was wrong value", a.AuthRoleID, x.AuthRoleID)
		}

		if err = x.Delete(tx); err != nil {
			t.Fatal("failed to delete x", err)
		}
	}
}
示例#9
0
func testEnvironmentsAll(t *testing.T) {
	t.Parallel()

	seed := randomize.NewSeed()
	var err error
	environmentOne := &Environment{}
	environmentTwo := &Environment{}
	if err = randomize.Struct(seed, environmentOne, environmentDBTypes, false, environmentColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Environment struct: %s", err)
	}
	if err = randomize.Struct(seed, environmentTwo, environmentDBTypes, false, environmentColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Environment struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = environmentOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = environmentTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	slice, err := Environments(tx).All()
	if err != nil {
		t.Error(err)
	}

	if len(slice) != 2 {
		t.Error("want 2 records, got:", len(slice))
	}
}
示例#10
0
func testDBSCount(t *testing.T) {
	t.Parallel()

	var err error
	seed := randomize.NewSeed()
	dbOne := &DB{}
	dbTwo := &DB{}
	if err = randomize.Struct(seed, dbOne, dbDBTypes, false, dbColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize DB struct: %s", err)
	}
	if err = randomize.Struct(seed, dbTwo, dbDBTypes, false, dbColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize DB struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = dbOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = dbTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	count, err := DBS(tx).Count()
	if err != nil {
		t.Error(err)
	}

	if count != 2 {
		t.Error("want 2 records, got:", count)
	}
}
示例#11
0
func testAuthPermissionsCount(t *testing.T) {
	t.Parallel()

	var err error
	seed := randomize.NewSeed()
	authPermissionOne := &AuthPermission{}
	authPermissionTwo := &AuthPermission{}
	if err = randomize.Struct(seed, authPermissionOne, authPermissionDBTypes, false, authPermissionColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize AuthPermission struct: %s", err)
	}
	if err = randomize.Struct(seed, authPermissionTwo, authPermissionDBTypes, false, authPermissionColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize AuthPermission struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = authPermissionOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = authPermissionTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	count, err := AuthPermissions(tx).Count()
	if err != nil {
		t.Error(err)
	}

	if count != 2 {
		t.Error("want 2 records, got:", count)
	}
}
示例#12
0
func testAnalysesAll(t *testing.T) {
	t.Parallel()

	seed := randomize.NewSeed()
	var err error
	analysiOne := &Analysi{}
	analysiTwo := &Analysi{}
	if err = randomize.Struct(seed, analysiOne, analysiDBTypes, false, analysiColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Analysi struct: %s", err)
	}
	if err = randomize.Struct(seed, analysiTwo, analysiDBTypes, false, analysiColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Analysi struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = analysiOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = analysiTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	slice, err := Analyses(tx).All()
	if err != nil {
		t.Error(err)
	}

	if len(slice) != 2 {
		t.Error("want 2 records, got:", len(slice))
	}
}
示例#13
0
func testTableinfosAll(t *testing.T) {
	t.Parallel()

	seed := randomize.NewSeed()
	var err error
	tableinfoOne := &Tableinfo{}
	tableinfoTwo := &Tableinfo{}
	if err = randomize.Struct(seed, tableinfoOne, tableinfoDBTypes, false, tableinfoColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Tableinfo struct: %s", err)
	}
	if err = randomize.Struct(seed, tableinfoTwo, tableinfoDBTypes, false, tableinfoColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Tableinfo struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = tableinfoOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = tableinfoTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	slice, err := Tableinfos(tx).All()
	if err != nil {
		t.Error(err)
	}

	if len(slice) != 2 {
		t.Error("want 2 records, got:", len(slice))
	}
}
示例#14
0
func testJbrowseOrganismsAll(t *testing.T) {
	t.Parallel()

	seed := randomize.NewSeed()
	var err error
	jbrowseOrganismOne := &JbrowseOrganism{}
	jbrowseOrganismTwo := &JbrowseOrganism{}
	if err = randomize.Struct(seed, jbrowseOrganismOne, jbrowseOrganismDBTypes, false, jbrowseOrganismColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize JbrowseOrganism struct: %s", err)
	}
	if err = randomize.Struct(seed, jbrowseOrganismTwo, jbrowseOrganismDBTypes, false, jbrowseOrganismColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize JbrowseOrganism struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = jbrowseOrganismOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = jbrowseOrganismTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	slice, err := JbrowseOrganisms(tx).All()
	if err != nil {
		t.Error(err)
	}

	if len(slice) != 2 {
		t.Error("want 2 records, got:", len(slice))
	}
}
示例#15
0
func testCvtermDbxrefsAll(t *testing.T) {
	t.Parallel()

	seed := randomize.NewSeed()
	var err error
	cvtermDbxrefOne := &CvtermDbxref{}
	cvtermDbxrefTwo := &CvtermDbxref{}
	if err = randomize.Struct(seed, cvtermDbxrefOne, cvtermDbxrefDBTypes, false, cvtermDbxrefColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize CvtermDbxref struct: %s", err)
	}
	if err = randomize.Struct(seed, cvtermDbxrefTwo, cvtermDbxrefDBTypes, false, cvtermDbxrefColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize CvtermDbxref struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = cvtermDbxrefOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = cvtermDbxrefTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	slice, err := CvtermDbxrefs(tx).All()
	if err != nil {
		t.Error(err)
	}

	if len(slice) != 2 {
		t.Error("want 2 records, got:", len(slice))
	}
}
示例#16
0
func testPubRelationshipsAll(t *testing.T) {
	t.Parallel()

	seed := randomize.NewSeed()
	var err error
	pubRelationshipOne := &PubRelationship{}
	pubRelationshipTwo := &PubRelationship{}
	if err = randomize.Struct(seed, pubRelationshipOne, pubRelationshipDBTypes, false, pubRelationshipColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize PubRelationship struct: %s", err)
	}
	if err = randomize.Struct(seed, pubRelationshipTwo, pubRelationshipDBTypes, false, pubRelationshipColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize PubRelationship struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = pubRelationshipOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = pubRelationshipTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	slice, err := PubRelationships(tx).All()
	if err != nil {
		t.Error(err)
	}

	if len(slice) != 2 {
		t.Error("want 2 records, got:", len(slice))
	}
}
示例#17
0
func testStockDbxrefOneToOneSetOpStockDbxrefpropUsingStockDbxrefprop(t *testing.T) {
	var err error

	tx := MustTx(boil.Begin())
	defer tx.Rollback()

	var a StockDbxref
	var b, c StockDbxrefprop

	seed := randomize.NewSeed()
	if err = randomize.Struct(seed, &a, stockDbxrefDBTypes, false, strmangle.SetComplement(stockDbxrefPrimaryKeyColumns, stockDbxrefColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}
	if err = randomize.Struct(seed, &b, stockDbxrefpropDBTypes, false, strmangle.SetComplement(stockDbxrefpropPrimaryKeyColumns, stockDbxrefpropColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}
	if err = randomize.Struct(seed, &c, stockDbxrefpropDBTypes, false, strmangle.SetComplement(stockDbxrefpropPrimaryKeyColumns, stockDbxrefpropColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}

	if err := a.Insert(tx); err != nil {
		t.Fatal(err)
	}
	if err = b.Insert(tx); err != nil {
		t.Fatal(err)
	}

	for i, x := range []*StockDbxrefprop{&b, &c} {
		err = a.SetStockDbxrefprop(tx, i != 0, x)
		if err != nil {
			t.Fatal(err)
		}

		if a.R.StockDbxrefprop != x {
			t.Error("relationship struct not set to correct value")
		}
		if x.R.StockDbxref != &a {
			t.Error("failed to append to foreign relationship struct")
		}

		if a.StockDbxrefID != x.StockDbxrefID {
			t.Error("foreign key was wrong value", a.StockDbxrefID)
		}

		zero := reflect.Zero(reflect.TypeOf(x.StockDbxrefID))
		reflect.Indirect(reflect.ValueOf(&x.StockDbxrefID)).Set(zero)

		if err = x.Reload(tx); err != nil {
			t.Fatal("failed to reload", err)
		}

		if a.StockDbxrefID != x.StockDbxrefID {
			t.Error("foreign key was wrong value", a.StockDbxrefID, x.StockDbxrefID)
		}

		if err = x.Delete(tx); err != nil {
			t.Fatal("failed to delete x", err)
		}
	}
}
示例#18
0
func testFeatureCvtermOneToOneSetOpFeatureCvtermPubUsingFeatureCvtermPub(t *testing.T) {
	var err error

	tx := MustTx(boil.Begin())
	defer tx.Rollback()

	var a FeatureCvterm
	var b, c FeatureCvtermPub

	seed := randomize.NewSeed()
	if err = randomize.Struct(seed, &a, featureCvtermDBTypes, false, strmangle.SetComplement(featureCvtermPrimaryKeyColumns, featureCvtermColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}
	if err = randomize.Struct(seed, &b, featureCvtermPubDBTypes, false, strmangle.SetComplement(featureCvtermPubPrimaryKeyColumns, featureCvtermPubColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}
	if err = randomize.Struct(seed, &c, featureCvtermPubDBTypes, false, strmangle.SetComplement(featureCvtermPubPrimaryKeyColumns, featureCvtermPubColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}

	if err := a.Insert(tx); err != nil {
		t.Fatal(err)
	}
	if err = b.Insert(tx); err != nil {
		t.Fatal(err)
	}

	for i, x := range []*FeatureCvtermPub{&b, &c} {
		err = a.SetFeatureCvtermPub(tx, i != 0, x)
		if err != nil {
			t.Fatal(err)
		}

		if a.R.FeatureCvtermPub != x {
			t.Error("relationship struct not set to correct value")
		}
		if x.R.FeatureCvterm != &a {
			t.Error("failed to append to foreign relationship struct")
		}

		if a.FeatureCvtermID != x.FeatureCvtermID {
			t.Error("foreign key was wrong value", a.FeatureCvtermID)
		}

		zero := reflect.Zero(reflect.TypeOf(x.FeatureCvtermID))
		reflect.Indirect(reflect.ValueOf(&x.FeatureCvtermID)).Set(zero)

		if err = x.Reload(tx); err != nil {
			t.Fatal("failed to reload", err)
		}

		if a.FeatureCvtermID != x.FeatureCvtermID {
			t.Error("foreign key was wrong value", a.FeatureCvtermID, x.FeatureCvtermID)
		}

		if err = x.Delete(tx); err != nil {
			t.Fatal("failed to delete x", err)
		}
	}
}
func testFeatureRelationshippropPubsAll(t *testing.T) {
	t.Parallel()

	seed := randomize.NewSeed()
	var err error
	featureRelationshippropPubOne := &FeatureRelationshippropPub{}
	featureRelationshippropPubTwo := &FeatureRelationshippropPub{}
	if err = randomize.Struct(seed, featureRelationshippropPubOne, featureRelationshippropPubDBTypes, false, featureRelationshippropPubColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize FeatureRelationshippropPub struct: %s", err)
	}
	if err = randomize.Struct(seed, featureRelationshippropPubTwo, featureRelationshippropPubDBTypes, false, featureRelationshippropPubColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize FeatureRelationshippropPub struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = featureRelationshippropPubOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = featureRelationshippropPubTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	slice, err := FeatureRelationshippropPubs(tx).All()
	if err != nil {
		t.Error(err)
	}

	if len(slice) != 2 {
		t.Error("want 2 records, got:", len(slice))
	}
}
示例#20
0
func testGenotypesAll(t *testing.T) {
	t.Parallel()

	seed := randomize.NewSeed()
	var err error
	genotypeOne := &Genotype{}
	genotypeTwo := &Genotype{}
	if err = randomize.Struct(seed, genotypeOne, genotypeDBTypes, false, genotypeColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Genotype struct: %s", err)
	}
	if err = randomize.Struct(seed, genotypeTwo, genotypeDBTypes, false, genotypeColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Genotype struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = genotypeOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = genotypeTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	slice, err := Genotypes(tx).All()
	if err != nil {
		t.Error(err)
	}

	if len(slice) != 2 {
		t.Error("want 2 records, got:", len(slice))
	}
}
示例#21
0
func testStockCvtermpropsAll(t *testing.T) {
	t.Parallel()

	seed := randomize.NewSeed()
	var err error
	stockCvtermpropOne := &StockCvtermprop{}
	stockCvtermpropTwo := &StockCvtermprop{}
	if err = randomize.Struct(seed, stockCvtermpropOne, stockCvtermpropDBTypes, false, stockCvtermpropColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize StockCvtermprop struct: %s", err)
	}
	if err = randomize.Struct(seed, stockCvtermpropTwo, stockCvtermpropDBTypes, false, stockCvtermpropColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize StockCvtermprop struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = stockCvtermpropOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = stockCvtermpropTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	slice, err := StockCvtermprops(tx).All()
	if err != nil {
		t.Error(err)
	}

	if len(slice) != 2 {
		t.Error("want 2 records, got:", len(slice))
	}
}
示例#22
0
func testGenotypeOneToOneSetOpPhenstatementUsingPhenstatement(t *testing.T) {
	var err error

	tx := MustTx(boil.Begin())
	defer tx.Rollback()

	var a Genotype
	var b, c Phenstatement

	seed := randomize.NewSeed()
	if err = randomize.Struct(seed, &a, genotypeDBTypes, false, strmangle.SetComplement(genotypePrimaryKeyColumns, genotypeColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}
	if err = randomize.Struct(seed, &b, phenstatementDBTypes, false, strmangle.SetComplement(phenstatementPrimaryKeyColumns, phenstatementColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}
	if err = randomize.Struct(seed, &c, phenstatementDBTypes, false, strmangle.SetComplement(phenstatementPrimaryKeyColumns, phenstatementColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}

	if err := a.Insert(tx); err != nil {
		t.Fatal(err)
	}
	if err = b.Insert(tx); err != nil {
		t.Fatal(err)
	}

	for i, x := range []*Phenstatement{&b, &c} {
		err = a.SetPhenstatement(tx, i != 0, x)
		if err != nil {
			t.Fatal(err)
		}

		if a.R.Phenstatement != x {
			t.Error("relationship struct not set to correct value")
		}
		if x.R.Genotype != &a {
			t.Error("failed to append to foreign relationship struct")
		}

		if a.GenotypeID != x.GenotypeID {
			t.Error("foreign key was wrong value", a.GenotypeID)
		}

		zero := reflect.Zero(reflect.TypeOf(x.GenotypeID))
		reflect.Indirect(reflect.ValueOf(&x.GenotypeID)).Set(zero)

		if err = x.Reload(tx); err != nil {
			t.Fatal("failed to reload", err)
		}

		if a.GenotypeID != x.GenotypeID {
			t.Error("foreign key was wrong value", a.GenotypeID, x.GenotypeID)
		}

		if err = x.Delete(tx); err != nil {
			t.Fatal("failed to delete x", err)
		}
	}
}
示例#23
0
文件: users_test.go 项目: zqzca/back
func testUsersAll(t *testing.T) {
	t.Parallel()

	seed := randomize.NewSeed()
	var err error
	userOne := &User{}
	userTwo := &User{}
	if err = randomize.Struct(seed, userOne, userDBTypes, false, userColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize User struct: %s", err)
	}
	if err = randomize.Struct(seed, userTwo, userDBTypes, false, userColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize User struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = userOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = userTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	slice, err := Users(tx).All()
	if err != nil {
		t.Error(err)
	}

	if len(slice) != 2 {
		t.Error("want 2 records, got:", len(slice))
	}
}
示例#24
0
func testOrganismOneToOneSetOpJbrowseOrganismUsingJbrowseOrganism(t *testing.T) {
	var err error

	tx := MustTx(boil.Begin())
	defer tx.Rollback()

	var a Organism
	var b, c JbrowseOrganism

	seed := randomize.NewSeed()
	if err = randomize.Struct(seed, &a, organismDBTypes, false, strmangle.SetComplement(organismPrimaryKeyColumns, organismColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}
	if err = randomize.Struct(seed, &b, jbrowseOrganismDBTypes, false, strmangle.SetComplement(jbrowseOrganismPrimaryKeyColumns, jbrowseOrganismColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}
	if err = randomize.Struct(seed, &c, jbrowseOrganismDBTypes, false, strmangle.SetComplement(jbrowseOrganismPrimaryKeyColumns, jbrowseOrganismColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}

	if err := a.Insert(tx); err != nil {
		t.Fatal(err)
	}
	if err = b.Insert(tx); err != nil {
		t.Fatal(err)
	}

	for i, x := range []*JbrowseOrganism{&b, &c} {
		err = a.SetJbrowseOrganism(tx, i != 0, x)
		if err != nil {
			t.Fatal(err)
		}

		if a.R.JbrowseOrganism != x {
			t.Error("relationship struct not set to correct value")
		}
		if x.R.Organism != &a {
			t.Error("failed to append to foreign relationship struct")
		}

		if a.OrganismID != x.OrganismID {
			t.Error("foreign key was wrong value", a.OrganismID)
		}

		zero := reflect.Zero(reflect.TypeOf(x.OrganismID))
		reflect.Indirect(reflect.ValueOf(&x.OrganismID)).Set(zero)

		if err = x.Reload(tx); err != nil {
			t.Fatal("failed to reload", err)
		}

		if a.OrganismID != x.OrganismID {
			t.Error("foreign key was wrong value", a.OrganismID, x.OrganismID)
		}

		if err = x.Delete(tx); err != nil {
			t.Fatal("failed to delete x", err)
		}
	}
}
示例#25
0
func testOrganismDbxrefsCount(t *testing.T) {
	t.Parallel()

	var err error
	seed := randomize.NewSeed()
	organismDbxrefOne := &OrganismDbxref{}
	organismDbxrefTwo := &OrganismDbxref{}
	if err = randomize.Struct(seed, organismDbxrefOne, organismDbxrefDBTypes, false, organismDbxrefColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize OrganismDbxref struct: %s", err)
	}
	if err = randomize.Struct(seed, organismDbxrefTwo, organismDbxrefDBTypes, false, organismDbxrefColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize OrganismDbxref struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = organismDbxrefOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = organismDbxrefTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	count, err := OrganismDbxrefs(tx).Count()
	if err != nil {
		t.Error(err)
	}

	if count != 2 {
		t.Error("want 2 records, got:", count)
	}
}
示例#26
0
func testJbrowseTracksCount(t *testing.T) {
	t.Parallel()

	var err error
	seed := randomize.NewSeed()
	jbrowseTrackOne := &JbrowseTrack{}
	jbrowseTrackTwo := &JbrowseTrack{}
	if err = randomize.Struct(seed, jbrowseTrackOne, jbrowseTrackDBTypes, false, jbrowseTrackColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize JbrowseTrack struct: %s", err)
	}
	if err = randomize.Struct(seed, jbrowseTrackTwo, jbrowseTrackDBTypes, false, jbrowseTrackColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize JbrowseTrack struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = jbrowseTrackOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = jbrowseTrackTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	count, err := JbrowseTracks(tx).Count()
	if err != nil {
		t.Error(err)
	}

	if count != 2 {
		t.Error("want 2 records, got:", count)
	}
}
示例#27
0
func testCvtermpathsCount(t *testing.T) {
	t.Parallel()

	var err error
	seed := randomize.NewSeed()
	cvtermpathOne := &Cvtermpath{}
	cvtermpathTwo := &Cvtermpath{}
	if err = randomize.Struct(seed, cvtermpathOne, cvtermpathDBTypes, false, cvtermpathColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Cvtermpath struct: %s", err)
	}
	if err = randomize.Struct(seed, cvtermpathTwo, cvtermpathDBTypes, false, cvtermpathColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Cvtermpath struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = cvtermpathOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = cvtermpathTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	count, err := Cvtermpaths(tx).Count()
	if err != nil {
		t.Error(err)
	}

	if count != 2 {
		t.Error("want 2 records, got:", count)
	}
}
func testAnalysisfeaturepropsCount(t *testing.T) {
	t.Parallel()

	var err error
	seed := randomize.NewSeed()
	analysisfeaturepropOne := &Analysisfeatureprop{}
	analysisfeaturepropTwo := &Analysisfeatureprop{}
	if err = randomize.Struct(seed, analysisfeaturepropOne, analysisfeaturepropDBTypes, false, analysisfeaturepropColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Analysisfeatureprop struct: %s", err)
	}
	if err = randomize.Struct(seed, analysisfeaturepropTwo, analysisfeaturepropDBTypes, false, analysisfeaturepropColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Analysisfeatureprop struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = analysisfeaturepropOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = analysisfeaturepropTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	count, err := Analysisfeatureprops(tx).Count()
	if err != nil {
		t.Error(err)
	}

	if count != 2 {
		t.Error("want 2 records, got:", count)
	}
}
示例#29
0
func testDownloadsAll(t *testing.T) {
	t.Parallel()

	seed := randomize.NewSeed()
	var err error
	downloadOne := &Download{}
	downloadTwo := &Download{}
	if err = randomize.Struct(seed, downloadOne, downloadDBTypes, false, downloadColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Download struct: %s", err)
	}
	if err = randomize.Struct(seed, downloadTwo, downloadDBTypes, false, downloadColumnsWithDefault...); err != nil {
		t.Errorf("Unable to randomize Download struct: %s", err)
	}

	tx := MustTx(boil.Begin())
	defer tx.Rollback()
	if err = downloadOne.Insert(tx); err != nil {
		t.Error(err)
	}
	if err = downloadTwo.Insert(tx); err != nil {
		t.Error(err)
	}

	slice, err := Downloads(tx).All()
	if err != nil {
		t.Error(err)
	}

	if len(slice) != 2 {
		t.Error("want 2 records, got:", len(slice))
	}
}
示例#30
0
func testPubauthorToOneSetOpPubUsingPub(t *testing.T) {
	var err error

	tx := MustTx(boil.Begin())
	defer tx.Rollback()

	var a Pubauthor
	var b, c Pub

	seed := randomize.NewSeed()
	if err = randomize.Struct(seed, &a, pubauthorDBTypes, false, strmangle.SetComplement(pubauthorPrimaryKeyColumns, pubauthorColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}
	if err = randomize.Struct(seed, &b, pubDBTypes, false, strmangle.SetComplement(pubPrimaryKeyColumns, pubColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}
	if err = randomize.Struct(seed, &c, pubDBTypes, false, strmangle.SetComplement(pubPrimaryKeyColumns, pubColumnsWithoutDefault)...); err != nil {
		t.Fatal(err)
	}

	if err := a.Insert(tx); err != nil {
		t.Fatal(err)
	}
	if err = b.Insert(tx); err != nil {
		t.Fatal(err)
	}

	for i, x := range []*Pub{&b, &c} {
		err = a.SetPub(tx, i != 0, x)
		if err != nil {
			t.Fatal(err)
		}

		if a.R.Pub != x {
			t.Error("relationship struct not set to correct value")
		}

		if x.R.Pubauthor != &a {
			t.Error("failed to append to foreign relationship struct")
		}
		if a.PubID != x.PubID {
			t.Error("foreign key was wrong value", a.PubID)
		}

		zero := reflect.Zero(reflect.TypeOf(a.PubID))
		reflect.Indirect(reflect.ValueOf(&a.PubID)).Set(zero)

		if err = a.Reload(tx); err != nil {
			t.Fatal("failed to reload", err)
		}

		if a.PubID != x.PubID {
			t.Error("foreign key was wrong value", a.PubID, x.PubID)
		}
	}
}