|
1054 | 1054 | "description": "send sync report notification to slack (orphaned user check skipped)" |
1055 | 1055 | } |
1056 | 1056 | ] |
| 1057 | + }, |
| 1058 | + { |
| 1059 | + "name": "okta_sync_users_without_github_username", |
| 1060 | + "description": "Test that Okta users without GitHub username are skipped but tracked in sync report", |
| 1061 | + "event_type": "scheduled_event", |
| 1062 | + "event_payload": { |
| 1063 | + "action": "okta-sync" |
| 1064 | + }, |
| 1065 | + "expected_calls": [ |
| 1066 | + { |
| 1067 | + "service": "okta", |
| 1068 | + "method": "GET", |
| 1069 | + "path": "/api/v1/groups" |
| 1070 | + }, |
| 1071 | + { |
| 1072 | + "service": "github", |
| 1073 | + "method": "GET", |
| 1074 | + "path": "/orgs/*/teams/*" |
| 1075 | + }, |
| 1076 | + { |
| 1077 | + "service": "github", |
| 1078 | + "method": "PUT", |
| 1079 | + "path": "/orgs/acme-ghorg/teams/engineering/memberships/alice-gh" |
| 1080 | + }, |
| 1081 | + { |
| 1082 | + "service": "slack", |
| 1083 | + "method": "POST", |
| 1084 | + "path": "/chat.postMessage" |
| 1085 | + } |
| 1086 | + ], |
| 1087 | + "mock_responses": [ |
| 1088 | + { |
| 1089 | + "service": "github", |
| 1090 | + "method": "POST", |
| 1091 | + "path": "/app/installations/987654/access_tokens", |
| 1092 | + "status_code": 201, |
| 1093 | + "body": "{\"token\":\"ghs_mock_installation_token\",\"expires_at\":\"2099-12-31T23:59:59Z\"}", |
| 1094 | + "description": "github app installation token authentication" |
| 1095 | + }, |
| 1096 | + { |
| 1097 | + "service": "github", |
| 1098 | + "method": "GET", |
| 1099 | + "path": "/orgs/acme-ghorg/teams/engineering", |
| 1100 | + "status_code": 200, |
| 1101 | + "body": "{\"id\":1,\"name\":\"Engineering\",\"slug\":\"engineering\",\"description\":\"Engineering team\"}", |
| 1102 | + "description": "fetch engineering team details" |
| 1103 | + }, |
| 1104 | + { |
| 1105 | + "service": "github", |
| 1106 | + "method": "GET", |
| 1107 | + "path": "/orgs/acme-ghorg/teams/engineering/members", |
| 1108 | + "status_code": 200, |
| 1109 | + "body": "[]", |
| 1110 | + "description": "engineering team has no existing members" |
| 1111 | + }, |
| 1112 | + { |
| 1113 | + "service": "github", |
| 1114 | + "method": "PUT", |
| 1115 | + "path": "/orgs/acme-ghorg/teams/engineering/memberships/alice-gh", |
| 1116 | + "status_code": 200, |
| 1117 | + "body": "{\"state\":\"active\",\"role\":\"member\"}", |
| 1118 | + "description": "add alice-gh to team (only user with github username)" |
| 1119 | + }, |
| 1120 | + { |
| 1121 | + "service": "okta", |
| 1122 | + "method": "POST", |
| 1123 | + "path": "/oauth2/v1/token", |
| 1124 | + "status_code": 200, |
| 1125 | + "body": "{\"token_type\":\"Bearer\",\"expires_in\":3600,\"access_token\":\"mock-access-token\",\"scope\":\"okta.groups.read okta.users.read\"}", |
| 1126 | + "description": "okta oauth 2.0 token authentication" |
| 1127 | + }, |
| 1128 | + { |
| 1129 | + "service": "okta", |
| 1130 | + "method": "GET", |
| 1131 | + "path": "/api/v1/groups", |
| 1132 | + "status_code": 200, |
| 1133 | + "body": "[{\"id\":\"00g1234567890abcdef\",\"profile\":{\"name\":\"Engineering\",\"description\":\"Engineering team\"}}]", |
| 1134 | + "description": "fetch all okta groups (returns engineering group)" |
| 1135 | + }, |
| 1136 | + { |
| 1137 | + "service": "okta", |
| 1138 | + "method": "GET", |
| 1139 | + "path": "/api/v1/groups/00g1234567890abcdef/users", |
| 1140 | + "status_code": 200, |
| 1141 | + "body": "[{\"id\":\"00u1111111111111111\",\"status\":\"ACTIVE\",\"profile\":{\"email\":\"alice@example.com\",\"githubUsername\":\"alice-gh\"}},{\"id\":\"00u2222222222222222\",\"status\":\"ACTIVE\",\"profile\":{\"email\":\"bob@example.com\"}},{\"id\":\"00u3333333333333333\",\"status\":\"ACTIVE\",\"profile\":{\"email\":\"charlie@example.com\",\"githubUsername\":\"\"}}]", |
| 1142 | + "description": "fetch users in engineering group (alice has gh username, bob and charlie do not)" |
| 1143 | + }, |
| 1144 | + { |
| 1145 | + "service": "slack", |
| 1146 | + "method": "POST", |
| 1147 | + "path": "/chat.postMessage", |
| 1148 | + "status_code": 200, |
| 1149 | + "body": "{\"ok\":true,\"channel\":\"C01234TEST\",\"ts\":\"1234567890.123456\"}", |
| 1150 | + "description": "send sync report to slack (should include skipped users count)" |
| 1151 | + } |
| 1152 | + ] |
1057 | 1153 | } |
1058 | 1154 | ] |
0 commit comments