コード例 #1
0
    def setUp(self):
        self.gpg = gnupg.GPG(gnupghome='src/tests/data/test_gpg_home')
        self.keyid = utilities.load_configs(
            "src/tests/data/test_gpg.cfg").get("pgpprocessor", "keyid")
        self.test_keyid = "1" * 40
        self.original_update_time = time.time()
        a_service = Santiago.SERVICE_NAME

        hosting = {
            self.keyid: {
                a_service:
                    ["http://127.0.0.1"],
                Santiago.update_time(a_service):
                    str(self.original_update_time) }}
        consuming = {
            self.keyid: {
                a_service:
                    ["http://127.0.0.2"],
                Santiago.update_time(a_service):
                    str(self.original_update_time) }}

        self.santiago = Santiago(
            hosting = hosting,
            consuming = consuming,
            my_key_id = self.keyid,
            gpg = self.gpg,
            save_dir='src/tests/data/CLI_Controller')

        controller.SANTIAGO_INSTANCE = self.santiago
        self.bjsonRpcInstance = controller.BjsonRpcHost(None)
コード例 #2
0
 def setUp(self):
     valid = 'src/tests/data/test_expired_keys/test_expired_then_valid_keys/'
     expired = 'src/tests/data/test_expired_keys/test_still_expired_keys/'
     expired_config = 'src/tests/data/test_expired_keys/test_expired_then_valid.cfg'
     self.iterations = 3
     self.gpg_expired_then_valid = gnupg.GPG(gnupghome=valid)
     self.gpg_expired = gnupg.GPG(gnupghome=expired)
     self.config = utilities.load_configs(expired_config)
コード例 #3
0
 def test_load_from_config(self):
     configs = utilities.load_configs(self.config)
     protocols = santiago_run.listify_string(
         configs.get("connectors", "protocols"))
     connectors = santiago_run.load_connectors(protocols, configs)
     listeners, _, _ = santiago_run.configure_connectors(
         protocols, connectors)
     self.assertEqual('8888', listeners['https']['socket_port'])
     self.assertEqual('data/freedombuddy.crt', listeners['https']['ssl_certificate'])
     self.assertEqual('data/freedombuddy.crt', listeners['https']['ssl_private_key'])
コード例 #4
0
    def setUp(self):

        self.iterations = 3
        self.gpg = gnupg.GPG(gnupghome='src/tests/data/test_gpg_home')
        config = utilities.load_configs("src/tests/data/test_gpg.cfg")
        self.key_id = utilities.safe_load(config, "pgpprocessor", "keyid", 0)
        self.messages = utilities.multi_sign(
            message = "hi",
            gpg = self.gpg,
            iterations = self.iterations,
            keyid = self.key_id)
コード例 #5
0
 def setUp(self):
     self.gpg = gnupg.GPG(gnupghome='src/tests/data/test_gpg_home')
     self.keyid = utilities.load_configs(
         "src/tests/data/test_gpg.cfg").get("pgpprocessor", "keyid")
     self.test_keyid = "1111111111111111111111111111111111111111"
     self.santiago = Santiago(
         hosting = {
             self.keyid: {
                 Santiago.SERVICE_NAME: ["http://127.0.0.1"],
                 Santiago.SERVICE_NAME+'-update-timestamp': None }},
         consuming = {
             self.keyid: {
                 Santiago.SERVICE_NAME: ["http://127.0.0.2"],
                 Santiago.SERVICE_NAME+'-update-timestamp': None }},
         my_key_id = self.keyid,
         gpg = self.gpg,
         save_dir='src/tests/data/CLI_Controller')
     self.cliSender = controller.CliSender(
         santiago = self.santiago,
         https_sender = ("python src/connectors/https/controller.py " +
                         "--outgoing $REQUEST --destination $DESTINATION"),
         cli_sender = "echo $DESTINATION $REQUEST")
コード例 #6
0
 def test_default_value_returned_if_config_file_does_not_exist(self):
     self.config = utilities.load_configs('d')
     self.assertEqual("test", utilities.safe_load(self.config,"pgpprocessor","keyid","test"))
コード例 #7
0
 def test_default_value_returned_from_config_file_with_incorrect_section(self):
     self.config = utilities.load_configs(self.config_to_use)
     self.assertEqual(None, utilities.safe_load(self.config,"incorrectly_named_section"))
コード例 #8
0
 def test_correct_section_returned_from_config_file(self):
     self.config = utilities.load_configs(self.config_to_use)
     self.assertEqual([('keyid', '95801F1ABE01C28B05ADBE5FA7C860604DAE2628')], utilities.safe_load(self.config,"pgpprocessor"))
コード例 #9
0
 def test_correct_value_returned_from_config_file(self):
     self.config = utilities.load_configs(self.config_to_use)
     self.assertEqual("95801F1ABE01C28B05ADBE5FA7C860604DAE2628", utilities.safe_load(self.config,"pgpprocessor","keyid"))
コード例 #10
0
 def test_confirm_error_raised_if_config_file_does_not_exist(self):
     self.config = utilities.load_configs('d')
     self.assertRaises(NoSectionError, self.config.get,"pgpprocessor","keyid")
コード例 #11
0
 def test_confirm_config_loaded_from_correct_file(self):
     self.config = utilities.load_configs(self.config_to_use)
     self.assertEqual("95801F1ABE01C28B05ADBE5FA7C860604DAE2628", self.config.get("pgpprocessor","keyid"))