<commit_before><?php

namespace Pantheon\Terminus\Tests\Functional;

use Pantheon\Terminus\Tests\Traits\TerminusTestTrait;
use PHPUnit\Framework\TestCase;

/**
 * Class SSHKeyCommandsTest
 *
 * @package Pantheon\Terminus\Tests\Functional
 */
class SSHKeyCommandsTest extends TestCase
{
    use TerminusTestTrait;

    /**
     * @test
     * @covers \Pantheon\Terminus\Commands\SSHKey\ListCommand
     * @covers \Pantheon\Terminus\Commands\SSHKey\AddCommand
     * @covers \Pantheon\Terminus\Commands\SSHKey\RemoveCommand
     *
     * @group sshkey
     * @group todo
     */
    public function testSSHKeyCommand()
    {
        $this->fail("To Be Written.");
    }
}<commit_msg>Add SSHKeyCommandsTest.php (#2197)<commit_after><?php

namespace Pantheon\Terminus\Tests\Functional;

use Pantheon\Terminus\Tests\Traits\TerminusTestTrait;
use PHPUnit\Framework\TestCase;

/**
 * Class SSHKeyCommandsTest
 *
 * @package Pantheon\Terminus\Tests\Functional
 */
class SSHKeyCommandsTest extends TestCase
{
    use TerminusTestTrait;

    /**
     * @test
     * @covers \Pantheon\Terminus\Commands\SSHKey\ListCommand
     * @covers \Pantheon\Terminus\Commands\SSHKey\AddCommand
     * @covers \Pantheon\Terminus\Commands\SSHKey\RemoveCommand
     *
     * @group ssh
     * @group short
     */
    public function testSSHKeyCommand()
    {
        $cwd = getcwd();
        $dummy_key_file = "$cwd/tests/config/dummy_key.pub";

        // Initial list
        $ssh_key_list = $this->terminusJsonResponse('ssh-key:list');
        $original_id_list = array_keys($ssh_key_list);
        $key_count = count($ssh_key_list);

        // Add new key
        $this->terminus("ssh-key:add $dummy_key_file");
        $ssh_key_list_new = $this->terminusJsonResponse('ssh-key:list');

        $this->assertGreaterThan($key_count, count($ssh_key_list_new));
        $new_id_list = array_keys($ssh_key_list_new);
        $new_key = array_diff($new_id_list, $original_id_list);
        $new_key = $new_key[0];

        // Remove
        $this->terminus("ssh-key:remove $new_key");
        $ssh_key_list_new2 = $this->terminusJsonResponse('ssh-key:list');
        $this->assertEquals($key_count, count($ssh_key_list_new2));
    }
}
{'fraction_non_alphanumeric': 0.12856496152105024, 'fraction_numerical': 0.003168854685377999, 'mean_word_length': 3.2418426103646834, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '3616753', 'n_tokens_mistral': 790, 'n_tokens_neox': 759, 'n_words': 102}