• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python common.load_fixture函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.common.load_fixture函数的典型用法代码示例。如果您正苦于以下问题:Python load_fixture函数的具体用法?Python load_fixture怎么用?Python load_fixture使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了load_fixture函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: melissa_mock

def melissa_mock():
    """Use this to mock the melissa api."""
    api = Mock()
    api.async_fetch_devices = mock_coro_func(
        return_value=json.loads(load_fixture('melissa_fetch_devices.json')))
    api.async_status = mock_coro_func(return_value=json.loads(load_fixture(
        'melissa_status.json')))
    api.async_cur_settings = mock_coro_func(
        return_value=json.loads(load_fixture('melissa_cur_settings.json')))

    api.async_send = mock_coro_func(return_value=True)

    api.STATE_OFF = 0
    api.STATE_ON = 1
    api.STATE_IDLE = 2

    api.MODE_AUTO = 0
    api.MODE_FAN = 1
    api.MODE_HEAT = 2
    api.MODE_COOL = 3
    api.MODE_DRY = 4

    api.FAN_AUTO = 0
    api.FAN_LOW = 1
    api.FAN_MEDIUM = 2
    api.FAN_HIGH = 3

    api.STATE = 'state'
    api.MODE = 'mode'
    api.FAN = 'fan'
    api.TEMP = 'temp'
    return api
开发者ID:ManHammer,项目名称:home-assistant,代码行数:32,代码来源:test_melissa.py


示例2: test_service_face

    def test_service_face(self, camera_mock, aioclient_mock):
        """Set up component, test person face services."""
        aioclient_mock.get(
            self.endpoint_url.format("persongroups"),
            text=load_fixture('microsoft_face_persongroups.json')
        )
        aioclient_mock.get(
            self.endpoint_url.format("persongroups/test_group1/persons"),
            text=load_fixture('microsoft_face_persons.json')
        )
        aioclient_mock.get(
            self.endpoint_url.format("persongroups/test_group2/persons"),
            text=load_fixture('microsoft_face_persons.json')
        )

        self.config['camera'] = {'platform': 'demo'}
        with assert_setup_component(3, mf.DOMAIN):
            setup_component(self.hass, mf.DOMAIN, self.config)

        assert len(aioclient_mock.mock_calls) == 3

        aioclient_mock.post(
            self.endpoint_url.format(
                "persongroups/test_group2/persons/"
                "2ae4935b-9659-44c3-977f-61fac20d0538/persistedFaces"),
            status=200, text="{}"
        )

        face_person(
            self.hass, 'test_group2', 'David', 'camera.demo_camera')
        self.hass.block_till_done()

        assert len(aioclient_mock.mock_calls) == 4
        assert aioclient_mock.mock_calls[3][2] == b'Test'
开发者ID:ManHammer,项目名称:home-assistant,代码行数:34,代码来源:test_init.py


示例3: test_setup_component_test_entities

    def test_setup_component_test_entities(self, aioclient_mock):
        """Set up component."""
        aioclient_mock.get(
            self.endpoint_url.format("persongroups"),
            text=load_fixture('microsoft_face_persongroups.json')
        )
        aioclient_mock.get(
            self.endpoint_url.format("persongroups/test_group1/persons"),
            text=load_fixture('microsoft_face_persons.json')
        )
        aioclient_mock.get(
            self.endpoint_url.format("persongroups/test_group2/persons"),
            text=load_fixture('microsoft_face_persons.json')
        )

        with assert_setup_component(3, mf.DOMAIN):
            setup_component(self.hass, mf.DOMAIN, self.config)

        assert len(aioclient_mock.mock_calls) == 3

        entity_group1 = self.hass.states.get('microsoft_face.test_group1')
        entity_group2 = self.hass.states.get('microsoft_face.test_group2')

        assert entity_group1 is not None
        assert entity_group2 is not None

        assert entity_group1.attributes['Ryan'] == \
            '25985303-c537-4467-b41d-bdb45cd95ca1'
        assert entity_group1.attributes['David'] == \
            '2ae4935b-9659-44c3-977f-61fac20d0538'

        assert entity_group2.attributes['Ryan'] == \
            '25985303-c537-4467-b41d-bdb45cd95ca1'
        assert entity_group2.attributes['David'] == \
            '2ae4935b-9659-44c3-977f-61fac20d0538'
