@Test public void getAllowedIdsDefaultProviderSellerUser() throws Exception { this.mockUserRoles("seller"); RSSProvider provider = new RSSProvider(); provider.setAggregatorId(this.aggregatorId); provider.setProviderId(this.user.getId()); when(providerManager.getProvider(this.aggregatorId, this.user.getId())).thenReturn(provider); this.testGetAllowedIdsCorrect(this.aggregatorId, this.user.getId(), this.aggregatorId, null); }
@Test public void getAllowedIdsSingleProviderAggregatorUser() throws RSSException { this.mockUserRoles("aggregator"); RSSProvider provider = new RSSProvider(); provider.setAggregatorId(this.aggregatorId); provider.setProviderId(this.user.getId()); this.user.setEmail(this.aggregatorId); when(providerManager.getProvider(this.aggregatorId, this.user.getId())).thenReturn(provider); this.testGetAllowedIdsSingleProvider( this.aggregatorId, this.providerId, this.aggregatorId, this.providerId); }
@Test public void throwExceptionProviderNotAllowed() throws Exception { this.mockUserRoles("seller"); RSSProvider provider = new RSSProvider(); provider.setAggregatorId(this.aggregatorId); provider.setProviderId(this.user.getId()); when(providerManager.getProvider(this.aggregatorId, this.user.getId())).thenReturn(provider); this.testExceptionGetIds( this.aggregatorId, this.providerId, "You are not allowed to manage transactions of the specified provider"); }
@Test public void getAllowedIdsSingleProviderAdminUser() throws RSSException { this.mockUserRoles("admin"); Aggregator defaultAggregator = new Aggregator(); defaultAggregator.setAggregatorId(this.user.getEmail()); when(aggregatorManager.getDefaultAggregator()).thenReturn(defaultAggregator); RSSProvider provider = new RSSProvider(); provider.setAggregatorId(this.user.getEmail()); provider.setProviderId(this.providerId); this.user.setId(this.providerId); when(providerManager.getProvider(this.user.getEmail(), this.providerId)).thenReturn(provider); this.testGetAllowedIdsSingleProvider(this.user.getEmail(), this.providerId, null, null); }