Documentation ¶
Index ¶
- Constants
- func CreateAccounts(t *testing.T, a types.Account, created time.Time) error
- func CreateDatabaseStudyConf(t *testing.T, dsc types.DatabaseStudyConf) error
- func CreateSegment(t *testing.T, sp []types.SegmentsProgress) error
- func CreateStudy(t *testing.T, slug, userID string) error
- func CreateUser(t *testing.T)
- func DeleteAllAccounts(t *testing.T)
- func DeleteAllStudies(t *testing.T)
- func DeleteAllStudyConfs(t *testing.T)
- func DeleteAllStudySegments(t *testing.T)
- func DeleteAllUsers(t *testing.T)
- func FakeValidTokenMiddleware(userID string) gin.HandlerFunc
- func GetFBSession() (session *fb.Session, teardown func())
- func GetFBTestApp() (a *fb.App, teardown func())
- func GetRepositories() storage.Repositories
- func NewDatabaseStudyConf(opts ...databasestudyconfoptions) *types.DatabaseStudyConf
- func NewStudyConf(opts ...studyconfigoptions) types.StudyConf
- func TypeAudiences() databasestudyconfoptions
- func TypeCreatives() databasestudyconfoptions
- func TypeDestinations() databasestudyconfoptions
- func TypeGeneral() databasestudyconfoptions
- func TypeRecruitment() databasestudyconfoptions
- func TypeTargeting() databasestudyconfoptions
- func TypeTargetingDistribution() databasestudyconfoptions
- func WithAudiences(as []*types.AudienceConf) studyconfigoptions
- func WithDestinationConf(d *types.DestinationConf) studyconfigoptions
- func WithGeneralConf(g *types.GeneralConf) studyconfigoptions
- func WithRecruitmentConf(r *types.RecruitmentConf) studyconfigoptions
- func WithTargetingConf(t *types.TargetingConf) studyconfigoptions
- func WithTargetingDistributionConf(t *types.TargetingDistributionConf) studyconfigoptions
- type Response
Constants ¶
const ( CurrentUserId = "auth0|61916c1dab79c900713936de" StudySlug = "test-study" )
const StudyID = "92b322df-9dac-4240-a88e-d3aa715be83d"
Variables ¶
This section is empty.
Functions ¶
func CreateDatabaseStudyConf ¶
func CreateDatabaseStudyConf(t *testing.T, dsc types.DatabaseStudyConf) error
func CreateSegment ¶
func CreateSegment(t *testing.T, sp []types.SegmentsProgress) error
func CreateUser ¶
func DeleteAllAccounts ¶
func DeleteAllStudies ¶
func DeleteAllStudyConfs ¶
DeleteAllStudyConfs Helper function that clears the study_confs table
func DeleteAllStudySegments ¶
func DeleteAllUsers ¶
func FakeValidTokenMiddleware ¶
func FakeValidTokenMiddleware(userID string) gin.HandlerFunc
func GetFBSession ¶
GetFBSession Returns a Mock Server in order to mock facebook
func GetFBTestApp ¶
func GetRepositories ¶
func GetRepositories() storage.Repositories
func NewDatabaseStudyConf ¶
func NewDatabaseStudyConf(opts ...databasestudyconfoptions) *types.DatabaseStudyConf
func NewStudyConf ¶
NewStudyConf is a test helper that generates a studyconf with some sensible defaults and allows for overrides, please make use of this in tests as this structure might change and it will be easier to update this in a single place.
example: return full studyConfig
sc := NewStudyConf()
example: set one of the confs to nil
sc := NewStudyConf(WithTargetingConf(nil))
example: override one of the confs (you need to pass in all fields of specified conf)
general := &types.GeneralConf{ Name: "bar", etc...}
sc := NewStudyConf(WithGeneralConf(general))
func TypeAudiences ¶
func TypeAudiences() databasestudyconfoptions
func TypeCreatives ¶
func TypeCreatives() databasestudyconfoptions
func TypeDestinations ¶
func TypeDestinations() databasestudyconfoptions
func TypeGeneral ¶
func TypeGeneral() databasestudyconfoptions
func TypeRecruitment ¶
func TypeRecruitment() databasestudyconfoptions
func TypeTargeting ¶
func TypeTargeting() databasestudyconfoptions
func TypeTargetingDistribution ¶
func TypeTargetingDistribution() databasestudyconfoptions
func WithAudiences ¶
func WithAudiences(as []*types.AudienceConf) studyconfigoptions
WithAudiences is used to override the default AudienceConf
func WithDestinationConf ¶
func WithDestinationConf(d *types.DestinationConf) studyconfigoptions
WithDestinationConf is used to override the default DestinationConf
func WithGeneralConf ¶
func WithGeneralConf(g *types.GeneralConf) studyconfigoptions
WithGeneralConf is used to override the default GeneralConf
func WithRecruitmentConf ¶
func WithRecruitmentConf(r *types.RecruitmentConf) studyconfigoptions
WithRecruitmentConf is used to override the default RecruitmentConf
func WithTargetingConf ¶
func WithTargetingConf(t *types.TargetingConf) studyconfigoptions
WithTargetingConf is used to overide the default TargetingConf
func WithTargetingDistributionConf ¶
func WithTargetingDistributionConf( t *types.TargetingDistributionConf, ) studyconfigoptions
WithTargetingDistributionConf is used to override the default TargetingDistributionConf
Types ¶
type Response ¶
func PerformGetRequest ¶
func PerformGetRequest(path string, repositories storage.Repositories) Response
func PerformPostRequest ¶
func PerformPostRequest( path, userID string, repositories storage.Repositories, body interface{}, ) Response
func PerformRequest ¶
func PerformRequest( path, userID string, method string, repositories storage.Repositories, body interface{}, ) Response