def test_response_block_properties_table(mocker, mock_response): mocker.patch("sunpy.net.vso.vso.build_client", return_value=True) legacy_response = QueryResponse.create(mock_response) table_response = VSOQueryResponseTable.from_zeep_response(mock_response, client=False) print(legacy_response) print(table_response)
def test_QueryResponse_build_table_with_extent_type(mocker): """ When explicitly suppling an 'Extent' only the 'type' is stored in the built table. """ mocker.patch("sunpy.net.vso.vso.build_client", return_value=True) e_type = MockObject(x=1.0, y=2.5, width=37, length=129.2, type='CORONA') table = VSOQueryResponseTable.from_zeep_response(MockQRResponse( (MockQRRecord(extent=e_type), )), client=None) extent = table['Extent Type'].data assert len(extent) == 1 assert extent[0] == e_type.type
def test_QueryResponse_build_table_with_no_end_time(mocker): """ Only the 'start' time is set, no 'end' time """ mocker.patch("sunpy.net.vso.vso.build_client", return_value=True) a_st = parse_time((2016, 2, 14, 8, 8, 12)) records = (MockQRRecord(start_time=a_st.strftime(va._TIMEFORMAT)), ) table = VSOQueryResponseTable.from_zeep_response(MockQRResponse(records), client=None) start_time_ = table['Start Time'] assert len(start_time_) == 1 assert start_time_[0].value == '2016-02-14 08:08:12.000'
def test_from_zeep_response(mocker): mocker.patch("sunpy.net.vso.vso.build_client", return_value=True) records = (MockQRRecord(), ) table = VSOQueryResponseTable.from_zeep_response(MockQRResponse(records), client=None) # These are the only None values in the table. source_ = table['Source'] assert len(source_) == 1 assert source_[0] == 'SOHO' instrument_ = table['Instrument'] assert len(instrument_) == 1 assert instrument_[0] == 'aia' size_ = table['Size'] assert len(size_) == 1 assert size_[0] == 0.0
def mock_table_response(mock_response): return VSOQueryResponseTable.from_zeep_response(mock_response, client=False)