def test_version(self): """ Test default version """ api = cocart.CoCartAPI( url="https://test.dev" ) self.assertEqual(api.version, "cocart/v1")
def setUp(self): self.consumer_key = "ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" self.consumer_secret = "cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" self.api = cocart.CoCartAPI( url="https://test.dev", consumer_key=self.consumer_key, consumer_secret=self.consumer_secret )
def test_with_timeout(self): """ Test timeout """ api = cocart.CoCartAPI( url="https://test.dev", timeout=10, ) self.assertEqual(api.timeout, 10) @all_requests def cocart_test_mock(*args, **kwargs): """ URL Mock """ return {'status_code': 200, 'content': 'OK'} with HTTMock(cocart_test_mock): # call requests status = api.get("products").status_code self.assertEqual(status, 200)
def test_with_ssl(self): """ Test ssl """ api = cocart.CoCartAPI( url="https://test.dev" ) self.assertTrue(api.is_ssl, True)
def test_non_ssl(self): """ Test non-ssl """ api = cocart.CoCartAPI( url="https://test.dev" ) self.assertFalse(api.is_ssl)