def test_my_collections(self):
        """ If you ask for your collections, you need to have
        authenticated first."""

        old_mb_request = musicbrainzngs.musicbrainz._mb_request

        params = {}
        def local_mb_request(path, method='GET', auth_required=False,
                client_required=False, args=None, data=None, body=None):
            params["auth_required"] = auth_required

        musicbrainzngs.musicbrainz._mb_request = local_mb_request
        musicbrainzngs.get_collections()
        self.assertEqual(True, params["auth_required"])

        musicbrainzngs.musicbrainz._mb_request = old_mb_request
Exemplo n.º 2
0
def show_collections():
    """Fetch and display the current user's collections.
    """
    result = musicbrainzngs.get_collections()
    print('All collections for this user:'******'collection-list']:
        print('{name} by {editor} ({mbid})'.format(name=collection['name'],
                                                   editor=collection['editor'],
                                                   mbid=collection['id']))
    def test_my_collections(self):
        """ If you ask for your collections, you need to have
        authenticated first."""

        old_mb_request = musicbrainzngs.musicbrainz._mb_request

        params = {}
        def local_mb_request(path, method='GET',
                auth_required=musicbrainzngs.musicbrainz.AUTH_NO,
                client_required=False, args=None, data=None, body=None):
            params["auth_required"] = auth_required

        musicbrainzngs.musicbrainz._mb_request = local_mb_request
        musicbrainzngs.get_collections()
        self.assertEqual(musicbrainzngs.musicbrainz.AUTH_YES,
            params["auth_required"])

        musicbrainzngs.musicbrainz._mb_request = old_mb_request
Exemplo n.º 4
0
def show_collections():
    """Fetch and display the current user's collections.
    """
    result = musicbrainzngs.get_collections()
    print('All collections for this user:'******'collection-list']:
        print('{name} by {editor} ({mbid})'.format(
            name=collection['name'], editor=collection['editor'],
            mbid=collection['id']
        ))
Exemplo n.º 5
0
def show_collections():
    """Fetch and display the current user's collections.
    """
    result = musicbrainzngs.get_collections()
    print("All collections for this user:"******"collection-list"]:
        print(
            "{name} by {editor} ({mbid})".format(
                name=collection["name"], editor=collection["editor"], mbid=collection["id"]
            )
        )
Exemplo n.º 6
0
def show_collections():
    """Fetch and display the current user's collections.
    """
    result = musicbrainzngs.get_collections()
    print('All collections for this user:'******'collection-list']:
        # entity-type only available starting with musicbrainzngs 0.6
        if "entity-type" in collection:
            print('"{name}" by {editor} ({cat}, {entity})\n\t{mbid}'.format(
                name=collection['name'], editor=collection['editor'],
                cat=collection['type'], entity=collection['entity-type'],
                mbid=collection['id']
            ))
        else:
            print('"{name}" by {editor}\n\t{mbid}'.format(
                name=collection['name'], editor=collection['editor'],
                mbid=collection['id']
            ))
Exemplo n.º 7
0
def show_collections():
    """Fetch and display the current user's collections.
    """
    result = musicbrainzngs.get_collections()
    print('All collections for this user:'******'collection-list']:
        # entity-type only available starting with musicbrainzngs 0.6
        if "entity-type" in collection:
            print('"{name}" by {editor} ({cat}, {count} {entity}s)\n\t{mbid}'.
                  format(name=collection['name'],
                         editor=collection['editor'],
                         cat=collection['type'],
                         entity=collection['entity-type'],
                         count=collection[collection['entity-type'] +
                                          '-count'],
                         mbid=collection['id']))
        else:
            print('"{name}" by {editor}\n\t{mbid}'.format(
                name=collection['name'],
                editor=collection['editor'],
                mbid=collection['id']))
Exemplo n.º 8
0
def show_collections():
    """Fetch and display the current user's collections.
    """
    result = musicbrainzngs.get_collections()
    print("All collections for this user:"******"collection-list"]:
        # entity-type only available starting with musicbrainzngs 0.6
        if "entity-type" in collection:
            print(
                '"{name}" by {editor} ({cat}, {count} {entity}s)\n\t{mbid}'.format(
                    name=collection["name"],
                    editor=collection["editor"],
                    cat=collection["type"],
                    entity=collection["entity-type"],
                    count=collection[collection["entity-type"] + "-count"],
                    mbid=collection["id"],
                )
            )
        else:
            print(
                '"{name}" by {editor}\n\t{mbid}'.format(
                    name=collection["name"], editor=collection["editor"], mbid=collection["id"]
                )
            )