Esempio n. 1
0
    def test_dynamic_hosts_f3_f6(self):
        """Testing only hosts that belong to the PRO environment and WEB role"""
        os.environ["THE_ENVIRONMENT"] = "pro"
        os.environ["THE_ROLE"] = "web"
        self._config = configuration.DevConfig()
        dh = DynamicHosts(self._config)
        hosts_list = dh.get_list()

        self.assertEqual("pro", dh.get_environment)
        self.assertEqual("web", dh.get_role)

        for host in hosts_list['all']['hosts']:
            find_host = self._db.get_servers('host', host)
            self.assertEqual(1, len(find_host))
            self.assertEqual("pro", find_host[0].get_data()["environment"])
            self.assertEqual("web", find_host[0].get_data()["role"])
Esempio n. 2
0
    def test_dev_instance(self):
        """Testing Development instance"""
        self._config = configuration.DevConfig()
        self._db = ServersDB(self._config)

        self.assertIsInstance(self._db, ServersDB)
Esempio n. 3
0
        '--verbose',
        '-v',
        action='count',
        help=
        'Displays extra data in the console output. It should not be used in production.'
    )
    parser.add_argument('--version',
                        action='version',
                        version='%(prog)s {} build {}'.format(
                            _V_.__version__, _V_.__build__))

    args = parser.parse_args()

    if args.env:
        if args.env == 'dev':
            _configuration = configuration.DevConfig()
        elif args.env == 'test':
            _configuration = configuration.TestConfig()

    if args.verbose:
        _configuration.verbose = args.verbose

    if args.test:
        exit(test())

    if args.client:
        _configuration.client = args.client

    if args.config:
        exit(show_config())