MockUserSession.set().addComponentPermission(UserRole.USER, SUB_PROJECT_KEY, COMPONENT_KEY);
addComponent();
Result<Rule> result = mock(Result.class);
Rule rule = mock(Rule.class);
when(rule.key()).thenReturn(RuleKey.of("manual", "API"));
when(rule.name()).thenReturn("API");
when(result.getHits()).thenReturn(newArrayList(rule));
when(ruleService.search(any(RuleQuery.class), any(QueryContext.class))).thenReturn(result);
WsTester.TestRequest request = tester.newGetRequest("api/components", "app").setParam("key", COMPONENT_KEY);