-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Marcus Fihlon <[email protected]>
- Loading branch information
Showing
6 changed files
with
227 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
src/test/java/swiss/fihlon/apus/configuration/AdminConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Apus - A social wall for conferences with additional features. | ||
* Copyright (C) Marcus Fihlon and the individual contributors to Apus. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package swiss.fihlon.apus.configuration; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import swiss.fihlon.apus.util.PasswordUtil; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
@SpringBootTest | ||
class AdminConfigTest { | ||
|
||
@Autowired | ||
private Configuration configuration; | ||
|
||
@Test | ||
void testAdminConfig() { | ||
final var adminConfig = configuration.getAdmin(); | ||
assertNotNull(adminConfig); | ||
assertFalse(adminConfig.password().isBlank()); | ||
assertTrue(PasswordUtil.matches("12345", adminConfig.password())); | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
src/test/java/swiss/fihlon/apus/configuration/ConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Apus - A social wall for conferences with additional features. | ||
* Copyright (C) Marcus Fihlon and the individual contributors to Apus. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package swiss.fihlon.apus.configuration; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
@SpringBootTest | ||
class ConfigurationTest { | ||
|
||
@Autowired | ||
private Configuration configuration; | ||
|
||
@Test | ||
void testConfiguration() { | ||
assertNotNull(configuration); | ||
assertFalse(configuration.getVersion().isBlank()); | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
src/test/java/swiss/fihlon/apus/configuration/FilterConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Apus - A social wall for conferences with additional features. | ||
* Copyright (C) Marcus Fihlon and the individual contributors to Apus. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package swiss.fihlon.apus.configuration; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
import java.util.List; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertIterableEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
@SpringBootTest | ||
class FilterConfigTest { | ||
|
||
@Autowired | ||
private Configuration configuration; | ||
|
||
@Test | ||
void testFilterConfig() { | ||
final var filterConfig = configuration.getFilter(); | ||
assertNotNull(filterConfig); | ||
assertEquals(500, filterConfig.length()); | ||
assertFalse(filterConfig.replies()); | ||
assertTrue(filterConfig.sensitive()); | ||
assertIterableEquals(List.of("foo", "bar", "foobar", "barfoo"), filterConfig.words()); | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
src/test/java/swiss/fihlon/apus/plugin/agenda/doag/DoagConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Apus - A social wall for conferences with additional features. | ||
* Copyright (C) Marcus Fihlon and the individual contributors to Apus. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package swiss.fihlon.apus.plugin.agenda.doag; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import swiss.fihlon.apus.configuration.Configuration; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
@SpringBootTest | ||
class DoagConfigTest { | ||
|
||
@Autowired | ||
private Configuration configuration; | ||
|
||
@Test | ||
void testDoagConfig() { | ||
final var doagConfig = configuration.getDoag(); | ||
assertNotNull(doagConfig); | ||
assertEquals(-1, doagConfig.eventId()); | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
src/test/java/swiss/fihlon/apus/plugin/social/mastodon/MastodonConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Apus - A social wall for conferences with additional features. | ||
* Copyright (C) Marcus Fihlon and the individual contributors to Apus. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package swiss.fihlon.apus.plugin.social.mastodon; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import swiss.fihlon.apus.configuration.Configuration; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
@SpringBootTest | ||
class MastodonConfigTest { | ||
|
||
@Autowired | ||
private Configuration configuration; | ||
|
||
@Test | ||
void testMastodonConfig() { | ||
final var mastodonConfig = configuration.getMastodon(); | ||
assertNotNull(mastodonConfig); | ||
assertEquals("mastodon.social", mastodonConfig.instance()); | ||
assertEquals("java", mastodonConfig.hashtag()); | ||
assertTrue(mastodonConfig.imagesEnabled()); | ||
assertEquals(1, mastodonConfig.imageLimit()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apus.version[email protected]@ | ||
apus.admin.password=$2a$10$nybQbl/iY8SRJkfHJVncS.L5.OC3KJ6VRBYVAID7qnUqwylmn/BtK | ||
apus.filter.length=500 | ||
apus.filter.replies=false | ||
apus.filter.sensitive=true | ||
apus.filter.words=foo, bar, foobar, barfoo | ||
apus.doag.eventId=-1 | ||
apus.mastodon.instance=mastodon.social | ||
apus.mastodon.hashtag=java | ||
apus.mastodon.imagesEnabled=true | ||
apus.mastodon.imageLimit=1 |