How to use splitwise - 10 common examples

To help you get started, we’ve selected a few splitwise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github namaggarwal / splitwise / e2e-tests / test_group.py View on Github external
def test_group_invalidkeys_fail(self):
        sObj = Splitwise('consumerkey', 'consumersecret', {"oauth_token": "sdsd", "oauth_token_secret": "sdsdd"})
        group = Group()
        with self.assertRaises(SplitwiseUnauthorizedException):
            sObj.createGroup(group)
github namaggarwal / splitwise / tests / test_createGroup.py View on Github external
def setUp(self):
        self.sObj = Splitwise('consumerkey', 'consumersecret')
github namaggarwal / splitwise / e2e-tests / test_group.py View on Github external
def setUp(self):
        consumer_key = os.environ['CONSUMER_KEY']
        consumer_secret = os.environ['CONSUMER_SECRET']
        oauth_token = os.environ['OAUTH_TOKEN']
        oauth_token_secret = os.environ['OAUTH_TOKEN_SECRET']

        self.sObj = Splitwise(consumer_key, consumer_secret)
        self.sObj.setAccessToken({'oauth_token': oauth_token, 'oauth_token_secret': oauth_token_secret})
github namaggarwal / splitwise / tests / test_createExpense.py View on Github external
def setUp(self):
        self.sObj = Splitwise('consumerkey', 'consumersecret')
github namaggarwal / splitwise / tests / test_getExpenses.py View on Github external
def setUp(self):
        self.sObj = Splitwise('consumerkey', 'consumersecret')
github namaggarwal / splitwise / tests / test_getGroups.py View on Github external
def setUp(self):
        self.sObj = Splitwise('consumerkey', 'consumersecret')
github namaggarwal / splitwise / tests / test_getFriends.py View on Github external
def setUp(self):
        self.sObj = Splitwise('consumerkey', 'consumersecret')
github namaggarwal / splitwise / tests / test_getGroup.py View on Github external
def setUp(self):
        self.sObj = Splitwise('consumerkey', 'consumersecret')
github namaggarwal / splitwise / tests / test_addUserToGroup.py View on Github external
def test_createGroup_exception(self, mockMakeRequest):
        mockMakeRequest.side_effect = Exception(
            "Invalid response %s. Please check your consumer key and secret." % 404)
        user = User()
        user.setId(281236)
        with self.assertRaises(Exception):
            success, userRes, errors = self.sObj.addUserToGroup(user, 19481273)
        mockMakeRequest.assert_called_with(
            "https://secure.splitwise.com/api/v3.0/add_user_to_group", "POST",
            {'group_id': 19481273, 'user_id': 281236})
github namaggarwal / splitwise / tests / test_addUserToGroup.py View on Github external
def test_addUserToGroup_withid_success(self, mockMakeRequest):
        mockMakeRequest.return_value = '{"success":true,"user":{"id":281236,"first_name":"Siddharth","last_name":"Goel","picture":{"small":"https://splitwise.s3.amazonaws.com/uploads/user/avatar/281236/small_f5fccc37-0a88-4519-9398-59c8c19b92aa.jpeg","medium":"https://splitwise.s3.amazonaws.com/uploads/user/avatar/281236/medium_f5fccc37-0a88-4519-9398-59c8c19b92aa.jpeg","large":"https://splitwise.s3.amazonaws.com/uploads/user/avatar/281236/large_f5fccc37-0a88-4519-9398-59c8c19b92aa.jpeg"},"custom_picture":true,"email":"siddharth98391@gmail.com","registration_status":"confirmed","balance":[]},"errors":{}}'  # noqa: E501
        user = User()
        user.setId(281236)
        success, userRes, errors = self.sObj.addUserToGroup(user, 19481273)
        mockMakeRequest.assert_called_with(
            "https://secure.splitwise.com/api/v3.0/add_user_to_group", "POST",
            {'group_id': 19481273, 'user_id': 281236})
        self.assertTrue(success)
        self.assertIsNone(errors)
        self.assertEqual(userRes.getId(), 281236)
        self.assertEqual(userRes.getFirstName(), "Siddharth")
        self.assertEqual(userRes.getLastName(), "Goel")
        self.assertEqual(userRes.getPicture().getSmall(
        ), "https://splitwise.s3.amazonaws.com/uploads/user/avatar/281236/small_f5fccc37-0a88-4519-9398-59c8c19b92aa.jpeg")
        self.assertEqual(userRes.getPicture().getMedium(
        ), "https://splitwise.s3.amazonaws.com/uploads/user/avatar/281236/medium_f5fccc37-0a88-4519-9398-59c8c19b92aa.jpeg")
        self.assertEqual(userRes.getPicture().getLarge(
        ), "https://splitwise.s3.amazonaws.com/uploads/user/avatar/281236/large_f5fccc37-0a88-4519-9398-59c8c19b92aa.jpeg")