Beispiel #1
0
    def test_init_config_basic_auth(self):
        with mock.patch('substra.commands.config.open',
                        empty_file,
                        create=True) as mock_object:
            res = Config({
                '<url>': 'http://toto.com',
                '<version>': '0.1',
                '<user>': 'foo',
                '<password>': 'bar'
            }).run()

            self.assertTrue(
                res == {
                    'default': {
                        'url': 'http://toto.com',
                        'version': '0.1',
                        'insecure': False,
                        'auth': {
                            'user': '******',
                            'password': '******'
                        },
                    }
                })

            self.assertEqual(len(mock_object.call_args_list), 1)
Beispiel #2
0
 def setUp(self):
     Config({
         '<url>': 'http://owkin.substrabac:8000',
         '<version>': '0.0',
         '<user>': os.environ.get('BACK_AUTH_USER', ''),
         '<password>': os.environ.get('BACK_AUTH_PASSWORD', ''),
         '--config': '/tmp/.substra_e2e',
     }).run()
Beispiel #3
0
 def setUp(self):
     Config({
         '<url>': owkin_url,
         '<version>': '0.0',
         '--profile': 'owkin',
         '--config': '/tmp/.substra_e2e_multi_orgs',
         '<user>': os.environ.get('BACK_AUTH_USER', ''),
         '<password>': os.environ.get('BACK_AUTH_PASSWORD', ''),
     }).run()
     Config({
         '<url>': chunantes_url,
         '<version>': '0.0',
         '--profile': 'chunantes',
         '--config': '/tmp/.substra_e2e_multi_orgs',
         '<user>': os.environ.get('BACK_AUTH_USER', ''),
         '<password>': os.environ.get('BACK_AUTH_PASSWORD', ''),
     }).run()
Beispiel #4
0
 def setUp(self):
     with mock.patch('substra.commands.config.config_path',
                     '/tmp/.substra',
                     create=True):
         Config({
             '<url>': 'http://toto.com',
             '<version>': '1.0',
         }).run()
Beispiel #5
0
    def setUp(self):
        self.data_file_path = './tests/assets/data/bulk_update_data.json'

        with mock.patch('substra.commands.config.config_path',
                        '/tmp/.substra',
                        create=True):
            Config({
                '<url>': 'http://toto.com',
                '<version>': '1.0',
            }).run()
Beispiel #6
0
    def setUp(self):
        self.data_manager_file_path = './tests/assets/data_manager/data_manager.json'

        with mock.patch('substra.commands.config.config_path',
                        '/tmp/.substra',
                        create=True):
            Config({
                '<url>': 'http://toto.com',
                '<version>': '1.0',
                '<user>': 'foo',
                '<password>': 'bar'
            }).run()
Beispiel #7
0
    def test_init_config_empty(self):
        with mock.patch('substra.commands.config.open',
                        empty_file,
                        create=True) as mock_object:
            res = Config({
                '<url>': 'http://127.0.0.1:8000',
                '<version>': '0.0',
            }).run()

            self.assertTrue(res == default_config)

            self.assertEqual(len(mock_object.call_args_list), 2)
Beispiel #8
0
    def setUp(self):
        self.data_manager_file_path = './tests/assets/data_manager/data_manager.json'
        self.objective_file_path = './tests/assets/objective/objective.json'
        self.algo_file_path = './tests/assets/algo/algo.json'
        self.data_sample_file_path = './tests/assets/data/data_sample.json'

        with mock.patch('substra.commands.config.config_path',
                        '/tmp/.substra',
                        create=True):
            Config({
                '<url>': 'http://toto.com',
                '<version>': '1.0',
            }).run()
Beispiel #9
0
    def test_add_profile(self):
        Config({
            '<url>': 'http://toto.com',
            '<version>': '1.0',
            '--profile': 'test',
            '--config': '/tmp/.substra_config'
        }).run()

        self.assertTrue({
            'default': {
                'url': 'http://localhost',
                'version': '0.0',
            },
            'test': {
                'url': 'http://toto.com',
                'version': '1.0',
            }
        })
Beispiel #10
0
    def test_init_config_corrupt(self):
        with mock.patch('substra.commands.config.open',
                        corrupt_file,
                        create=True) as mock_object:
            res = Config({
                '<url>': 'http://toto.com',
                '<version>': '1.0',
            }).run()

            self.assertTrue(
                res == {
                    'default': {
                        'url': 'http://toto.com',
                        'version': '1.0',
                        'insecure': False,
                        'auth': False
                    }
                })

            self.assertEqual(len(mock_object.call_args_list), 1)