server: add json file test

This commit is contained in:
0x1eef 2023-06-27 13:54:48 -03:00
parent 092d3ec623
commit 3fddb22b02
2 changed files with 9 additions and 0 deletions

View file

@ -0,0 +1 @@
[{"id":"1","place_of_revelation":"makkah","transliterated_name":"Al-Fatihah","translated_name":"The Opener","verse_count":7,"slug":"al-fatihah","codepoints":[1575,1604,1601,1575,1578,1581,1577]},[1,"بِسْمِ اللَّهِ الرَّحْمَـٰنِ الرَّحِيمِ"],[2,"الْحَمْدُ لِلَّهِ رَبِّ الْعَالَمِينَ"],[3,"الرَّحْمَـٰنِ الرَّحِيمِ"],[4,"مَالِكِ يَوْمِ الدِّينِ"],[5,"إِيَّاكَ نَعْبُدُ وَإِيَّاكَ نَسْتَعِينُ"],[6,"اهْدِنَا الصِّرَاطَ الْمُسْتَقِيمَ"],[7,"صِرَاطَ الَّذِينَ أَنْعَمْتَ عَلَيْهِمْ غَيْرِ الْمَغْضُوبِ عَلَيْهِمْ وَلَا الضَّالِّينَ"]]

View file

@ -35,6 +35,14 @@ class ServerDirTest < Test::Unit::TestCase
last_response.content_length
end
def test_json_file
get "/json/1.json"
assert_equal 200, last_response.status
assert_equal "application/json", last_response.content_type
assert_equal bytesize("./test/fakeweb/json/1.json"),
last_response.content_length
end
def test_permission_denied
File.chmod 0, "./test/fakeweb/permission_denied.html"
get "/permission_denied.html"