Example #1
0
class TestGlossaryFunctions(unittest.TestCase):

    """
    """
    def setUp(self):
        """
        Creates the initial batch of jobs for the other test functions here
        to operate on.
        """
        self.gengo = Gengo(public_key=API_PUBKEY,
                           private_key=API_PRIVKEY,
                           sandbox=True)

        from gengo import requests
        self.json_mock = mock.Mock()
        self.json_mock.json.return_value = {'opstat': 'ok'}
        self.getMock = RequestsMock(return_value=self.json_mock)
        self.requestsPatch = mock.patch.object(requests, 'get', self.getMock)
        self.requestsPatch.start()

    def tearDown(self):
        self.requestsPatch.stop()

    def test_getGlossaryList(self):
        resp = self.gengo.getGlossaryList()
        self.assertEqual(resp['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getGlossaryList']['url'])
Example #2
0
class TestGlossaryFunctions(unittest.TestCase):
    """
    """
    def setUp(self):
        """
        Creates the initial batch of jobs for the other test functions here
        to operate on.
        """
        self.gengo = Gengo(public_key=API_PUBKEY,
                           private_key=API_PRIVKEY,
                           sandbox=True)

        self.json_mock = mock.Mock()
        self.json_mock.json.return_value = {'opstat': 'ok'}
        self.getMock = RequestsMock(return_value=self.json_mock)
        self.requestsPatch = mock.patch.object(requests, 'get', self.getMock)
        self.requestsPatch.start()

    def tearDown(self):
        self.requestsPatch.stop()

    def test_getGlossaryList(self):
        resp = self.gengo.getGlossaryList()
        self.assertEqual(resp['opstat'], 'ok')
        self.getMock.assert_path_contains(
            gengo.mockdb.apihash['getGlossaryList']['url'])
Example #3
0
class TestGlossaryFunctions(unittest.TestCase):
    """
    """
    def setUp(self):
        """
        Creates the initial batch of jobs for the other test functions here
        to operate on.
        """
        self.gengo = Gengo(public_key=API_PUBKEY,
                           private_key=API_PRIVKEY,
                           sandbox=True)

    def test_getGlossaryList(self):
        resp = self.gengo.getGlossaryList()
        self.assertEqual(resp['opstat'], 'ok')
Example #4
0
class TestGlossaryFunctions(unittest.TestCase):
    """
    """
    def setUp(self):
        """
        Creates the initial batch of jobs for the other test functions here
        to operate on.
        """
        # First we'll create three jobs - one regular, and two at the same
        # time...
        self.gengo = Gengo(public_key=API_PUBKEY, private_key=API_PRIVKEY)
        self.gengo.api_url = 'http://api.staging.gengo.com/%(version)s'

    def test_getGlossaryList(self):
        resp = self.gengo.getGlossaryList()
        self.assertEqual(resp['opstat'], 'ok')
Example #5
0
class TestGlossaryFunctions(unittest.TestCase):

    """
    """
    def setUp(self):
        """
        Creates the initial batch of jobs for the other test functions here
        to operate on.
        """
        self.gengo = Gengo(public_key=API_PUBKEY,
                           private_key=API_PRIVKEY,
                           sandbox=True)

    def test_getGlossaryList(self):
        resp = self.gengo.getGlossaryList()
        self.assertEqual(resp['opstat'], 'ok')
Example #6
0
class TestGlossaryFunctions(unittest.TestCase):
    """
    """
    def setUp(self):
        """
        Creates the initial batch of jobs for the other test functions here
        to operate on.
        """
        # First we'll create three jobs - one regular, and two at the same
        # time...
        self.gengo = Gengo(public_key=API_PUBKEY,
                           private_key=API_PRIVKEY)
        self.gengo.api_url = 'http://api.staging.gengo.com/%(version)s'

    def test_getGlossaryList(self):
        resp = self.gengo.getGlossaryList()
        self.assertEqual(resp['opstat'], 'ok')
Example #7
0
class TestGlossaryFunctions(unittest.TestCase):
    """
    """
    def setUp(self):
        """
        Creates the initial batch of jobs for the other test functions here
        to operate on.
        """
        # First we'll create three jobs - one regular, and two at the same
        # time...
        self.gengo = Gengo(public_key=API_PUBKEY,
                           private_key=API_PRIVKEY)
        self.gengo.api_url = 'http://api.staging.gengo.com/%(version)s'

    def test_getGlossaryList(self):
        resp = self.gengo.getGlossaryList()
        self.assertEqual(resp['opstat'], 'ok')

    @unittest.skip("unless you created a glossary on the site (not yet " +
                   "supported via the API) this test does not make a " +
                   " lot of sense.")
    def test_getGlossary(self):
        resp = self.gengo.getGlossary(id=42)
        resp