feat(invitations): accept invitations with C4 consent and contact grants; share the E0 quota across holdings
This commit is contained in:
1 parent
a5990d3fc6
commit
676b3c6e24
59 files changed
+4926
-194
No files matched your search
@@ -1078,13 +1078,15 @@ func TestMatchSearchOverHTTP(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("the allowance of an organization ends the output and the group limit cuts it, without a total", func(t *testing.T) {
|
||||
orgC := organizations.create(t, domain.User{ID: employer.id}, organizations.completeProfile(t, "Match organization C"), now)
|
||||
// Organizations of one owner share the E0 pool, so this one gets an owner of its own.
|
||||
ownerC := client.employer(t, "match-employer-c@example.test")
|
||||
orgC := organizations.create(t, domain.User{ID: ownerC.id}, organizations.completeProfile(t, "Match organization C"), now)
|
||||
bounded := func(product *domain.ProductPolicy) {
|
||||
product.OrganizationQuotas.TierE0.DistinctCardViewsPerWindow = 8
|
||||
}
|
||||
publishPolicy(bounded)
|
||||
searchC := func() (matchSearchBody, string) {
|
||||
result, response := search(employer, orgC.ID(), `{"filters":{}}`)
|
||||
result, response := search(ownerC, orgC.ID(), `{"filters":{}}`)
|
||||
if response.Code != http.StatusOK {
|
||||
t.Fatalf("search of organization C = %d %s", response.Code, response.Body.String())
|
||||
}
|
||||
@@ -1119,7 +1121,7 @@ func TestMatchSearchOverHTTP(t *testing.T) {
|
||||
cardPath := func(handle string) string {
|
||||
return fmt.Sprintf("/api/v1/organizations/%s/candidate-cards/%s", orgC.ID(), handle)
|
||||
}
|
||||
if got := harness.request(t, http.MethodGet, cardPath(first.Groups.Main[0].CandidateHandle), "", "", employer.cookie, "", client.remote()); got.Code != http.StatusOK ||
|
||||
if got := harness.request(t, http.MethodGet, cardPath(first.Groups.Main[0].CandidateHandle), "", "", ownerC.cookie, "", client.remote()); got.Code != http.StatusOK ||
|
||||
revealedBy(orgC.ID()) != 8 {
|
||||
t.Fatalf("card of a paid candidate = %d, paid %d, want 200 and no new charge", got.Code, revealedBy(orgC.ID()))
|
||||
}
|
||||
@@ -1131,7 +1133,7 @@ func TestMatchSearchOverHTTP(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if got := harness.request(t, http.MethodGet, cardPath(unpaid), "", "", employer.cookie, "", client.remote()); got.Code != http.StatusTooManyRequests {
|
||||
if got := harness.request(t, http.MethodGet, cardPath(unpaid), "", "", ownerC.cookie, "", client.remote()); got.Code != http.StatusTooManyRequests {
|
||||
t.Fatalf("card of an unpaid candidate = %d, want 429 from the same allowance", got.Code)
|
||||
}
|
||||
// The organizations pay independently of each other.
|
||||
@@ -1176,7 +1178,8 @@ func TestMatchSearchOverHTTP(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("two concurrent searches of one organization never charge beyond the allowance", func(t *testing.T) {
|
||||
orgD := organizations.create(t, domain.User{ID: employer.id}, organizations.completeProfile(t, "Match organization D"), now)
|
||||
ownerD := client.employer(t, "match-employer-d@example.test")
|
||||
orgD := organizations.create(t, domain.User{ID: ownerD.id}, organizations.completeProfile(t, "Match organization D"), now)
|
||||
publishPolicy(func(product *domain.ProductPolicy) { product.OrganizationQuotas.TierE0.DistinctCardViewsPerWindow = 8 })
|
||||
type outcome struct {
|
||||
status int
|
||||
@@ -1193,7 +1196,7 @@ func TestMatchSearchOverHTTP(t *testing.T) {
|
||||
group.Add(1)
|
||||
go func() {
|
||||
defer group.Done()
|
||||
response := harness.request(t, http.MethodPost, searchPath(orgD.ID()), `{"filters":{}}`, sessionHTTPTestOrigin, employer.cookie, employer.csrf, remote)
|
||||
response := harness.request(t, http.MethodPost, searchPath(orgD.ID()), `{"filters":{}}`, sessionHTTPTestOrigin, ownerD.cookie, ownerD.csrf, remote)
|
||||
outcomes <- outcome{status: response.Code, body: response.Body.String()}
|
||||
}()
|
||||
}
|
||||
@@ -1238,7 +1241,8 @@ func TestMatchSearchOverHTTP(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("concurrent card reads, evidence reads, and searches of one organization neither deadlock nor overcharge", func(t *testing.T) {
|
||||
orgF := organizations.create(t, domain.User{ID: employer.id}, organizations.completeProfile(t, "Match organization F"), now)
|
||||
ownerF := client.employer(t, "match-employer-f@example.test")
|
||||
orgF := organizations.create(t, domain.User{ID: ownerF.id}, organizations.completeProfile(t, "Match organization F"), now)
|
||||
visible := make([]categoryHTTPCandidate, 0, 17)
|
||||
for _, group := range [][]categoryHTTPCandidate{withGo, withoutStack, declaredOnly} {
|
||||
visible = append(visible, group...)
|
||||
@@ -1269,14 +1273,14 @@ func TestMatchSearchOverHTTP(t *testing.T) {
|
||||
remote := client.remote()
|
||||
path := fmt.Sprintf("/api/v1/organizations/%s/candidate-cards/%s%s", orgF.ID(), aliasIn(orgF.ID(), member.id), suffix)
|
||||
return func() outcome {
|
||||
response := harness.request(t, http.MethodGet, path, "", "", employer.cookie, "", remote)
|
||||
response := harness.request(t, http.MethodGet, path, "", "", ownerF.cookie, "", remote)
|
||||
return outcome{what: "card" + suffix, status: response.Code}
|
||||
}
|
||||
}
|
||||
searchJob := func() func() outcome {
|
||||
remote := client.remote()
|
||||
return func() outcome {
|
||||
response := harness.request(t, http.MethodPost, searchPath(orgF.ID()), `{"filters":{}}`, sessionHTTPTestOrigin, employer.cookie, employer.csrf, remote)
|
||||
response := harness.request(t, http.MethodPost, searchPath(orgF.ID()), `{"filters":{}}`, sessionHTTPTestOrigin, ownerF.cookie, ownerF.csrf, remote)
|
||||
return outcome{what: "search", status: response.Code}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user