示例#1
0
    def setUp(self):
        if not os.path.exists(os.path.abspath('migrations')):
            os.mkdir(os.path.abspath('migrations'))
        self.config = create_config(migrations_dir='.:migrations')
        self.test_migration_files = []

        self.test_migration_files.append(os.path.abspath(create_migration_file('20090214115100_01_test_migration.migration', 'foo', 'bar')))
        self.test_migration_files.append(os.path.abspath(create_migration_file('migrations/20090214115200_02_test_migration.migration', 'foo', 'bar')))
        self.test_migration_files.append(os.path.abspath(create_migration_file('20090214115300_03_test_migration.migration', 'foo', 'bar')))
        self.test_migration_files.append(os.path.abspath(create_migration_file('20090214115400_04_test_migration.migration', 'foo', 'bar')))
        self.test_migration_files.append(os.path.abspath(create_migration_file('migrations/20090214115500_05_test_migration.migration', 'foo', 'bar')))
        self.test_migration_files.append(os.path.abspath(create_migration_file('migrations/20090214115600_06_test_migration.migration', 'foo', 'bar')))
示例#2
0
    def setUp(self):
        super(SimpleDBMigrateTest, self).setUp()
        if not os.path.exists(os.path.abspath('migrations')):
            os.mkdir(os.path.abspath('migrations'))
        self.config = create_config(migrations_dir='.:migrations')
        self.test_migration_files = []

        self.test_migration_files.append(os.path.abspath(create_migration_file('20090214115100_01_test_migration.migration', 'foo', 'bar')))
        self.test_migration_files.append(os.path.abspath(create_migration_file('migrations/20090214115200_02_test_migration.migration', 'foo', 'bar')))
        self.test_migration_files.append(os.path.abspath(create_migration_file('20090214115300_03_test_migration.migration', 'foo', 'bar')))
        self.test_migration_files.append(os.path.abspath(create_migration_file('20090214115400_04_test_migration.migration', 'foo', 'bar')))
        self.test_migration_files.append(os.path.abspath(create_migration_file('migrations/20090214115500_05_test_migration.migration', 'foo', 'bar')))
        self.test_migration_files.append(os.path.abspath(create_migration_file('migrations/20090214115600_06_test_migration.migration', 'foo', 'bar')))
示例#3
0
    def setUp(self):
        targets = io.StringIO("127.0.0.1\n")
        options_agent = Namespace(name='data/data_agent',
                                  s='127.0.0.1',
                                  p=9011,
                                  cmd='agent')
        options_srv = Namespace(name='data',
                                b='127.0.0.1',
                                p=9011,
                                cmd='srv',
                                targets=targets)

        self.cfg = create_config()
        self.settings_srv = Config(self.cfg, options_srv)
        self.settings_srv.target_optimization(targets)
        self.settings_agent = Config(self.cfg, options_agent)
示例#4
0
 def setUp(self):
     options = Namespace(name='data', b='127.0.0.1', p=9011,
                         cmd='srv', targets='foofile')
     self.cfg = create_config()
     self.patcher = patch('os.makedirs')
     mos_isfile = patch('os.path.isfile')
     mos_isfile.return_value = True
     mos_isfile.start()
     self.mock_makedirs = self.patcher.start()
     self.settings = Config(self.cfg, options)
     # ctx = Context(self.settings)
     self.ctx = MagicMock(spect=Context)
     self.ctx.pop.return_value = ("127.0.0.1", "-sV -Pn -p1-1000")
     self.ctx.secret_key = self.settings.secret_key
     self.ctx.is_finished = False
     self.mock_server = MagicMock(spect=DScanServer)
     self.mock_server.secret_key = self.settings.secret_key
     self.mock_terminate = MagicMock()
     self.mock_terminate.is_set.return_value = False
     self.hmac_patch = patch.object(hmac, 'compare_digest',
                                    return_value=True)
     self.challenge = b'4%x8p\x8d\xda\x04\xe5r\xfb\xc1Si8[' \
                      b'\xcb\x1a\x1c\x84\xf5\xb5%\x15[' \
                      b'\xea\x10\x96)!n\xe3\xadit\x0f\x15e\xc2\x06\xd1' \
                      b'\xd8\xb0' \
                      b'\xc5\x81\x87\xf2s\xe3\xd8\x95\xd1\x9c\xbdM\x8f' \
                      b'\x9c\xd5' \
                      b'\x14\xb3\x8e\xdd\x8eQ\xffw\x10Y8\xa5\xa5\x83\xf3' \
                      b'\xeeQ' \
                      b'\xa1\xfcOP\x9d\xd6\x80x\x80\x9eh\x11\xa7\xd7\xce' \
                      b'\xcf' \
                      b'.\xec\x01\x94S\xd4\x1d\x7f\xef\x83e\xe8\xfa\xf9' \
                      b'`\xfb' \
                      b'\xc6:SB\xeff\x15\r\xcb\xe9\xa4\xefO\x03i\xe9' \
                      b'\xefoMz\x8b'
     self.hmac_patch.start()
     self.addCleanup(self.patcher.stop)
     self.addCleanup(self.hmac_patch.stop)
     self.addCleanup(mos_isfile.stop)
 def setUp(self):
     super(SimpleVirtuosoMigrateTest, self).setUp()
     self.config = create_config(migrations_dir='.')