开发者ID:ManHammer,项目名称:home-assistant,代码行数:35,代码来源:test_init.py


示例4: test_scan_devices

    def test_scan_devices(self):
        """Test creating device info (MAC, name) from response.

        The created known_devices.yaml device info is compared
        to the DD-WRT Lan Status request response fixture.
        This effectively checks the data parsing functions.
        """
        with requests_mock.Mocker() as mock_request:
            mock_request.register_uri(
                'GET', r'http://%s/Status_Wireless.live.asp' % TEST_HOST,
                text=load_fixture('Ddwrt_Status_Wireless.txt'))
            mock_request.register_uri(
                'GET', r'http://%s/Status_Lan.live.asp' % TEST_HOST,
                text=load_fixture('Ddwrt_Status_Lan.txt'))

            with assert_setup_component(1):
                assert setup_component(
                    self.hass, DOMAIN, {DOMAIN: {
                        CONF_PLATFORM: 'ddwrt',
                        CONF_HOST: TEST_HOST,
                        CONF_USERNAME: 'fake_user',
                        CONF_PASSWORD: '0'
                    }})
                self.hass.block_till_done()

            path = self.hass.config.path(device_tracker.YAML_DEVICES)
            devices = config.load_yaml_config_file(path)
            for device in devices:
                self.assertIn(
                    devices[device]['mac'],
                    load_fixture('Ddwrt_Status_Lan.txt'))
                self.assertIn(
                    slugify(devices[device]['name']),
                    load_fixture('Ddwrt_Status_Lan.txt'))
开发者ID:DavidLP,项目名称:home-assistant,代码行数:34,代码来源:test_ddwrt.py


示例5: test_device_name_no_dhcp

    def test_device_name_no_dhcp(self):
        """Test creating device info (MAC) when missing dhcp response."""
        with requests_mock.Mocker() as mock_request:
            mock_request.register_uri(
                'GET', r'http://%s/Status_Wireless.live.asp' % TEST_HOST,
                text=load_fixture('Ddwrt_Status_Wireless.txt'))
            mock_request.register_uri(
                'GET', r'http://%s/Status_Lan.live.asp' % TEST_HOST,
                text=load_fixture('Ddwrt_Status_Lan.txt').
                replace('dhcp_leases', 'missing'))

            with assert_setup_component(1):
                assert setup_component(
                    self.hass, DOMAIN, {DOMAIN: {
                        CONF_PLATFORM: 'ddwrt',
                        CONF_HOST: TEST_HOST,
                        CONF_USERNAME: 'fake_user',
                        CONF_PASSWORD: '0'
                    }})
                self.hass.block_till_done()

            path = self.hass.config.path(device_tracker.YAML_DEVICES)
            devices = config.load_yaml_config_file(path)
            for device in devices:
                _LOGGER.error(devices[device])
                self.assertIn(
                    devices[device]['mac'],
                    load_fixture('Ddwrt_Status_Lan.txt'))
开发者ID:DavidLP,项目名称:home-assistant,代码行数:28,代码来源:test_ddwrt.py


示例6: test_invalid_sensors

    def test_invalid_sensors(self, mock):
        """Test the VultrBinarySensor fails."""
        mock.get(
            'https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567',
            text=load_fixture('vultr_account_info.json'))

        with patch(
            'vultr.Vultr.server_list',
            return_value=json.loads(
                load_fixture('vultr_server_list.json'))):
            # Setup hub
            base_vultr.setup(self.hass, VALID_CONFIG)

        bad_conf = {}  # No subscription

        no_subs_setup = vultr.setup_platform(self.hass,
                                             bad_conf,
                                             self.add_entities,
                                             None)

        self.assertFalse(no_subs_setup)

        bad_conf = {
            CONF_NAME: "Missing Server",
            CONF_SUBSCRIPTION: '555555'
        }  # Sub not associated with API key (not in server_list)

        wrong_subs_setup = vultr.setup_platform(self.hass,
                                                bad_conf,
                                                self.add_entities,
                                                None)

        self.assertFalse(wrong_subs_setup)
开发者ID:EarthlingRich,项目名称:home-assistant,代码行数:33,代码来源:test_vultr.py


