summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2023-05-18 08:25:43 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2023-08-09 10:58:45 +0200
commit0d061efe64bc01b6e6d568bd7e1ea07c4126f24c (patch)
tree1df74a55916e9d6c28d33bcc65b5ee275c68a617 /tests
parentca6cedeb28ec3299263df2e07dfe15744d166646 (diff)
add Test for old items
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
Diffstat (limited to 'tests')
m---------tests/test_helper/php-feed-generator0
-rw-r--r--tests/updater/update.bats27
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_helper/php-feed-generator b/tests/test_helper/php-feed-generator
-Subproject 7cc16048103bf31e9a4b54293e8bbc6049a874c
+Subproject 50b6010a2e93b58bbc04468af7a9242fee7a444
diff --git a/tests/updater/update.bats b/tests/updater/update.bats
index ba978dbb0..e55661bc1 100644
--- a/tests/updater/update.bats
+++ b/tests/updater/update.bats
@@ -85,6 +85,33 @@ teardown() {
assert_output --partial "${ID_LIST1[*]}"
}
+@test "[$TESTSUITE] Test feed with 'outdated' items https://github.com/nextcloud/news/issues/2236 " {
+ # Create Feed, for the first fetch a timestamp today -1 year is used.
+ FEEDID=$(http --ignore-stdin -b -a ${user}:${APP_PASSWORD} POST ${BASE_URLv1}/feeds url=$TEST_FEED | grep -Po '"id":\K([0-9]+)')
+
+ sleep 2
+
+ # Get Items
+ ID_LIST1=($(http --ignore-stdin -b -a ${user}:${APP_PASSWORD} GET ${BASE_URLv1}/items | grep -Po '"id":\K([0-9]+)' | tr '\n' ' '))
+
+ # Generate Feed with older items (-o yes)
+ php ${BATS_TEST_DIRNAME}/../test_helper/php-feed-generator/feed-generator.php -a 15 -s 9 -f ${BATS_TEST_DIRNAME}/../test_helper/feeds/test.xml -o yes
+
+ # Trigger Update
+ http --ignore-stdin -b -a ${user}:${APP_PASSWORD} GET ${BASE_URLv1}/feeds/update userId=${user} feedId=$FEEDID
+
+ sleep 2
+
+ # Get Items again
+ ID_LIST2=($(http --ignore-stdin -b -a ${user}:${APP_PASSWORD} GET ${BASE_URLv1}/items | grep -Po '"id":\K([0-9]+)' | tr '\n' ' '))
+
+ output="${ID_LIST2[*]}"
+
+ # Check that they are not equal but that they match partially.
+ assert_not_equal "${ID_LIST1[*]}" "${ID_LIST2[*]}"
+ assert_output --partial "${ID_LIST1[*]}"
+}
+
@test "[$TESTSUITE] Test purge with small feed" {
# Generate Feed with 210 items.
php ${BATS_TEST_DIRNAME}/../test_helper/php-feed-generator/feed-generator.php -a 50 -s 0 -f ${BATS_TEST_DIRNAME}/../test_helper/feeds/test.xml