Beispiel #1
0
    def test_calls_from_service_account_info(self, from_service_account_info):
        # When
        get_credentials()

        # Then
        assert from_service_account_info.call_args[0][0] == TEST_ACCOUNT_INFO
        expected_scopes = ["https://spreadsheets.google.com/feeds", "https://www.googleapis.com/auth/drive"]
        assert from_service_account_info.call_args[1] == {"scopes": expected_scopes}
    def test_calls_from_service_account_info(
        self,
        from_service_account_info,
    ):
        # When
        get_credentials()

        # Then
        expected_account_info = {
            "type": "service_account",
            "project_id": "pass-culture",
            "client_email": "*****@*****.**",
            "client_id": "1",
            "token_uri": "https://www.example.com/",
            "private_key": "the\nprivate\nkey\nwith\nmultiple\nlines",
        }
        assert from_service_account_info.call_args[0][0] == expected_account_info
        expected_scopes = ["https://spreadsheets.google.com/feeds", "https://www.googleapis.com/auth/drive"]
        assert from_service_account_info.call_args[1] == {"scopes": expected_scopes}
 def test_raises_exception_when_empty_environ_variable(self):
     with pytest.raises(MissingGoogleKeyException):
         get_credentials()