def test_from_config_common_partial(self): expected_file_id = '5hjkl1345hjk' expected_api_root = self.LOCAL_APIROOT expected_api_key = None #: :type: GirderDataElement e = GirderDataElement.from_config({'file_id': expected_file_id}) self.assertEqual(e.file_id, expected_file_id) self.assertEqual(e.api_root, expected_api_root) self.assertEqual(e.get_config(), {'file_id': expected_file_id, 'api_root': expected_api_root, 'api_key': expected_api_key, 'token': None})
def test_from_config_full_constructor(self, mock_authenticate): expected_file_id = '34uhki34gh2345ghjk' expected_api_root = 'https://some.other.server/api/v1' expected_api_key = '1234ghk135hlg23435' new_config = { 'token': None, 'file_id': expected_file_id, 'api_root': expected_api_root, 'api_key': expected_api_key, } e = GirderDataElement.from_config(new_config) nose.tools.assert_equal(e.file_id, expected_file_id) nose.tools.assert_equal(e.api_root, expected_api_root) nose.tools.assert_equal(e.get_config(), new_config)
def test_from_config_common_partial(self): expected_file_id = '5hjkl1345hjk' expected_api_root = self.LOCAL_APIROOT expected_api_key = None e = GirderDataElement.from_config({'file_id': expected_file_id}) nose.tools.assert_equal(e.file_id, expected_file_id) nose.tools.assert_equal(e.api_root, expected_api_root) nose.tools.assert_equal(e.token_manager.api_key, expected_api_key) nose.tools.assert_equal( e.get_config(), { 'file_id': expected_file_id, 'api_root': expected_api_root, 'api_key': expected_api_key })
def test_from_config_full_constructor(self, _mock_authenticate): expected_file_id = '34uhki34gh2345ghjk' expected_api_root = 'https://some.other.server/api/v1' expected_api_key = '1234ghk135hlg23435' new_config = { 'token': None, 'file_id': expected_file_id, 'api_root': expected_api_root, 'api_key': expected_api_key, } #: :type: GirderDataElement e = GirderDataElement.from_config(new_config) self.assertEqual(e.file_id, expected_file_id) self.assertEqual(e.api_root, expected_api_root) self.assertEqual(e.get_config(), new_config)