# Path: django_sharding_library/routing_read_strategies.py
# class RoundRobinRoutingStrategy(BaseRoutingStrategy):
#     """
#     A strategy which will cycle through the read replicas and primary, in a
#     round-robin fashion when choosing which database to read from.
#     """
#     def __init__(self, databases):
#         super(RoundRobinRoutingStrategy, self).__init__(databases)
#         self.read_cycles = {}
# 
#         for primary, replicas in viewitems(self.primary_replica_mapping):
#             self.read_cycles[primary] = cycle(replicas + [primary])
# 
#     def pick_read_db(self, primary_db_name):
#         return next(self.read_cycles[primary_db_name])
# 
# class PrimaryOnlyRoutingStrategy(BaseRoutingStrategy):
#     """
#     A strategy which will always read from the primary, unless overridden,
#     regardless of replicas defined.
#     """
#     def pick_read_db(self, primary_db_name):
#         return primary_db_name


from six.moves import xrange
from django.conf import settings
from django.test import TestCase
from django_sharding_library.routing_read_strategies import RoundRobinRoutingStrategy, PrimaryOnlyRoutingStrategy




class RoundRobinBucketingStrategyTestCase(TestCase):
    databases = '__all__'

    def test_is_cyclic(self):

# Path: django_sharding_library/routing_read_strategies.py
# class RoundRobinRoutingStrategy(BaseRoutingStrategy):
#     """
#     A strategy which will cycle through the read replicas and primary, in a
#     round-robin fashion when choosing which database to read from.
#     """
#     def __init__(self, databases):
#         super(RoundRobinRoutingStrategy, self).__init__(databases)
#         self.read_cycles = {}
# 
#         for primary, replicas in viewitems(self.primary_replica_mapping):
#             self.read_cycles[primary] = cycle(replicas + [primary])
# 
#     def pick_read_db(self, primary_db_name):
#         return next(self.read_cycles[primary_db_name])
# 
# class PrimaryOnlyRoutingStrategy(BaseRoutingStrategy):
#     """
#     A strategy which will always read from the primary, unless overridden,
#     regardless of replicas defined.
#     """
#     def pick_read_db(self, primary_db_name):
#         return primary_db_name


# Path: tests/test_routing_read_strategies.py
from six.moves import xrange
from django.conf import settings
from django.test import TestCase
from django_sharding_library.routing_read_strategies import RoundRobinRoutingStrategy, PrimaryOnlyRoutingStrategy





class RoundRobinBucketingStrategyTestCase(TestCase):
    databases = '__all__'

    def test_is_cyclic(self):

        sut = RoundRobinRoutingStrategy(settings.DATABASES)