Пример #1
0
  def test_bigquery_table_matcher_success(self, mock_bigquery):
    mock_query_result = mock.Mock(partitioning='a lot of partitioning',
                                  clustering={'column': 'FRIENDS'})

    mock_bigquery.return_value.get_table.return_value = mock_query_result

    matcher = bq_verifier.BigQueryTableMatcher(
        'mock_project',
        'mock_dataset',
        'mock_table',
        {'partitioning': 'a lot of partitioning',
         'clustering': {'column': 'FRIENDS'}})
    hc_assert_that(self._mock_result, matcher)
Пример #2
0
  def test_bigquery_table_matcher_query_error_retry(self, mock_bigquery):
    mock_query = mock_bigquery.return_value.get_table
    mock_query.side_effect = ValueError('table not found')

    matcher = bq_verifier.BigQueryTableMatcher(
        'mock_project',
        'mock_dataset',
        'mock_table',
        {'partitioning': 'a lot of partitioning',
         'clustering': {'column': 'FRIENDS'}})

    with self.assertRaises(ValueError):
      hc_assert_that(self._mock_result, matcher)
    self.assertEqual(bq_verifier.MAX_RETRIES + 1, mock_query.call_count)