def test_get_shard_with_instance_read_mode(self):
        router = ShardedPerTenantRouter()
        router._write_mode = False
        instance = TShardedModel(partner_id=PID)
        hints = {'instance': instance}
        db_alias = router._get_shard(TShardedModel, **hints)

        self.assertEqual(db_alias, 'test2__{}'.format(instance.partner_id))
    def test_get_shard_read_mode(self):
        partner_id = PID
        router = ShardedPerTenantRouter()
        router._write_mode = False
        hints = {'exact_lookups': {TShardedModel.sharded_field: partner_id}}
        db_alias = router._get_shard(TShardedModel, **hints)

        self.assertEqual(db_alias, 'test2__{}'.format(partner_id))