def test_url(self, mocker):
        from Flashpoint import url_lookup_command

        with open("./TestData/url_response.json", encoding='utf-8') as f:
            expected = json.load(f)

        mocker.return_value = expected
        hr, ec, resp = url_lookup_command(self.client, TEST_SCAN_URL)
        result = self.get_result(resp)

        with open("./TestData/url_ec.json", encoding='utf-8') as f:
            expected_ec = json.load(f)

        fpid = result['fpid']
        assert result['name'] == TEST_SCAN_URL
        assert result['href'] == HREF_BASE_URL + fpid
        assert expected == resp
        assert expected_ec == ec
Esempio n. 2
0
    def test_url(self, mocker):
        """Test url_lookup_command."""
        from Flashpoint import url_lookup_command

        with open("./TestData/url_response.json", encoding='utf-8') as f:
            expected = json.load(f)

        mocker.return_value = expected
        command_result = url_lookup_command(self.client, TEST_SCAN_URL)
        resp = command_result.to_context().get('Contents')
        result = self.get_result(resp)
        # ec = command_result.to_context().get('EntryContext')
        #
        # with open("./TestData/url_ec.json", encoding='utf-8') as f:
        #     expected_ec = json.load(f)

        fpid = result['fpid']
        assert result['name'] == TEST_SCAN_URL
        assert result['href'] == HREF_BASE_URL + fpid
        assert expected == resp