# Path: tests/fixtures.py
# BING_MAPS_KEY = 'Av6_H8GIYQyP-DLQwLOKDknW64Qfm' \
#                 'VgJmVpfiSO861v0x_j1pLPCOW6s-70nCzEW'
# def create_tmp_dir(tmpdir):
# 
# Path: bingmaps/apiservices/locations.py
# class LocationByQuery(LocationApi):
#     """Location by query API class
# 
#     This class is used to retrieve the output from the given data from the
#     user.
#       - First, the data is used to build a URL which is related to the
#         Location by Query API.
#       - Second, this class helps in retrieving the response from the URL built
#       - Third, based on the response, this class helps in retrieving all the
#         corresponding output data from the response. Some of the output data
#         which this class would be retrieving is:
#           - Coordinates (latitude/longitude)
#           - BoundingBox coordinates (south latitude, west longitude,
#             north latitude, east longitude)
#           - Address
# 
#     The output from the URL can be either JSON/XML based on the output
#     parameter mentioned in the data. Even the output response is 'xml', this
#     class helps in converting the xml response to JSON data first and then
#     retrieve all the necessary output from it.
# 
#     :ivar data: The data that the user will send in to the Location by query
#         to retrieve all the respective output from the response
#     :ivar url: The url that gets built based on the user's given data
#     :ivar http_protocol: Http protocol for the URL. Can be either of the
#         following:
#           - http
#           - https
#     :ivar schema: The schema that gets used to build the URL and the schema
#         is LocationByQueryUrl for location by query API service.
#     :ivar file_name: The filename that the class can write the JSON response
#         to.
#           - file_name - 'locationByQuery'
#     :ivar locationApiData: Response from the URL
# 
#     Some of the examples are illustrated in Examples page
#     """
#     def __init__(self, data, http_protocol='http'):
#         if not bool(data):
#             raise TypeError('No data given')
#         schema = LocationByQueryUrl(data, httpprotocol=http_protocol)
#         filename = 'locationByQuery'
#         super().__init__(schema, filename, http_protocol)
#         self.get_data()
# 
#     def get_data(self):
#         """Gets data from the built url"""
#         url = self.build_url()
#         self.locationApiData = requests.get(url)
#         if not self.locationApiData.status_code == 200:
#             raise self.locationApiData.raise_for_status()
# 
#     def build_url(self):
#         """Build the url and replaces /None/ with empty string"""
#         url = super().build_url()
#         if '/None/' in url:
#             return url.replace('/None/', '')
#         else:
#             return url


from .fixtures import (
    parametrize,
    https_protocol,
    create_tmp_dir,
    BING_MAPS_KEY
)
from bingmaps.apiservices import LocationByQuery
import json
import os
    },
    {
        'q': '9106 Lakeview Drive Madison Heights, MI 48071',
        'key': BING_MAPS_KEY
    },
    {
        'q': '4566 Clay Street Bolingbrook, IL 60440',
        'key': BING_MAPS_KEY
    },
    {
        'q': '4856 Lawrence Street Burke, VA 22015',
        'key': BING_MAPS_KEY
    },
]


@parametrize('data,expected', [
    (DATA[0], 200),
    (DATA[1], 200),
    (DATA[2], 200),
    (DATA[3], 200),
    (DATA[4], 200),
    (DATA[5], 200),
    (DATA[6], 200)
])
def test_location_by_query_url_get_data(data, expected):
    loc_by_query = LocationByQuery(data)
    assert loc_by_query.status_code == expected



# Path: tests/fixtures.py
# BING_MAPS_KEY = 'Av6_H8GIYQyP-DLQwLOKDknW64Qfm' \
#                 'VgJmVpfiSO861v0x_j1pLPCOW6s-70nCzEW'
# def create_tmp_dir(tmpdir):
# 
# Path: bingmaps/apiservices/locations.py
# class LocationByQuery(LocationApi):
#     """Location by query API class
# 
#     This class is used to retrieve the output from the given data from the
#     user.
#       - First, the data is used to build a URL which is related to the
#         Location by Query API.
#       - Second, this class helps in retrieving the response from the URL built
#       - Third, based on the response, this class helps in retrieving all the
#         corresponding output data from the response. Some of the output data
#         which this class would be retrieving is:
#           - Coordinates (latitude/longitude)
#           - BoundingBox coordinates (south latitude, west longitude,
#             north latitude, east longitude)
#           - Address
# 
#     The output from the URL can be either JSON/XML based on the output
#     parameter mentioned in the data. Even the output response is 'xml', this
#     class helps in converting the xml response to JSON data first and then
#     retrieve all the necessary output from it.
# 
#     :ivar data: The data that the user will send in to the Location by query
#         to retrieve all the respective output from the response
#     :ivar url: The url that gets built based on the user's given data
#     :ivar http_protocol: Http protocol for the URL. Can be either of the
#         following:
#           - http
#           - https
#     :ivar schema: The schema that gets used to build the URL and the schema
#         is LocationByQueryUrl for location by query API service.
#     :ivar file_name: The filename that the class can write the JSON response
#         to.
#           - file_name - 'locationByQuery'
#     :ivar locationApiData: Response from the URL
# 
#     Some of the examples are illustrated in Examples page
#     """
#     def __init__(self, data, http_protocol='http'):
#         if not bool(data):
#             raise TypeError('No data given')
#         schema = LocationByQueryUrl(data, httpprotocol=http_protocol)
#         filename = 'locationByQuery'
#         super().__init__(schema, filename, http_protocol)
#         self.get_data()
# 
#     def get_data(self):
#         """Gets data from the built url"""
#         url = self.build_url()
#         self.locationApiData = requests.get(url)
#         if not self.locationApiData.status_code == 200:
#             raise self.locationApiData.raise_for_status()
# 
#     def build_url(self):
#         """Build the url and replaces /None/ with empty string"""
#         url = super().build_url()
#         if '/None/' in url:
#             return url.replace('/None/', '')
#         else:
#             return url


# Path: tests/test_location_by_query_get_data.py
from .fixtures import (
    parametrize,
    https_protocol,
    create_tmp_dir,
    BING_MAPS_KEY
)
from bingmaps.apiservices import LocationByQuery
import json
import os

    },
    {
        'q': '9106 Lakeview Drive Madison Heights, MI 48071',
        'key': BING_MAPS_KEY
    },
    {
        'q': '4566 Clay Street Bolingbrook, IL 60440',
        'key': BING_MAPS_KEY
    },
    {
        'q': '4856 Lawrence Street Burke, VA 22015',
        'key': BING_MAPS_KEY
    },
]


@parametrize('data,expected', [
    (DATA[0], 200),
    (DATA[1], 200),
    (DATA[2], 200),
    (DATA[3], 200),
    (DATA[4], 200),
    (DATA[5], 200),
    (DATA[6], 200)
])
def test_location_by_query_url_get_data(data, expected):
    loc_by_query = LocationByQuery(data)
    assert loc_by_query.status_code == expected



@parametrize('data', [