コード例 #1
0
def test_get_operations(monkeypatch):
    monkeypatch.setattr('requests.get', make_requests_get_mock('sample_getoperations.xml'))
    account = AccountingManagement(ShibaConnection("test", "test", "https://ws.fr.shopping.rakuten.com"))
    operations = account.get_operations()
    assert "getoperationsresult" in operations.content.tag
    assert operations.content.request.user == "vendeur"
    assert operations.content.request.operationcause == "salestransfer"
コード例 #2
0
def test_get_compensation_details(connection):
    """get_compensation_details test, must fail"""
    accounting_management = AccountingManagement(connection)
    obj = None
    try:
        obj = accounting_management.get_compensation_details("1337")
    except ShibaParameterError:
        pass
    assert obj is None
コード例 #3
0
def test_get_operations(connection):
    """get_operations routine test, with date object as lastoperationdate too"""
    accounting_management = AccountingManagement(connection)
    obj = accounting_management.get_operations()
    assert "getoperationsresult" in obj.content.tag
    obj = accounting_management.get_operations("21/12/2012-00:00:00")
    assert obj.content.request.lastoperationdate == "21/12/2012-00:00:00"
    testdate = date(2012, 12, 21)
    obj = accounting_management.get_operations(testdate)
    assert obj.content.request.lastoperationdate == "21/12/12-00:00:00"
    obj = None
    try:
        obj = accounting_management.get_operations("INVALIDDATE")
    except ShibaParameterError:
        pass
    assert obj is None
コード例 #4
0
 def setUp(self):
     settings = ConfigParser.ConfigParser()
     try:
         settings.read(os.path.dirname(os.path.realpath(__file__)) + "/Assets/nosetests.cfg")
     except:
         raise ShibaCallingError("error : can't read login ID from the nosetests.cfg file")
     try:
         login = settings.get(str("NoseConfig"), "login")
         pwd = settings.get(str("NoseConfig"), "pwd")
     except:
         raise ShibaCallingError("error : configuration file doesn't seem to be regular")
     self.init = AccountingManagement(ShibaConnection(login, pwd, "https://ws.sandbox.priceminister.com"))
コード例 #5
0
class AccountingManagementTest(unittest.TestCase):

    def setUp(self):
        settings = ConfigParser.ConfigParser()
        try:
            settings.read(os.path.dirname(os.path.realpath(__file__)) + "/Assets/nosetests.cfg")
        except:
            raise ShibaCallingError("error : can't read login ID from the nosetests.cfg file")
        try:
            login = settings.get(str("NoseConfig"), "login")
            pwd = settings.get(str("NoseConfig"), "pwd")
        except:
            raise ShibaCallingError("error : configuration file doesn't seem to be regular")
        self.init = AccountingManagement(ShibaConnection(login, pwd, "https://ws.sandbox.priceminister.com"))

    def test_get_operations(self):
        """get_operations routine test, with date object as lastoperationdate too"""
        obj = self.init.get_operations()
        self.assertIn("getoperationsresult", obj.content.tag)
        obj = self.init.get_operations("21/12/2012-00:00:00")
        self.assertEqual(obj.content.request.lastoperationdate, "21/12/2012-00:00:00")
        testdate = date(2012, 12, 21)
        obj = self.init.get_operations(testdate)
        self.assertEqual(obj.content.request.lastoperationdate, "21/12/12-00:00:00")
        obj = None
        try:
            obj = self.init.get_operations("INVALIDDATE")
        except ShibaParameterError:
            pass
        self.assertIsNone(obj)

    def test_get_compensation_details(self):
        """get_compensation_details test, must fail"""
        obj = None
        try:
            obj = self.init.get_compensation_details("1337")
        except ShibaParameterError:
            pass
        self.assertIsNone(obj)
コード例 #6
0
def test_get_compensation_details(monkeypatch):
    monkeypatch.setattr('requests.get', make_requests_get_mock('sample_getcompensationdetails.xml'))
    account = AccountingManagement(ShibaConnection("test", "test", "https://ws.fr.shopping.rakuten.com"))
    compensation_details = account.get_compensation_details("1337")
    assert compensation_details.content.tag == "getcompensationdetailsresult"