def test_subscriptions_wrong_credentials(self, mocked_geographies, mocked_datasets): # Given wrong_credentials = 1234 catalog = Catalog() # When with pytest.raises(ValueError) as e: catalog.subscriptions(wrong_credentials) # Then assert str( e.value) == ('Credentials attribute is required. ' 'Please pass a `Credentials` instance ' 'or use the `set_default_credentials` function.')
def test_subscriptions(self, mocked_geographies, mocked_datasets): # Given expected_datasets = [test_dataset1, test_dataset2] expected_geographies = [test_geography1, test_geography2] mocked_datasets.return_value = expected_datasets mocked_geographies.return_value = expected_geographies credentials = Credentials('user', '1234') catalog = Catalog() # When subscriptions = catalog.subscriptions(credentials) # Then mocked_datasets.assert_called_once_with({}, credentials) mocked_geographies.assert_called_once_with({}, credentials) assert isinstance(subscriptions, Subscriptions) assert subscriptions.datasets == expected_datasets assert subscriptions.geographies == expected_geographies