Exemplo n.º 1
0
    def test_table_name_only(self):
        from gcloud.bigtable._generated import (
            bigtable_service_messages_pb2 as messages_pb2)

        table_name = 'table_name'
        result = self._callFUT(table_name)
        expected_result = messages_pb2.ReadRowsRequest(table_name=table_name)
        self.assertEqual(result, expected_result)
Exemplo n.º 2
0
    def test_with_limit(self):
        from gcloud.bigtable._generated import (
            bigtable_service_messages_pb2 as messages_pb2)

        table_name = 'table_name'
        limit = 1337
        result = self._callFUT(table_name, limit=limit)
        expected_result = messages_pb2.ReadRowsRequest(
            table_name=table_name,
            num_rows_limit=limit,
        )
        self.assertEqual(result, expected_result)
Exemplo n.º 3
0
    def test_with_allow_row_interleaving(self):
        from gcloud.bigtable._generated import (
            bigtable_service_messages_pb2 as messages_pb2)

        table_name = 'table_name'
        allow_row_interleaving = True
        result = self._callFUT(table_name,
                               allow_row_interleaving=allow_row_interleaving)
        expected_result = messages_pb2.ReadRowsRequest(
            table_name=table_name,
            allow_row_interleaving=allow_row_interleaving,
        )
        self.assertEqual(result, expected_result)
Exemplo n.º 4
0
    def test_with_filter(self):
        from gcloud.bigtable._generated import (
            bigtable_service_messages_pb2 as messages_pb2)
        from gcloud.bigtable.row import RowSampleFilter

        table_name = 'table_name'
        row_filter = RowSampleFilter(0.33)
        result = self._callFUT(table_name, filter_=row_filter)
        expected_result = messages_pb2.ReadRowsRequest(
            table_name=table_name,
            filter=row_filter.to_pb(),
        )
        self.assertEqual(result, expected_result)
Exemplo n.º 5
0
    def test_row_range_end_key(self):
        from gcloud.bigtable._generated import bigtable_data_pb2 as data_pb2
        from gcloud.bigtable._generated import (
            bigtable_service_messages_pb2 as messages_pb2)

        table_name = 'table_name'
        end_key = b'end_key'
        result = self._callFUT(table_name, end_key=end_key)
        expected_result = messages_pb2.ReadRowsRequest(
            table_name=table_name,
            row_range=data_pb2.RowRange(end_key=end_key),
        )
        self.assertEqual(result, expected_result)