Skip to content

Commit

Permalink
Fix the manager relation between rick and morty in integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BogdanIrimie authored Nov 28, 2023
1 parent 1fe4fd4 commit 08032ef
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/test/java/DirectoryClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void testGetUserWithNoRelations() {
void testGetUserWithRelations() {
// Arrange
Object managerObject = Directory.buildObject("user", "[email protected]");
Relation managerRelation = Directory.buildRelation("user", "morty@the-citadel.com", "manager", "user", "rick@the-citadel.com");
Relation managerRelation = Directory.buildRelation("user", "rick@the-citadel.com", "manager", "user", "morty@the-citadel.com");
Relation adminRelation = Directory.buildRelation("group", "admin", "member", "user", "[email protected]");

// Act
Expand Down Expand Up @@ -169,15 +169,15 @@ void testGetUserManyRequest() {
@Test
void testGetRelation() {
// Arrange
Relation expectedRelation = Directory.buildRelation("user", "morty@the-citadel.com", "manager", "user", "rick@the-citadel.com");
Relation expectedRelation = Directory.buildRelation("user", "rick@the-citadel.com", "manager", "user", "morty@the-citadel.com");

// Act
GetRelationResponse getRelationResponse = directoryClient.getRelation(
"user",
"morty@the-citadel.com",
"rick@the-citadel.com",
"manager",
"user",
"rick@the-citadel.com");
"morty@the-citadel.com");

// Assert
Relation relation = getRelationResponse.getResult();
Expand All @@ -190,15 +190,15 @@ void testGetRelation() {
@Test
void testGetRelations() {
// Arrange
Relation expectedManagerRelation = Directory.buildRelation("user", "morty@the-citadel.com", "manager", "user", "rick@the-citadel.com");
Relation expectedFriendRelation = Directory.buildRelation("user", "morty@the-citadel.com", "friend", "user", "rick@the-citadel.com");
Relation expectedManagerRelation = Directory.buildRelation("user", "rick@the-citadel.com", "manager", "user", "morty@the-citadel.com");
Relation expectedFriendRelation = Directory.buildRelation("user", "rick@the-citadel.com", "friend", "user", "morty@the-citadel.com");

directoryClient.setRelation(
"user",
"morty@the-citadel.com",
"rick@the-citadel.com",
"friend",
"user",
"rick@the-citadel.com");
"morty@the-citadel.com");

GetRelationsRequest getRelationsRequest = GetRelationsRequest.newBuilder().setObjectType("user").build();

Expand All @@ -217,10 +217,10 @@ void testCheckRelationManager() {
// Arrange & Act
CheckRelationResponse checkRelationResponse = directoryClient.checkRelation(
"user",
"morty@the-citadel.com",
"rick@the-citadel.com",
"manager",
"user",
"rick@the-citadel.com");
"morty@the-citadel.com");

// Assert
assertTrue(checkRelationResponse.getCheck());
Expand All @@ -231,10 +231,10 @@ void testCheckRelationFriend() {
// Arrange & Act
CheckRelationResponse checkRelationResponse = directoryClient.checkRelation(
"user",
"morty@the-citadel.com",
"rick@the-citadel.com",
"friend",
"user",
"rick@the-citadel.com");
"morty@the-citadel.com");

// Assert
assertFalse(checkRelationResponse.getCheck());
Expand All @@ -245,10 +245,10 @@ void testCheckManager() {
// Arrange & Act
CheckResponse checkResponse = directoryClient.check(
"user",
"morty@the-citadel.com",
"rick@the-citadel.com",
"manager",
"user",
"rick@the-citadel.com");
"morty@the-citadel.com");

// Assert
assertTrue(checkResponse.getCheck());
Expand All @@ -259,18 +259,18 @@ void testGetGraph() {
// Arrange
GetGraphRequest getGraphRequest = GetGraphRequest.newBuilder()
.setAnchorType("user")
.setAnchorId("morty@the-citadel.com")
.setAnchorId("rick@the-citadel.com")
.setObjectType("user")
.setObjectId("morty@the-citadel.com")
.setObjectId("rick@the-citadel.com")
.build();

List<ObjectDependency> objectDependencyList = Arrays.asList(
ObjectDependency.newBuilder()
.setObjectType("user")
.setObjectId("morty@the-citadel.com")
.setObjectId("rick@the-citadel.com")
.setRelation("manager")
.setSubjectType("user")
.setSubjectId("rick@the-citadel.com")
.setSubjectId("morty@the-citadel.com")
.build()
);

Expand Down Expand Up @@ -426,7 +426,7 @@ private List<ImportElement> importCitadelDataList() {
Object editorGroup = Directory.buildObject("group", "editor");
Relation rickAdminRelation = Directory.buildRelation("group", "admin", "member", "user", "[email protected]");
Relation mortyEditorRelation = Directory.buildRelation("group", "editor", "member", "user", "[email protected]");
Relation managerRelation = Directory.buildRelation("user", "morty@the-citadel.com", "manager", "user", "rick@the-citadel.com");
Relation managerRelation = Directory.buildRelation("user", "rick@the-citadel.com", "manager", "user", "morty@the-citadel.com");

importElements.add(new ImportElement(rick));
importElements.add(new ImportElement(morty));
Expand Down

0 comments on commit 08032ef

Please sign in to comment.