示例7: test_invalid_switches

    def test_invalid_switches(self, mock):
        """Test the VultrSwitch fails."""
        mock.get(
            'https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567',
            text=load_fixture('vultr_account_info.json'))

        mock.get(
            'https://api.vultr.com/v1/server/list?api_key=ABCDEFG1234567',
            text=load_fixture('vultr_server_list.json'))

        base_vultr.setup(self.hass, VALID_CONFIG)

        bad_conf = {}  # No subscription

        no_subs_setup = vultr.setup_platform(self.hass,
                                             bad_conf,
                                             self.add_devices,
                                             None)

        self.assertIsNotNone(no_subs_setup)

        bad_conf = {
            CONF_NAME: "Missing Server",
            CONF_SUBSCRIPTION: '665544'
        }  # Sub not associated with API key (not in server_list)

        wrong_subs_setup = vultr.setup_platform(self.hass,
                                                bad_conf,
                                                self.add_devices,
                                                None)

        self.assertIsNotNone(wrong_subs_setup)
开发者ID:JiShangShiDai,项目名称:home-assistant,代码行数:32,代码来源:test_vultr.py


示例8: test_binary_sensor

    def test_binary_sensor(self, mock):
        """Test the Ring sensor class and methods."""
        mock.post('https://oauth.ring.com/oauth/token',
                  text=load_fixture('ring_oauth.json'))
        mock.post('https://api.ring.com/clients_api/session',
                  text=load_fixture('ring_session.json'))
        mock.get('https://api.ring.com/clients_api/ring_devices',
                 text=load_fixture('ring_devices.json'))
        mock.get('https://api.ring.com/clients_api/dings/active',
                 text=load_fixture('ring_ding_active.json'))
        mock.get('https://api.ring.com/clients_api/doorbots/987652/health',
                 text=load_fixture('ring_doorboot_health_attrs.json'))

        base_ring.setup(self.hass, VALID_CONFIG)
        ring.setup_platform(self.hass,
                            self.config,
                            self.add_devices,
                            None)

        for device in self.DEVICES:
            device.update()
            if device.name == 'Front Door Ding':
                self.assertEqual('on', device.state)
                self.assertEqual('America/New_York',
                                 device.device_state_attributes['timezone'])
            elif device.name == 'Front Door Motion':
                self.assertEqual('off', device.state)
                self.assertEqual('motion', device.device_class)

            self.assertIsNone(device.entity_picture)
            self.assertEqual(ATTRIBUTION,
                             device.device_state_attributes['attribution'])
开发者ID:DavidMStraub,项目名称:home-assistant,代码行数:32,代码来源:test_ring.py


示例9: test_setup

 def test_setup(self, mock):
     """Test the setup."""
     mock.post('https://oauth.ring.com/oauth/token',
               text=load_fixture('ring_oauth.json'))
     mock.post('https://api.ring.com/clients_api/session',
               text=load_fixture('ring_session.json'))
     response = ring.setup(self.hass, self.config)
     self.assertTrue(response)
开发者ID:DavidMStraub,项目名称:home-assistant,代码行数:8,代码来源:test_ring.py


示例10: test_sensor

    def test_sensor(self, mock):
        """Test the Ring senskor class and methods."""
        mock.post('https://api.ring.com/clients_api/session',
                  text=load_fixture('ring_session.json'))
        mock.get('https://api.ring.com/clients_api/ring_devices',
                 text=load_fixture('ring_devices.json'))
        mock.get('https://api.ring.com/clients_api/doorbots/987652/history',
                 text=load_fixture('ring_doorbots.json'))
        mock.get('https://api.ring.com/clients_api/doorbots/987652/health',
                 text=load_fixture('ring_doorboot_health_attrs.json'))
        mock.get('https://api.ring.com/clients_api/chimes/999999/health',
                 text=load_fixture('ring_chime_health_attrs.json'))
        base_ring.setup(self.hass, VALID_CONFIG)
        ring.setup_platform(self.hass,
                            self.config,
                            self.add_devices,
                            None)

        for device in self.DEVICES:
            device.update()
            if device.name == 'Front Battery':
                self.assertEqual(80, device.state)
                self.assertEqual('hp_cam_v1',
                                 device.device_state_attributes['kind'])
                self.assertEqual('stickup_cams',
                                 device.device_state_attributes['type'])
            if device.name == 'Front Door Battery':
                self.assertEqual(100, device.state)
                self.assertEqual('lpd_v1',
                                 device.device_state_attributes['kind'])
                self.assertNotEqual('chimes',
                                    device.device_state_attributes['type'])
            if device.name == 'Downstairs Volume':
                self.assertEqual(2, device.state)
                self.assertEqual('1.2.3',
                                 device.device_state_attributes['firmware'])
                self.assertEqual('ring_mock_wifi',
                                 device.device_state_attributes['wifi_name'])
                self.assertEqual('mdi:bell-ring', device.icon)
                self.assertEqual('chimes',
                                 device.device_state_attributes['type'])
            if device.name == 'Front Door Last Activity':
                self.assertFalse(device.device_state_attributes['answered'])
                self.assertEqual('America/New_York',
                                 device.device_state_attributes['timezone'])

            if device.name == 'Downstairs WiFi Signal Strength':
                self.assertEqual(-39, device.state)

            if device.name == 'Front Door WiFi Signal Category':
                self.assertEqual('good', device.state)

            if device.name == 'Front Door WiFi Signal Strength':
                self.assertEqual(-58, device.state)

            self.assertIsNone(device.entity_picture)
            self.assertEqual(ATTRIBUTION,
                             device.device_state_attributes['attribution'])
