예제 #1
0
def test_teamrooms_none():
    te = Team(get_client())
    te_v2 = Team_V2(get_client())

    #test full_url
    full_url = te.full_url('test')
    assert full_url == 'https://www.odesk.com/api/team/v1/test', full_url

    #test get_teamrooms
    assert te_v2.get_teamrooms() == [], te_v2.get_teamrooms()

    #test get_snapshots
    assert te_v2.get_snapshots(1) == [], te_v2.get_snapshots(1)

    #test get_snapshot
    eq_(te.get_snapshot(1, 1), teamrooms_dict_none['snapshot'])
예제 #2
0
    def __init__(self, public_key, secret_key, api_token=None,
                oauth_access_token=None, oauth_access_token_secret=None,
                format='json', auth='simple', finreport=True,
                hr=True, mc=True, oconomy=True, provider=True,
                task=True, team=True, timereport=True):

        self.public_key = public_key
        self.secret_key = secret_key
        self.api_token = api_token
        self.format = format

        if auth == 'simple':
            self.auth = Auth(self)
        elif auth == 'oauth':
            from odesk.oauth import OAuth
            self.auth = OAuth(self)
            self.oauth_access_token = oauth_access_token
            self.oauth_access_token_secret = oauth_access_token_secret

        #Namespaces
        if finreport:
            from odesk.routers.finreport import Finreports
            self.finreport = Finreports(self)

        if hr:
            from odesk.routers.hr import HR
            self.hr = HR(self)

        if mc:
            from odesk.routers.mc import *
            self.mc = MC(self)

        if oconomy:
            from odesk.routers.oconomy import OConomy, NonauthOConomy
            self.oconomy = OConomy(self)
            self.nonauth_oconomy = NonauthOConomy(self)

        if provider:
            from odesk.routers.provider import Provider
            self.provider = Provider(self)

        if task:
            from odesk.routers.task import Task
            self.task = Task(self)

        if team:
            from odesk.routers.team import Team
            self.team = Team(self)

        if timereport:
            from odesk.routers.timereport import TimeReport
            self.timereport = TimeReport(self)
예제 #3
0
def test_team():
    te = Team(get_client())

    #test full_url
    full_url = te.full_url('test')
    assert full_url == 'https://www.odesk.com/api/team/v1/test', full_url

    #test get_teamrooms
    assert te.get_teamrooms() == [teamrooms_dict['teamrooms']['teamroom']], \
         te.get_teamrooms()

    #test get_snapshots
    assert te.get_snapshots(1) == [teamrooms_dict['teamroom']['snapshot']], \
         te.get_snapshots(1)

    #test get_snapshot
    assert te.get_snapshot(1, 1) == teamrooms_dict['snapshot'], te.get_snapshot(1, 1)

    #test update_snapshot
    assert te.update_snapshot(1, 1, memo='memo') == teamrooms_dict, te.update_snapshot(1, 1, memo='memo')

    #test update_snapshot
    assert te.delete_snapshot(1, 1) == teamrooms_dict, te.delete_snapshot(1, 1)

    #test get_workdiaries
    assert te.get_workdiaries(1, 1, 1) == (teamrooms_dict['snapshots']['user'], \
        [teamrooms_dict['snapshots']['snapshot']]), te.get_workdiaries(1, 1, 1)
예제 #4
0
def test_team():
    te = Team(get_client())

    #test full_url
    full_url = te.full_url('test')
    assert full_url == 'https://www.odesk.com/api/team/v1/test', full_url

    #test get_teamrooms
    assert te.get_teamrooms() == [teamrooms_dict['teamrooms']['teamroom']], \
         te.get_teamrooms()

    #test get_snapshots
    assert te.get_snapshots(1) == [teamrooms_dict['teamroom']['snapshot']], \
         te.get_snapshots(1)

    #test get_snapshot
    assert te.get_snapshot(1,
                           1) == teamrooms_dict['snapshot'], te.get_snapshot(
                               1, 1)

    #test update_snapshot
    assert te.update_snapshot(
        1, 1, memo='memo') == teamrooms_dict, te.update_snapshot(1,
                                                                 1,
                                                                 memo='memo')

    #test update_snapshot
    assert te.delete_snapshot(1, 1) == teamrooms_dict, te.delete_snapshot(1, 1)

    #test get_workdiaries
    assert te.get_workdiaries(1, 1, 1) == (teamrooms_dict['snapshots']['user'], \
        [teamrooms_dict['snapshots']['snapshot']]), te.get_workdiaries(1, 1, 1)
예제 #5
0
    def __init__(self,
                 public_key,
                 secret_key,
                 oauth_access_token=None,
                 oauth_access_token_secret=None,
                 fmt='json',
                 finreport=True,
                 hr=True,
                 mc=True,
                 offers=True,
                 provider=True,
                 task=True,
                 team=True,
                 timereport=True,
                 job=True):

        self.public_key = public_key
        self.secret_key = secret_key
        self.fmt = fmt
        self.http = urllib3.PoolManager()

        self.oauth_access_token = oauth_access_token
        self.oauth_access_token_secret = oauth_access_token_secret

        #Namespaces
        self.auth = OAuth(self)

        if finreport:
            from odesk.routers.finreport import Finreports
            self.finreport = Finreports(self)

        if hr:
            from odesk.routers.hr import HR_V1, HR, HR_V3
            self.hr_v1 = HR_V1(self)
            self.hr = HR(self)
            self.hr_v3 = HR_V3(self)

        if mc:
            from odesk.routers.mc import MC
            self.mc = MC(self)

        if offers:
            from odesk.routers.offers import Offers
            self.offers = Offers(self)

        if provider:
            from odesk.routers.provider import Provider, Provider_V2
            self.provider = Provider(self)
            self.provider_v2 = Provider_V2(self)

        if task:
            from odesk.routers.task import Task, Task_V2
            self.task = Task(self)
            self.task_v2 = Task_V2(self)

        if team:
            from odesk.routers.team import Team, Team_V2
            self.team = Team(self)
            self.team_v2 = Team_V2(self)

        if timereport:
            from odesk.routers.timereport import TimeReport
            self.timereport = TimeReport(self)

        if job:
            from odesk.routers.job import Job
            self.job = Job(self)