'Test basic connection functionality
@since 3.7
@jira_ticket PYTHON-613
@expected_result proper connection should be used
@test_category object_mapper'

def test_connection(self):

    self._reset_data()
    with self.assertRaises(NoHostAvailable):
        TestModel.objects.create(partition=1, cluster=1)
    TestModel.objects.using(connection='cluster').create(partition=1, cluster=1)
    TestModel.objects(partition=1, cluster=1).using(connection='cluster').update(count=2)
    obj1 = TestModel.objects.using(connection='cluster').get(partition=1, cluster=1)
    self.assertEqual(obj1.count, 2)
    obj1.using(connection='cluster').update(count=5)
    obj1 = TestModel.objects.using(connection='cluster').get(partition=1, cluster=1)
    self.assertEqual(obj1.count, 5)
    obj1.using(connection='cluster').delete()
    with self.assertRaises(TestModel.DoesNotExist):
        TestModel.objects.using(connection='cluster').get(partition=1, cluster=1)
