def test_encode_if_not_encoded_encoded_string(self):
     """
     encode_if_not_encoded() should return the same string if it is already encoded
     """
     client = Client('userId', 'apiToken', 'apiSecret')
     encoded_string = "Home%281%29-m-m4dh5ym.jpg"
     self.assertEqual(encoded_string,
                      client._encode_if_not_encoded(encoded_string))
 def test_encoded_if_not_encoded_non_encoded_string(self):
     """
     encoded_if_not_encoded() should encode the string if not already encoded
     """
     client = Client('userId', 'apiToken', 'apiSecret')
     encoded_string = "Home%281%29-m-m4dh5ym.jpg"
     non_encoded_string = "Home(1)-m-m4dh5ym.jpg"
     self.assertEqual(encoded_string,
                      client._encode_if_not_encoded(non_encoded_string))
 def test_init_with_right_auth_data(self):
     """
     Client() should return client instance with right auth data
     """
     client = Client('userId', 'apiToken', 'apiSecret')
     self.assertEqual('userId', client.user_id)
     self.assertTupleEqual(('apiToken', 'apiSecret'), client.auth)
     self.assertEqual('https://api.catapult.inetwork.com',
                      client.api_endpoint)
     self.assertEqual('v1', client.api_version)
 def test_init_with_right_auth_data_and_another_endpoint_and_version(self):
     """
     Client() should return client instance with right auth data (different endpoint and version)
     """
     client = Client('userId',
                     'apiToken',
                     'apiSecret',
                     api_endpoint='url',
                     api_version='v2')
     self.assertEqual('userId', client.user_id)
     self.assertTupleEqual(('apiToken', 'apiSecret'), client.auth)
     self.assertEqual('url', client.api_endpoint)
     self.assertEqual('v2', client.api_version)
 def test_init_with_missing_auth_data(self):
     """
     Client() should raise error on missing auth data
     """
     with self.assertRaises(ValueError):
         Client('userId')