'Tests to ensure the proper connection priority is honored.
Explicit connection should have higest priority,
Followed by context query connection
Default connection should be honored last.
@since 3.7
@jira_ticket PYTHON-613
@expected_result priorities should be honored
@test_category object_mapper'

def test_context_connection_priority(self):

    TestModel.__connection__ = 'cluster'
    with ContextQuery(TestModel) as tm:
        tm.objects.create(partition=1, cluster=1)
    with ContextQuery(TestModel, connection='fake_cluster') as tm:
        with self.assertRaises(NoHostAvailable):
            tm.objects.create(partition=1, cluster=1)
    with ContextQuery(TestModel, connection='fake_cluster') as tm:
        tm.objects.using(connection='cluster').create(partition=1, cluster=1)
    TestModel.__connection__ = None
    with ContextQuery(TestModel) as tm:
        with self.assertRaises(NoHostAvailable):
            tm.objects.create(partition=1, cluster=1)
