<commit_before><?php

namespace Tests\Http;

use Tests\TestCase;
use Rogue\Models\Post;

class ImagesTest extends TestCase
{
    /**
     * Test for endpoint throttling.
     *
     * @return void
     */
    public function testImagesThrottle()
    {
        // Make a post to view
        $posts = factory(Post::class, 10)->create();

        // View the post 15 times (using 3 different versions)
        for ($i = 0; $i < 5; $i++) {
            $response = $this->getJson('images/' . $posts->random()->id)->assertSuccessful(200);
        }
        for ($i = 5; $i < 10; $i++) {
            $response = $this->getJson('images/' . $posts->random()->id . '?w=500&h=500&fit=crop');
            $response->assertStatus(200);
        }
        for ($i = 10; $i < 15; $i++) {
            $response = $this->getJson('images/' . $posts->random()->id . '?w=250&h=400&fit=crop&filt=sepia');
            $response->assertStatus(200);
        }

        // Get a "Too Many Attempts" response when viewing the post a 16th time
        $response = $this->getJson('images/' . $posts->random()->id);
        $response->assertStatus(429);
    }
}<commit_msg>updates test<commit_after><?php

namespace Tests\Http;

use Tests\TestCase;
use Rogue\Models\Post;

class ImagesTest extends TestCase
{
    /**
     * Test for endpoint throttling.
     *
     * @return void
     */
    public function testImagesThrottle()
    {
        // Make a post to view
        $posts = factory(Post::class, 10)->create();

        // View the post 15 times (using 3 different versions)
        for ($i = 0; $i < 5; $i++) {
            $response = $this->getJson('images/' . $posts->random()->id)->assertSuccessful(200);
        }
        for ($i = 5; $i < 10; $i++) {
            $response = $this->getJson('images/' . $posts->random()->id . '?w=500&h=500&fit=crop');
            $response->assertStatus(200);
        }
        for ($i = 10; $i < 30; $i++) {
            $response = $this->getJson('images/' . $posts->random()->id . '?w=250&h=400&fit=crop&filt=sepia');
            $response->assertStatus(200);
        }

        // Get a "Too Many Attempts" response when viewing the post a 16th time
        $response = $this->getJson('images/' . $posts->random()->id);
        $response->assertStatus(429);
    }
}
{'fraction_non_alphanumeric': 0.1810231744643638, 'fraction_numerical': 0.034980323567993, 'mean_word_length': 2.204481792717087, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2819393', 'n_tokens_mistral': 789, 'n_tokens_neox': 719, 'n_words': 171}