开发者ID:JiShangShiDai,项目名称:home-assistant,代码行数:58,代码来源:test_ring.py


示例11: test_ms_identify_process_image

    def test_ms_identify_process_image(self, poll_mock, aioclient_mock):
        """Setup and scan a picture and test plates from event."""
        aioclient_mock.get(
            mf.FACE_API_URL.format("persongroups"),
            text=load_fixture('microsoft_face_persongroups.json')
        )
        aioclient_mock.get(
            mf.FACE_API_URL.format("persongroups/test_group1/persons"),
            text=load_fixture('microsoft_face_persons.json')
        )
        aioclient_mock.get(
            mf.FACE_API_URL.format("persongroups/test_group2/persons"),
            text=load_fixture('microsoft_face_persons.json')
        )

        setup_component(self.hass, ip.DOMAIN, self.config)

        state = self.hass.states.get('camera.demo_camera')
        url = "{0}{1}".format(
            self.hass.config.api.base_url,
            state.attributes.get(ATTR_ENTITY_PICTURE))

        face_events = []

        @callback
        def mock_face_event(event):
            """Mock event."""
            face_events.append(event)

        self.hass.bus.listen('image_processing.detect_face', mock_face_event)

        aioclient_mock.get(url, content=b'image')

        aioclient_mock.post(
            mf.FACE_API_URL.format("detect"),
            text=load_fixture('microsoft_face_detect.json')
        )
        aioclient_mock.post(
            mf.FACE_API_URL.format("identify"),
            text=load_fixture('microsoft_face_identify.json')
        )

        ip.scan(self.hass, entity_id='image_processing.test_local')
        self.hass.block_till_done()

        state = self.hass.states.get('image_processing.test_local')

        assert len(face_events) == 1
        assert state.attributes.get('total_faces') == 2
        assert state.state == 'David'

        assert face_events[0].data['name'] == 'David'
        assert face_events[0].data['confidence'] == float(92)
        assert face_events[0].data['entity_id'] == \
            'image_processing.test_local'
开发者ID:azogue,项目名称:home-assistant,代码行数:55,代码来源:test_microsoft_face_identify.py


示例12: test_setup

    def test_setup(self, mock):
        """Test successful setup."""
        mock.get(
            'https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567',
            text=load_fixture('vultr_account_info.json'))
        mock.get(
            'https://api.vultr.com/v1/server/list?api_key=ABCDEFG1234567',
            text=load_fixture('vultr_server_list.json'))

        response = vultr.setup(self.hass, self.config)
        self.assertTrue(response)
开发者ID:JiShangShiDai,项目名称:home-assistant,代码行数:11,代码来源:test_vultr.py


示例13: mock_responses

def mock_responses(mock):
    base_url = 'https://api.sleepiq.sleepnumber.com/rest/'
    mock.put(
        base_url + 'login',
        text=load_fixture('sleepiq-login.json'))
    mock.get(
        base_url + 'bed?_k=0987',
        text=load_fixture('sleepiq-bed.json'))
    mock.get(
        base_url + 'sleeper?_k=0987',
        text=load_fixture('sleepiq-sleeper.json'))
    mock.get(
        base_url + 'bed/familyStatus?_k=0987',
        text=load_fixture('sleepiq-familystatus.json'))
