summaryrefslogtreecommitdiffstats
path: root/tests/test_wikidata_org.py
blob: 3222870c5fda1be1350ad7a9c97aa8fb988647e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
This file contains tests that connect to the live, "real", production
wikidata.org site. It probably shouldn't be run by default, and *DEFINATELY*
should do only read-only operations without logging in.

It requires the 'nose' python package. To run it, just enter this directory and
do:
    
    $ nosetests

If there are errors it can be helpful to debug with:

    $ nosetests --pdb
"""

from nose.tools import *
from nose.plugins.skip import SkipTest
import unittest

from bbb import *


class TestWikidataOrg(unittest.TestCase):

    @classmethod
    def setUp(cls):
        cls.srv = WikibaseServer(
            api_url="https://test.wikidata.org/w/api.php",
            lang="en",
            auth=None)
        try:
            cls.srv.check()
        except WikibaseException:
            raise SkipTest("Couldn't connect wikidata.org")

    def test_low_level(self):
        self.srv._get("wbgetclaims", dict(entity="Q11"))

    def test_item_object(self):
        item = self.srv.get_item("Q10")
        item.to_dict()