use of org.nzbhydra.config.BaseConfig in project nzbhydra2 by theotherp.
the class LogAnonymizerTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
BaseConfig baseConfig = new BaseConfig();
when(configProviderMock.getBaseConfig()).thenReturn(baseConfig);
UserAuthConfig user = new UserAuthConfig();
user.setUsername("someusername");
baseConfig.getAuth().getUsers().add(user);
}
use of org.nzbhydra.config.BaseConfig in project nzbhydra2 by theotherp.
the class IndexerTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(indexerMock.getIndexerEntity()).thenReturn(indexerEntityMock);
when(indexerMock.getConfig()).thenReturn(indexerConfig);
when(indexerEntityMock.getName()).thenReturn("indexerName");
when(indexerMock.getName()).thenReturn("indexerName");
testee.indexer = indexerEntityMock;
testee.config = indexerConfig;
indexerConfig.setTimeout(1);
baseConfig = new BaseConfig();
when(configProviderMock.getBaseConfig()).thenReturn(baseConfig);
baseConfig.getSearching().setIdFallbackToQueryGeneration(SearchSourceRestriction.BOTH);
when(resultAcceptor.acceptResults(anyList(), any(), any())).then(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
return new AcceptorResult(invocation.getArgument(0), HashMultiset.create());
}
});
when(infoProviderMock.convert(anyString(), any())).thenReturn(new MediaInfo(new TvInfo("tvdbid", "tvrageid", "tvmazeid", "title", 2017, "")));
testee = spy(testee);
}
use of org.nzbhydra.config.BaseConfig in project nzbhydra2 by theotherp.
the class IndexerWebAccessTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
String xml = "<?xml version=\"1.0\" ?>\n" + "<metadata>\n" + "</metadata>";
when(webAccessMock.callUrl(anyString(), headersCaptor.capture(), timeoutCaptor.capture())).thenReturn(xml);
BaseConfig baseConfig = new BaseConfig();
baseConfig.setSearching(searchingConfigMock);
when(configProviderMock.getBaseConfig()).thenReturn(baseConfig);
when(searchingConfigMock.getUserAgent()).thenReturn(Optional.of("globalUa"));
when(searchingConfigMock.getTimeout()).thenReturn(100);
indexerConfig.setTimeout(10);
indexerConfig.setUserAgent("indexerUa");
when(unmarshallerMock.unmarshal(any())).thenReturn(new NewznabXmlRoot());
}
Aggregations