开发者ID:GadgetReactor,项目名称:home-assistant,代码行数:14,代码来源:test_sleepiq.py


示例14: test_service_person

    def test_service_person(self, aioclient_mock):
        """Set up component, test person services."""
        aioclient_mock.get(
            self.endpoint_url.format("persongroups"),
            text=load_fixture('microsoft_face_persongroups.json')
        )
        aioclient_mock.get(
            self.endpoint_url.format("persongroups/test_group1/persons"),
            text=load_fixture('microsoft_face_persons.json')
        )
        aioclient_mock.get(
            self.endpoint_url.format("persongroups/test_group2/persons"),
            text=load_fixture('microsoft_face_persons.json')
        )

        with assert_setup_component(3, mf.DOMAIN):
            setup_component(self.hass, mf.DOMAIN, self.config)

        assert len(aioclient_mock.mock_calls) == 3

        aioclient_mock.post(
            self.endpoint_url.format("persongroups/test_group1/persons"),
            text=load_fixture('microsoft_face_create_person.json')
        )
        aioclient_mock.delete(
            self.endpoint_url.format(
                "persongroups/test_group1/persons/"
                "25985303-c537-4467-b41d-bdb45cd95ca1"),
            status=200, text="{}"
        )

        create_person(self.hass, 'test group1', 'Hans')
        self.hass.block_till_done()

        entity_group1 = self.hass.states.get('microsoft_face.test_group1')

        assert len(aioclient_mock.mock_calls) == 4
        assert entity_group1 is not None
        assert entity_group1.attributes['Hans'] == \
            '25985303-c537-4467-b41d-bdb45cd95ca1'

        delete_person(self.hass, 'test group1', 'Hans')
        self.hass.block_till_done()

        entity_group1 = self.hass.states.get('microsoft_face.test_group1')

        assert len(aioclient_mock.mock_calls) == 5
        assert entity_group1 is not None
        assert 'Hans' not in entity_group1.attributes
开发者ID:ManHammer,项目名称:home-assistant,代码行数:49,代码来源:test_init.py


示例15: test_openalpr_process_image

    def test_openalpr_process_image(self, aioclient_mock):
        """Setup and scan a picture and test plates from event."""
        aioclient_mock.get(self.url, content=b'image')
        aioclient_mock.post(
            OPENALPR_API_URL, params=self.params,
            text=load_fixture('alpr_cloud.json'), status=200
        )

        ip.scan(self.hass, entity_id='image_processing.test_local')
        self.hass.block_till_done()

        state = self.hass.states.get('image_processing.test_local')

        assert len(aioclient_mock.mock_calls) == 2
        assert len(self.alpr_events) == 5
        assert state.attributes.get('vehicles') == 1
        assert state.state == 'H786P0J'

        event_data = [event.data for event in self.alpr_events if
                      event.data.get('plate') == 'H786P0J']
        assert len(event_data) == 1
        assert event_data[0]['plate'] == 'H786P0J'
        assert event_data[0]['confidence'] == float(90.436699)
        assert event_data[0]['entity_id'] == \
            'image_processing.test_local'
开发者ID:Teagan42,项目名称:home-assistant,代码行数:25,代码来源:test_openalpr_cloud.py


示例16: test_setup_and_initial_state

    def test_setup_and_initial_state(self, mock_req):
        """Test that the component is created and initialized as expected."""
        uri = re.compile(
            r"http://services\.swpc\.noaa\.gov/text/aurora-nowcast-map\.txt"
        )
        mock_req.get(uri, text=load_fixture('aurora.txt'))

        entities = []

        def mock_add_entities(new_entities, update_before_add=False):
            """Mock add entities."""
            if update_before_add:
                for entity in new_entities:
                    entity.update()

            for entity in new_entities:
                entities.append(entity)

        config = {
            "name": "Test",
            "forecast_threshold": 75
        }
        aurora.setup_platform(self.hass, config, mock_add_entities)

        aurora_component = entities[0]
        assert len(entities) == 1
        assert aurora_component.name == "Test"
        assert \
            aurora_component.device_state_attributes["visibility_level"] == '0'
        assert aurora_component.device_state_attributes["message"] == \
            "nothing's out"
        assert not aurora_component.is_on
