# Path: dopplr/solr/query/join.py
# class JoinQuery(JoinBaseQuery):
#     """
#     A join query.
#     """
# 
#     def __init__(self, query, from_field, to_field):
#         super(JoinQuery, self).__init__(query, from_field, to_field)
# 
#     def get_params(self):
#         """
#         Return the list of query params for the `JoinQuery`.
#         """
#         params = super(JoinQuery, self).get_params()
#         params.append(('q', self._query))
# 
#         return params
# 
# Path: dopplr/solr/query/join.py
# class JoinFilterQuery(JoinBaseQuery):
#     """
#     A join filter query.
#     """
# 
#     def __init__(self, query, from_field, to_field):
#         super(JoinFilterQuery, self).__init__(query, from_field, to_field)
# 
#     def get_params(self):
#         """
#         Return the list of query params for the `JoinFilterQuery`.
#         """
#         params = super(JoinFilterQuery, self).get_params()
#         params.append(('fq', self._query))
# 
#         return params


from pyvows import Vows, expect
from dopplr.solr.query import JoinQuery
from dopplr.solr.query import JoinFilterQuery
#



@Vows.batch
class WhenDoingJoins(Vows.Context):

    class WithinTheQuery(Vows.Context):

        def topic(self):
            from_field = "from_field"
            to_field = "to_field"
            query = "*:*"
            return JoinQuery(query, from_field, to_field).get_params()

        def mustIncludeJoinParameter(self, topic):
            expect(topic).to_include(('q', '{!join}*:*'))

        def mustIncludeFromParameter(self, topic):
            expect(topic).to_include(('from', 'from_field'))

        def mustIncludeToParameter(self, topic):
            expect(topic).to_include(('to', 'to_field'))

    class WithinTheFilterQuery(Vows.Context):

        def topic(self):
            from_field = "from_field"
            to_field = "to_fied"
            query = "*:*"

# Path: dopplr/solr/query/join.py
# class JoinQuery(JoinBaseQuery):
#     """
#     A join query.
#     """
# 
#     def __init__(self, query, from_field, to_field):
#         super(JoinQuery, self).__init__(query, from_field, to_field)
# 
#     def get_params(self):
#         """
#         Return the list of query params for the `JoinQuery`.
#         """
#         params = super(JoinQuery, self).get_params()
#         params.append(('q', self._query))
# 
#         return params
# 
# Path: dopplr/solr/query/join.py
# class JoinFilterQuery(JoinBaseQuery):
#     """
#     A join filter query.
#     """
# 
#     def __init__(self, query, from_field, to_field):
#         super(JoinFilterQuery, self).__init__(query, from_field, to_field)
# 
#     def get_params(self):
#         """
#         Return the list of query params for the `JoinFilterQuery`.
#         """
#         params = super(JoinFilterQuery, self).get_params()
#         params.append(('fq', self._query))
# 
#         return params


# Path: vows/solr/join_vows.py
from pyvows import Vows, expect
from dopplr.solr.query import JoinQuery
from dopplr.solr.query import JoinFilterQuery

#



@Vows.batch
class WhenDoingJoins(Vows.Context):

    class WithinTheQuery(Vows.Context):

        def topic(self):
            from_field = "from_field"
            to_field = "to_field"
            query = "*:*"
            return JoinQuery(query, from_field, to_field).get_params()

        def mustIncludeJoinParameter(self, topic):
            expect(topic).to_include(('q', '{!join}*:*'))

        def mustIncludeFromParameter(self, topic):
            expect(topic).to_include(('from', 'from_field'))

        def mustIncludeToParameter(self, topic):
            expect(topic).to_include(('to', 'to_field'))

    class WithinTheFilterQuery(Vows.Context):

        def topic(self):
            from_field = "from_field"
            to_field = "to_fied"
            query = "*:*"

            return JoinFilterQuery(query, from_field, to_field).get_params()