text:
$CONFIG = {
  appstore: '${PUBLIC_APPSTORE}:branch/tma:/apps',
  username: '<USERNAME>',
  password: '<PASSWORD>',
  domain: '<DOMAIN>',
  hostname: '<HOSTNAME>',
  server: 'https://<SERVER>',

  tokens: {
    postgres: '<TOKEN_POSTGRES>',
    vertica: '<TOKEN_VERTICA>',
  },

  segments: {
    basic: {
      name: 'PostgreSQL Master ##{version}',
      driver: 'Pg',
      master_project: 'pid'
    },
    premium: {
      name: 'Vertica Master ##{version}',
      driver: 'vertica'
    }
  },

  projects: {
    development: 'qlqru2j19kikaddvhbm6jz76kjye24l4',
    service: 'lt8xrgfpi9k9r56nwhurjt48ftikzezz'
  },

  # ADS Settings
  ads: {
    hostname: '<ADS_HOSTNAME>',
    username: '<USERNAME>',
    password: '<PASSWORD>',
    id: 'w9c4aec5c9944ac5789e8bcc7b352b23',
    query: {
      provisioning: 'SELECT identifier as client_id, name as project_title, segment as segment_id FROM lcm_project;',
      domain_users: 'SELECT distinct LOWER(login) as login, LOWER(login) as email, first_name, last_name FROM lcm_user;',
      project_users: 'SELECT client_id as custom_project_id, LOWER(login) as login, role FROM lcm_user;',
      release: 'SELECT segment_id, master_project_id from lcm_release;'
    }
  },

  # Deployment Settings
  deploy: {
    username: '<USERNAME>',
    password: '<PASSWORD>',
    domain: '<DOMAIN>',
    server: 'https://<SERVER>'
  },

  # Ignore list for user brick
  whitelist: [
    '@gooddata.com'
  ]
}


text:
/* General Update Directory Cleanup Tests - Bug 601701 */

function run_test() {
  do_test_pending();
  do_register_cleanup(end_test);

  removeUpdateDirsAndFiles();

  writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
  var patches = getLocalPatchString(null, null, null, null, null, null,
                                    STATE_PENDING);
  var updates = getLocalUpdateString(patches);
  writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
  writeVersionFile("99.9");

  standardInit();

  // Check that there is no activeUpdate first so the updates directory is
  // cleaned before the remaining tests.
  do_check_eq(gUpdateManager.activeUpdate, null);
  do_check_eq(gUpdateManager.updateCount, 0);

  var dir = getUpdatesDir();
  dir.append("0");
  logTestInfo("testing " + dir.path + " should exist");
  do_check_true(dir.exists());

  var versionFile = dir.clone();
  versionFile.append(FILE_UPDATE_VERSION);
  logTestInfo("testing " + versionFile.path + " should not exist");
  do_check_false(versionFile.exists());

  do_test_finished();
}

function end_test() {
  cleanUp();
}

redpajama_set_name: RedPajamaGithub


text:
"""Module for testing the add cpu command."""

import unittest

if __name__ == "__main__":
    import utils
    utils.import_depends()

from brokertest import TestBrokerCommand

class TestAddCpu(TestBrokerCommand):

    def test_100_add_utcpu(self):
        command = ["add", "cpu", "--cpu", "utcpu", "--vendor", "intel",
                   "--comments", "Some CPU comments"]
        self.statustest(command)

    def test_105_show_utcpu(self):
        command = "show cpu --cpu utcpu --vendor intel"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out, "Vendor: intel Model: utcpu", command)
        self.matchoutput(out, "Model Type: cpu", command)
        self.matchoutput(out, "Comments: Some CPU comments", command)

    def test_110_add_utcpu_1500(self):
        command = "add cpu --cpu utcpu_1500 --vendor intel"
        self.statustest(command.split(" "))

    def test_115_show_utcpu_1500(self):
        command = "show cpu --cpu utcpu_1500"
        out = self.commandtest(command.split(" "))
        self.matchoutput(out, "Vendor: intel Model: utcpu_1500", command)

    def test_120_add_unused_cpu(self):
        # A CPU model that should not be used by any machines
        self.noouttest(["add_model", "--type", "cpu", "--model", "unused",
                        "--vendor", "utvendor"])

    def test_200_add_utcpu_again(self):
        command = ["add", "cpu", "--cpu", "utcpu", "--vendor", "intel",
                   "--comments", "Some CPU comments"]
        self.badrequesttest(command)

    def test_300_show_all(self):
        command = ["show_cpu", "--all"]
        out = self.commandtest(command)
        self.matchoutput(out, "Vendor: intel Model: utcpu", command)

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TestAddCpu)
    unittest.TextTestRunner(verbosity=2).run(suite)


text:
<?php

namespace Franzip\SerpFetcher\GoogleFetcher\Test;
use Franzip\SerpFetcher\Helpers\TestHelper;
use Franzip\SerpFetcher\SerpFetcherBuilder as Builder;
use \PHPUnit_Framework_TestCase as PHPUnit_Framework_TestCase;

class GoogleFetcherTest extends PHPUnit_Framework_TestCase
{
    protected function tearDown()
    {
        TestHelper::cleanMess();
    }

