def test_profiles_manager_filter_method():
  '''
    Test basic profiles filtering based on some minimal criteria
  '''

  mocked_api = MagicMock()

  profiles = Profiles(mocked_api, [{'a':'b'}, {'a': 'c'}])

  eq_(profiles.filter(a='b'), [{'a': 'b'}])
def test_profiles_manager_filter_method_empty():
  '''
    Test basic profiles filtering when the manager is empty
  '''

  mocked_api = MagicMock()
  mocked_api.get.return_value = [{'a':'b'}, {'a': 'c'}]


  profiles = Profiles(api=mocked_api)

  eq_(profiles.filter(a='b'), [Profile(mocked_api, {'a': 'b'})])
Beispiel #3
0
from colorama import Fore

from bufferapp.managers.profiles import Profiles
from bufferapp.api import API

# check http://bufferapp.com/developers/apps to retrieve a token
# or generate one with the example
token = 'awesome_token'

# instantiate the api object
api = API(client_id='client_id',
          client_secret='client_secret',
          access_token=token)

# get all profiles
profiles = Profiles(api=api)
print profiles.all()

# filter profiles using some criteria
profile = Profiles(api=api).filter(service='twitter')[0]
print profile

# get schedules of my twitter profile
profile = Profiles(api=api).filter(service='twitter')[0]
print profile.schedules

# update schedules times for my twitter profile
profile = Profiles(api=api).filter(service='twitter')[0]

profile.schedules = {
  'days': ['tue', 'thu'],