Skip to content

Commit

Permalink
test: put integration back
Browse files Browse the repository at this point in the history
implement ENG-3438
  • Loading branch information
cowan-macady committed Apr 19, 2024
1 parent 2e56fa8 commit 5a2cef9
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 46 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- mastery
- master
push:
branches:
- mastery
- master
workflow_dispatch:

concurrency:
Expand Down
45 changes: 27 additions & 18 deletions authorization/authorization_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !integration
//go:build integration

package authorization_test

Expand Down Expand Up @@ -788,8 +788,8 @@ var _ = Describe("Authorized", func() {
Expect(err).To(Succeed())

externalID := &authorizationpb.ExternalID{
Type: "Individual",
ExternalId: integration.Subject1,
Type: "Person",
ExternalId: integration.Subject2,
}

resources := integration.Resource1
Expand Down Expand Up @@ -843,7 +843,7 @@ var _ = Describe("Authorized", func() {
Expect(err).To(Succeed())

externalID := &authorizationpb.ExternalID{
Type: "Individual",
Type: "Person",
ExternalId: "anythingwrong",
}

Expand Down Expand Up @@ -1042,16 +1042,19 @@ var _ = Describe("Authorized", func() {
action: PointTo(MatchFields(IgnoreExtras, Fields{
"Resources": MatchAllElementsWithIndex(IndexIdentity, Elements{
"0": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Asset1),
"ExternalId": Equal(integration.Asset3),
})),
"1": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Asset2),
"ExternalId": Equal(integration.Asset4),
})),
"2": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Asset3),
"ExternalId": Equal(integration.Asset1),
})),
"3": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Asset4),
"ExternalId": Equal(integration.Asset5),
})),
"4": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Asset2),
})),
}),
})),
Expand Down Expand Up @@ -1237,7 +1240,7 @@ var _ = Describe("Authorized", func() {

digitalTwinProperty := &authorizationpb.Property{
Type: "email",
Value: objectpb.String(integration.EmailGood),
Value: objectpb.String(integration.EmailGood2),
}

resourcesTypes := integration.ResourceType1
Expand Down Expand Up @@ -1274,10 +1277,13 @@ var _ = Describe("Authorized", func() {
action: PointTo(MatchFields(IgnoreExtras, Fields{
"Resources": MatchAllElementsWithIndex(IndexIdentity, Elements{
"0": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Asset1),
"ExternalId": Equal(integration.Asset3),
})),
"1": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Asset2),
"ExternalId": Equal(integration.Asset4),
})),
"2": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Asset1),
})),
}),
})),
Expand Down Expand Up @@ -1344,8 +1350,8 @@ var _ = Describe("Authorized", func() {
Expect(err).To(Succeed())

externalID := &authorizationpb.ExternalID{
Type: "Individual",
ExternalId: integration.Subject1,
Type: "Person",
ExternalId: integration.Subject4,
}

resourcesTypes := integration.ResourceType1
Expand Down Expand Up @@ -1382,10 +1388,13 @@ var _ = Describe("Authorized", func() {
action: PointTo(MatchFields(IgnoreExtras, Fields{
"Resources": MatchAllElementsWithIndex(IndexIdentity, Elements{
"0": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Asset1),
"ExternalId": Equal(integration.Asset3),
})),
"1": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Asset2),
"ExternalId": Equal(integration.Asset4),
})),
"2": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Asset1),
})),
}),
})),
Expand All @@ -1401,7 +1410,7 @@ var _ = Describe("Authorized", func() {
Expect(err).To(Succeed())

externalID := &authorizationpb.ExternalID{
Type: "Individual",
Type: "Person",
ExternalId: "SomethingWrong",
}

Expand Down Expand Up @@ -1593,10 +1602,10 @@ var _ = Describe("Authorized", func() {
action0: PointTo(MatchFields(IgnoreExtras, Fields{
"Subjects": MatchAllElementsWithIndex(IndexIdentity, Elements{
"0": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Subject1),
"ExternalId": Equal(integration.Subject2),
})),
"1": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Subject2),
"ExternalId": Equal(integration.Subject1),
})),
"2": PointTo(MatchFields(IgnoreExtras, Fields{
"ExternalId": Equal(integration.Subject3),
Expand Down
2 changes: 1 addition & 1 deletion ingest/ingest_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !integration
//go:build integration

package ingest_test

Expand Down
53 changes: 28 additions & 25 deletions test/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var (
"policyVersion": "1.0-indykite"
},
"subject": {
"type": "Individual"
"type": "Person"
},
"actions": [
""
Expand All @@ -44,7 +44,7 @@ var (
"type": "Asset"
},
"condition": {
"cypher": "MATCH (subject:Individual)-[:BELONGS_TO]->(:Organization)-[:IS_ON]->
"cypher": "MATCH (subject:Person)-[:BELONGS_TO]->(:Organization)-[:IS_ON]->
(s:Subscription) MATCH (s)-[:OFFERS]->(:Service) MATCH (s)-[:COVERS]->
(resource:Asset) WITH subject, resource"
}
Expand All @@ -53,75 +53,75 @@ var (

Resource1 = []*authorizationpb.IsAuthorizedRequest_Resource{
{
ExternalId: "LPcearawBJWDQLR",
ExternalId: "pFlpMtkWqCPXVue",
Type: "Asset",
Actions: []string{"SUBSCRIBES_TO"},
},
}

Resource2 = []*authorizationpb.IsAuthorizedRequest_Resource{
{
ExternalId: "LPcearawBJWDQLR",
ExternalId: "pFlpMtkWqCPXVue",
Actions: []string{"SUBSCRIBES_TO"},
},
}

Resource3 = []*authorizationpb.IsAuthorizedRequest_Resource{
{
ExternalId: "LPcearawBJWDQLR",
ExternalId: "pFlpMtkWqCPXVue",
Type: "Asset",
Actions: []string{"DEMANDS"},
},
}

Resource4 = []*authorizationpb.IsAuthorizedRequest_Resource{
{
ExternalId: "mfYbpowiNPJQCBY",
ExternalId: "QovektcrVBbNmFj",
Type: "Asset",
Actions: []string{"SUBSCRIBES_TO"},
},
}

Resource5 = []*authorizationpb.IsAuthorizedRequest_Resource{
{
ExternalId: "CCbJwkQtLOmCdLq",
ExternalId: "HQKzkgPnGJDiaGo",
Type: "Asset",
Actions: []string{"SUBSCRIBES_TO"},
},
}

Resource6 = []*authorizationpb.IsAuthorizedRequest_Resource{
{
ExternalId: "aXQMRIcTzyIyeKC",
ExternalId: "XcbZruEzGNYHLic",
Type: "Asset",
Actions: []string{"SUBSCRIBES_TO"},
},
}

Resource7 = []*authorizationpb.IsAuthorizedRequest_Resource{
{
ExternalId: "EvfDHrEObtYVleh",
ExternalId: "zIDegSbXcRlBeFZ",
Type: "Asset",
Actions: []string{"SUBSCRIBES_TO"},
},
}

Resource8 = []*authorizationpb.IsAuthorizedRequest_Resource{
{
ExternalId: "BLOXgHAvWFMHDsS",
ExternalId: "paLtQSpEcTvzeuC",
Type: "Asset",
Actions: []string{"SUBSCRIBES_TO"},
},
}

Resource9 = []*authorizationpb.IsAuthorizedRequest_Resource{
{
ExternalId: "LPcearawBJWDQLR",
ExternalId: "pFlpMtkWqCPXVue",
Type: "Asset",
Actions: []string{"SUBSCRIBES_TO"},
},
{
ExternalId: "CCbJwkQtLOmCdLq",
ExternalId: "HQKzkgPnGJDiaGo",
Type: "Asset",
Actions: []string{"SUBSCRIBES_TO"},
},
Expand All @@ -140,35 +140,38 @@ var (
}

ResourceWho1 = []*authorizationpb.WhoAuthorizedRequest_Resource{
{ExternalId: "LPcearawBJWDQLR", Type: "Asset", Actions: []string{"SUBSCRIBES_TO", "OWNS"}},
{ExternalId: "pFlpMtkWqCPXVue", Type: "Asset", Actions: []string{"SUBSCRIBES_TO", "OWNS"}},
}

ResourceWho2 = []*authorizationpb.WhoAuthorizedRequest_Resource{
{Type: "Asset", Actions: []string{"SUBSCRIBES_TO", "OWNS"}},
}

ResourceWho3 = []*authorizationpb.WhoAuthorizedRequest_Resource{
{ExternalId: "LPcearawBJWDQLR", Type: "Asset", Actions: []string{"DEMANDS", "REPELS"}},
{ExternalId: "pFlpMtkWqCPXVue", Type: "Asset", Actions: []string{"DEMANDS", "REPELS"}},
}

DigitalTwinBad = "id"
DigitalTwinNotInDB = "gid:AAAAGaiIPzg6L0DKkbIh22crsFg"
DigitalTwin1 = "gid:AAAAFR3royp640c-gXRGdusXM4Y"
DigitalTwin2 = "gid:AAAAFf6Y9ZMWhEdsr3INueqfRLU"
DigitalTwin1 = "gid:AAAAFdrC00gBhkvelHM0OQO-u4U"
DigitalTwin2 = "gid:AAAAFb3lFaaArUVYqk9VdY1Ct1Y"

EmailBad = "[email protected]"
EmailGood = "[email protected]"
EmailBad = "[email protected]"
EmailGood = "[email protected]"
EmailGood2 = "[email protected]"

ExternalIDGood = "TrSFiLuoSLGiCIo"

Asset1 = "CCbJwkQtLOmCdLq"
Asset2 = "LPcearawBJWDQLR"
Asset3 = "zBiBMaYOaDmdCyX"
Asset4 = "BLOXgHAvWFMHDsS"
Asset1 = "HQKzkgPnGJDiaGo"
Asset2 = "pFlpMtkWqCPXVue"
Asset3 = "zojWwtKbBLmAXCO"
Asset4 = "paLtQSpEcTvzeuC"
Asset5 = "dLZVTSllFCdZfXC"

Subject1 = "HLEgiljrtoNEiyX"
Subject2 = "zvPYDXxXyVgeZHw"
Subject3 = "TrSFiLuoSLGiCIo"
Subject1 = "dilZWYdFcmXiojC"
Subject2 = "fVcaUxJqmOkyOTX"
Subject3 = "lSPmCXIPRXppszf"
Subject4 = "NACTFFKUCcceDIz"

// TokenGoodFormat is a valid format for jwt.
TokenGoodFormat = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9." +
Expand Down

0 comments on commit 5a2cef9

Please sign in to comment.