    public function testFetchingPageUrls()
    {
        $googleFetcher = Builder::create('Google');
        $getPageUrls = TestHelper::getMethod('getPageUrls', 'Google');
        $getSHDWrapper = TestHelper::getMethod('getSHDWrapper', 'Google');
        $SHDObject = $getSHDWrapper->invokeArgs($googleFetcher,
                                                array('http://www.google.com/search?q=foo'));
        $urls = $getPageUrls->invokeArgs($googleFetcher, array($SHDObject));
        $this->assertCount(10, $urls);
        $this->assertTrue($googleFetcher->cacheHit('http://www.google.com/search?q=foo'));
        $this->assertFalse($googleFetcher->cacheHit('https://www.google.com/search?q=foo&start=10'));
        $SHDObject = $getSHDWrapper->invokeArgs($googleFetcher,
                                                array('https://www.google.com/search?q=foo&start=10'));
        $urls = $getPageUrls->invokeArgs($googleFetcher, array($SHDObject));
        $this->assertCount(10, $urls);
        $this->assertTrue($googleFetcher->cacheHit('http://www.google.com/search?q=foo'));
        $this->assertTrue($googleFetcher->cacheHit('https://www.google.com/search?q=foo&start=10'));
        $googleFetcher->flushCache();
        $this->assertFalse($googleFetcher->cacheHit('http://www.google.com/search?q=foo'));
        $this->assertFalse($googleFetcher->cacheHit('https://www.google.com/search?q=foo&start=10'));
        $googleFetcher->removeCache();
    }

    public function testFetchingPageTitles()
    {
        $googleFetcher = Builder::create('Google');
        $getPageTitles = TestHelper::getMethod('getPageTitles', 'Google');
        $getSHDWrapper = TestHelper::getMethod('getSHDWrapper', 'Google');
        $SHDObject = $getSHDWrapper->invokeArgs($googleFetcher,
                                                array('http://www.google.com/search?q=foo'));
        $titles = $getPageTitles->invokeArgs($googleFetcher, array($SHDObject));
        $this->assertCount(10, $titles);
        foreach ($titles as $title) {
            $this->assertTrue(is_string($title) && !empty($title));
        }
        $this->assertTrue($googleFetcher->cacheHit('http://www.google.com/search?q=foo'));
        $this->assertFalse($googleFetcher->cacheHit('https://www.google.com/search?q=foo&start=10'));
        $SHDObject = $getSHDWrapper->invokeArgs($googleFetcher,
                                                array('https://www.google.com/search?q=foo&start=10'));
        $titles = $getPageTitles->invokeArgs($googleFetcher, array($SHDObject));
        $this->assertCount(10, $titles);
        foreach ($titles as $title) {
            $this->assertTrue(is_string($title) && !empty($title));
        }
        $this->assertTrue($googleFetcher->cacheHit('http://www.google.com/search?q=foo'));
        $this->assertTrue($googleFetcher->cacheHit('https://www.google.com/search?q=foo&start=10'));
        $googleFetcher->flushCache();
        $this->assertFalse($googleFetcher->cacheHit('http://www.google.com/search?q=foo'));
        $this->assertFalse($googleFetcher->cacheHit('https://www.google.com/search?q=foo&start=10'));
        $googleFetcher->removeCache();
    }

    public function testFetchingPageSnippets()
    {
        $googleFetcher = Builder::create('Google');
        $getPageSnippets = TestHelper::getMethod('getPageSnippets', 'Google');
        $getSHDWrapper = TestHelper::getMethod('getSHDWrapper', 'Google');
        $SHDObject = $getSHDWrapper->invokeArgs($googleFetcher,
                                                array('http://www.google.com/search?q=foo'));
        $snippets = $getPageSnippets->invokeArgs($googleFetcher, array($SHDObject));
        $this->assertCount(10, $snippets);
        foreach ($snippets as $snippet) {
            $this->assertTrue(is_string($snippet));
        }
        $this->assertTrue($googleFetcher->cacheHit('http://www.google.com/search?q=foo'));
        $this->assertFalse($googleFetcher->cacheHit('https://www.google.com/search?q=foo&start=10'));
        $SHDObject = $getSHDWrapper->invokeArgs($googleFetcher,
                                                array('https://www.google.com/search?q=foo&start=10'));
        $snippets = $getPageSnippets->invokeArgs($googleFetcher, array($SHDObject));
        $this->assertCount(10, $snippets);
        foreach ($snippets as $snippet) {
            $this->assertTrue(is_string($snippet));
        }
        $this->assertTrue($googleFetcher->cacheHit('http://www.google.com/search?q=foo'));
        $this->assertTrue($googleFetcher->cacheHit('https://www.google.com/search?q=foo&start=10'));
        $googleFetcher->flushCache();
        $this->assertFalse($googleFetcher->cacheHit('http://www.google.com/search?q=foo'));
        $this->assertFalse($googleFetcher->cacheHit('https://www.google.com/search?q=foo&start=10'));
        $googleFetcher->removeCache();
    }

    public function testFetchingMainMethod()
    {
        $googleFetcher = Builder::create('Google');
        $results = $googleFetcher->fetch('http://www.google.com/search?q=foo');
        $this->assertArrayHasKey('urls', $results);
        $this->assertArrayHasKey('titles', $results);
        $this->assertArrayHasKey('snippets', $results);
        $this->assertCount(10, $results['urls']);
        $this->assertCount(10, $results['titles']);
        $this->assertCount(10, $results['snippets']);
    }
}