开发者ID:fbradyirl,项目名称:home-assistant,代码行数:32,代码来源:test_binary_sensor.py


示例17: test_openalpr_process_image

    def test_openalpr_process_image(self, aioclient_mock):
        """Set up and scan a picture and test plates from event."""
        aioclient_mock.post(
            OPENALPR_API_URL, params=self.params,
            text=load_fixture('alpr_cloud.json'), status=200
        )

        with patch('homeassistant.components.camera.async_get_image',
                   return_value=mock_coro(
                       camera.Image('image/jpeg', b'image'))):
            ip.scan(self.hass, entity_id='image_processing.test_local')
            self.hass.block_till_done()

        state = self.hass.states.get('image_processing.test_local')

        assert len(aioclient_mock.mock_calls) == 1
        assert len(self.alpr_events) == 5
        assert state.attributes.get('vehicles') == 1
        assert state.state == 'H786P0J'

        event_data = [event.data for event in self.alpr_events if
                      event.data.get('plate') == 'H786P0J']
        assert len(event_data) == 1
        assert event_data[0]['plate'] == 'H786P0J'
        assert event_data[0]['confidence'] == float(90.436699)
        assert event_data[0]['entity_id'] == \
            'image_processing.test_local'
开发者ID:EarthlingRich,项目名称:home-assistant,代码行数:27,代码来源:test_openalpr_cloud.py


示例18: test_custom_threshold_works

    def test_custom_threshold_works(self, mock_req):
        """Test that the config can take a custom forecast threshold."""
        uri = re.compile(
            r"http://services\.swpc\.noaa\.gov/text/aurora-nowcast-map\.txt"
        )
        mock_req.get(uri, text=load_fixture('aurora.txt'))

        entities = []

        def mock_add_entities(new_entities, update_before_add=False):
            """Mock add entities."""
            if update_before_add:
                for entity in new_entities:
                    entity.update()

            for entity in new_entities:
                entities.append(entity)

        config = {
            "name": "Test",
            "forecast_threshold": 1
        }
        self.hass.config.longitude = 5
        self.hass.config.latitude = 5

        aurora.setup_platform(self.hass, config, mock_add_entities)

        aurora_component = entities[0]
        assert aurora_component.aurora_data.visibility_level == '5'
        assert aurora_component.is_on
开发者ID:fbradyirl,项目名称:home-assistant,代码行数:30,代码来源:test_binary_sensor.py


示例19: test_scan_devices

async def test_scan_devices(hass, aioclient_mock):
    """Set up a upc platform and scan device."""
    aioclient_mock.get(
        "http://{}/common_page/login.html".format(HOST),
        cookies={'sessionToken': '654321'}
    )
    aioclient_mock.post(
        "http://{}/xml/getter.xml".format(HOST),
        content=b'successful',
        cookies={'sessionToken': '654321'}
    )

    scanner = await platform.async_get_scanner(
        hass, {
            DOMAIN: {CONF_PLATFORM: 'upc_connect', CONF_HOST: HOST}})

    assert len(aioclient_mock.mock_calls) == 1

    aioclient_mock.clear_requests()
    aioclient_mock.post(
        "http://{}/xml/getter.xml".format(HOST),
        text=load_fixture('upc_connect.xml'),
        cookies={'sessionToken': '1235678'}
    )

    mac_list = await scanner.async_scan_devices()

    assert len(aioclient_mock.mock_calls) == 1
    assert aioclient_mock.mock_calls[0][2] == 'token=654321&fun=123'
    assert mac_list == ['30:D3:2D:0:69:21', '5C:AA:FD:25:32:02',
                        '70:EE:50:27:A1:38']
开发者ID:boced66,项目名称:home-assistant,代码行数:31,代码来源:test_upc_connect.py


示例20: test_setup_component_no_pwd

 def test_setup_component_no_pwd(self, mock):
     """Test the setup when no password is configured."""
     mock.post('https://api.ring.com/clients_api/session',
               text=load_fixture('ring_session.json'))
     conf = self.config.copy()
     del conf['ring']['password']
     assert not setup.setup_component(self.hass, ring.DOMAIN, conf)
开发者ID:BaptisteSim,项目名称:home-assistant,代码行数:7,代码来源:test_ring.py



注:本文中的tests.common.load_fixture函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python common.mock_component函数代码示例发布时间:2022-05-27
下一篇:
Python common.load_check函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap