mockdb.apihash

Here are the examples of the python api mockdb.apihash taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

13 Examples 7

Example 1

Project: gengo-python
Source File: tests.py
View license
    def test_postJobComment(self):
        """
        Tests posting a comment to a job.
        """
        posted_comment = self.gengo.postTranslationJobComment(
            id=123,
            comment={'body': 'I love lamp oh mai gawd'})
        self.assertEqual(posted_comment['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['postTranslationJobComment']['url']
            .replace('{{id}}', '123'))

Example 2

Project: gengo-python
Source File: tests.py
View license
    def test_postJobCommentWithAttachments(self):
        """
        Tests posting a comment with attachments to a job.
        """
        posted_comment = self.gengo.postTranslationJobComment(
            id=123,
            comment={
                'body': 'I love lamp oh mai gawd'
            },
            file_attachments=[
                './examples/testfiles/test_file1.txt',
                './examples/testfiles/test_file2.txt'
            ]
        )
        self.assertEqual(posted_comment['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['postTranslationJobComment']['url']
            .replace('{{id}}', '123'))

Example 3

Project: gengo-python
Source File: tests.py
View license
    def test_postTranslationJobs_as_group(self):
        """
        Make sure that the as_group setting gets interpreted by the API
        correctly.
        """
        resp = self.gengo.getTranslationOrderJobs(id=321)
        self.assertEqual(resp['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getTranslationOrderJobs']['url']
            .replace('{{id}}', '321'))

Example 4

Project: gengo-python
Source File: tests.py
View license
    def test_postJobComment(self):
        """
        Tests posting a comment to a job.
        """
        job_comments = self.gengo.getTranslationJobComments(id=1)
        self.assertEqual(job_comments['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getTranslationJobComments']['url']
            .replace('{{id}}', '1'))

Example 5

Project: gengo-python
Source File: tests.py
View license
    def test_getPreferredTranslators(self):
        resp = self.gengo.getPreferredTranslators()
        self.assertEqual(resp['opstat'], 'ok')
        # self.getMock.assert_any_call()
        self.getMock.assert_path_contains(
            mockdb.apihash['getPreferredTranslators']['url'])

Example 6

Project: gengo-python
Source File: tests.py
View license
    def test_getJobDataMethods(self):
        """
        Test a ton of methods that GET data from the Gengo API, based on
        the jobs we've created and such.

        These are separate from the other GET request methods because this
        might be a huge nuisance to their API,
        and I figure it's worth separating out the pain-point test cases so
        they could be disabled easily in a
        distribution or something.
        """
        # Pull down data about one specific job.
        job = self.gengo.getTranslationJob(id=123)
        self.assertEqual(job['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getTranslationJob']['url']
            .replace('{{id}}', '123'))

        # Pull down the 10 most recently submitted jobs.
        jobs = self.gengo.getTranslationJobs()
        self.assertEqual(jobs['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getTranslationJobs']['url'])

        # Test getting the batch that a job is in.
        job_batch = self.gengo.getTranslationJobBatch(id=123)
        self.assertEqual(job_batch['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getTranslationJobBatch']['url']
            .replace('{{id}}', '123'))

        # Pull down feedback. This should work fine, but there'll be no
        # feedback.
        feedback = self.gengo.getTranslationJobFeedback(id=123)
        self.assertEqual(feedback['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getTranslationJobFeedback']['url']
            .replace('{{id}}', '123'))

        # Lastly, pull down any revisions that definitely didn't occur due
        # to this being a simulated test.
        revisions = self.gengo.getTranslationJobRevisions(id=123)
        self.assertEqual(revisions['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getTranslationJobRevisions']['url']
            .replace('{{id}}', '123'))

Example 7

Project: gengo-python
Source File: tests.py
View license
    def test_getJobDataMethods(self):
        """
        Test a ton of methods that GET data from the Gengo API, based on
        the jobs we've created and such.

        These are separate from the other GET request methods because this
        might be a huge nuisance to their API,
        and I figure it's worth separating out the pain-point test cases so
        they could be disabled easily in a
        distribution or something.
        """
        # Pull down data about one specific job...
        job = self.gengo.getTranslationJob(id=1)
        self.assertEqual(job['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getTranslationJob']['url']
            .replace('{{id}}', '1'))

        # Pull down the 10 most recently submitted jobs.
        jobs = self.gengo.getTranslationJobs()
        self.assertEqual(jobs['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getTranslationJobs']['url'])

        # Test getting the batch that a job is in...
        job_batch = self.gengo.getTranslationJobBatch(id=1)
        self.assertEqual(job_batch['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getTranslationJobBatch']['url']
            .replace('{{id}}', '1'))

        # Pull down feedback. This should work fine, but there'll be no
        # feedback.
        feedback = self.gengo.getTranslationJobFeedback(id=1)
        self.assertEqual(feedback['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getTranslationJobFeedback']['url']
            .replace('{{id}}', '1'))

        # Lastly, pull down any revisions that definitely didn't occur due
        # to this being a simulated test.
        revisions = self.gengo.getTranslationJobRevisions(id=1)
        self.assertEqual(revisions['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getTranslationJobRevisions']['url']
            .replace('{{id}}', '1'))

Example 8

Project: gengo-python
Source File: tests.py
View license
    def test_getAccountStats(self):
        stats = self.gengo.getAccountStats()
        self.assertEqual(stats['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getAccountStats']['url'])

Example 9

Project: gengo-python
Source File: tests.py
View license
    def test_getAccountBalance(self):
        balance = self.gengo.getAccountBalance()
        self.assertEqual(balance['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getAccountBalance']['url'])

Example 10

Project: gengo-python
Source File: tests.py
View license
    def test_getServiceLanguagePairs(self):
        resp = self.gengo.getServiceLanguagePairs()
        self.assertEqual(resp['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getServiceLanguagePairs']['url'])

Example 11

Project: gengo-python
Source File: tests.py
View license
    def test_getServiceLanguages(self):
        resp = self.gengo.getServiceLanguages()
        self.assertEqual(resp['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getServiceLanguages']['url'])

Example 12

Project: gengo-python
Source File: tests.py
View license
    def test_getServiceLanguageMatrix(self):
        resp = self.gengo.getServiceLanguageMatrix()
        self.assertEqual(resp['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getServiceLanguageMatrix']['url'])

Example 13

Project: gengo-python
Source File: tests.py
View license
    def test_getGlossaryList(self):
        resp = self.gengo.getGlossaryList()
        self.assertEqual(resp['opstat'], 'ok')
        self.getMock.assert_path_contains(
            mockdb.apihash['getGlossaryList']['url'])