コード例 #1
0
    def test_post_job(self, mock_post):
        j = Job(customer=self.customer, id='01', companyIndustry='companyIndustry', startDate=u'1994-10-06',
                endDate=u'1994-10-06', companyName='companyName', jobTitle='jobTitle',
                isCurrent=True)
        j.post()

        mock_post.assert_called_with(self.base_url_customer + '/' + self.customer.id + '/jobs',
                                    headers=self.headers_expected,
                                    json=j.attributes)
        assert self.customer.base.jobs[0].attributes == j.attributes, (self.customer.base.jobs[0].attributes
                                                                       ,j.attributes)
コード例 #2
0
    def test_post_job_create_base(self, mock_post):
        c = Customer(node=self.node, default_attributes={}, id='01')
        j = Job(customer=c, id='01', companyIndustry='companyIndustry', startDate=u'1994-10-06',
                endDate=u'1994-10-06', companyName='companyName', jobTitle='jobTitle',
                isCurrent=True)
        j.post()

        mock_post.assert_called_with(self.base_url_customer + '/' + c.id + '/jobs',
                                    headers=self.headers_expected,
                                    json=j.attributes)
        assert c.base.jobs[0].attributes == j.attributes, (c.base.jobs[0].attributes, j.attributes)
コード例 #3
0
 def test_create_job_new_c(self):
     j = Job(customer=Customer(node=self.node), a='b')
     try:
         j.post()
     except AttributeError as e:
         assert "Customer object has no attribute 'id'" in str(e), str(e)