def setUp(self):
        self.endpoint = MockEndpoint("http://test-api.com/", "dummy", "dummy")
        self.stock_api_object = MockILSStockDataSynchronization(TEST_DOMAIN, self.endpoint)
        self.datapath = os.path.join(os.path.dirname(__file__), "data")
        initial_bootstrap(TEST_DOMAIN)
        self.api_object = ILSGatewayAPI(TEST_DOMAIN, self.endpoint)
        self.api_object.prepare_commtrack_config()
        config = ILSGatewayConfig()
        config.domain = TEST_DOMAIN
        config.enabled = True
        config.all_stock_data = True
        config.password = "******"
        config.username = "******"
        config.url = "http://test-api.com/"
        config.save()
        l1 = Location(name="Test location 1", external_id="3445", location_type="FACILITY", domain=TEST_DOMAIN)

        l2 = Location(name="Test location 2", external_id="4407", location_type="FACILITY", domain=TEST_DOMAIN)

        l1.save()
        l2.save()

        SupplyPointCase.create_from_location(TEST_DOMAIN, l1)
        SupplyPointCase.create_from_location(TEST_DOMAIN, l2)

        with open(os.path.join(self.datapath, "sample_products.json")) as f:
            for product_json in json.loads(f.read()):
                self.api_object.product_sync(Product(product_json))

        StockTransaction.objects.all().delete()
Exemplo n.º 2
0
 def setUp(self):
     self.datapath = os.path.join(os.path.dirname(__file__), 'data')
     initial_bootstrap(TEST_DOMAIN)
     config = ILSGatewayConfig()
     config.domain = TEST_DOMAIN
     config.enabled = True
     config.password = '******'
     config.username = '******'
     config.url = 'http://test-api.com/'
     config.save()
     for product in Product.by_domain(TEST_DOMAIN):
         product.delete()
Exemplo n.º 3
0
    def setUpClass(cls):
        cls.datapath = os.path.join(os.path.dirname(__file__), 'data')
        cls.sms_backend, cls.sms_backend_mapping = setup_default_sms_test_backend()
        initial_bootstrap(TEST_DOMAIN)

        config = ILSGatewayConfig()
        config.domain = TEST_DOMAIN
        config.enabled = True
        config.password = '******'
        config.username = '******'
        config.url = 'http://test-api.com/'
        config.save()
        for product in Product.by_domain(TEST_DOMAIN):
            product.delete()
Exemplo n.º 4
0
    def setUp(self):
        self.datapath = os.path.join(os.path.dirname(__file__), 'data')
        initial_bootstrap(TEST_DOMAIN)
        self.sms_backend = TestSMSBackend(name="MOBILE_BACKEND_TEST", is_global=True)
        self.sms_backend._id = self.sms_backend.name
        self.sms_backend.save()

        config = ILSGatewayConfig()
        config.domain = TEST_DOMAIN
        config.enabled = True
        config.password = '******'
        config.username = '******'
        config.url = 'http://test-api.com/'
        config.save()
        for product in Product.by_domain(TEST_DOMAIN):
            product.delete()
Exemplo n.º 5
0
    def setUp(self):
        self.datapath = os.path.join(os.path.dirname(__file__), 'data')
        initial_bootstrap(TEST_DOMAIN)
        sms_backend = TestSMSBackend(name="MOBILE_BACKEND_TEST",
                                     is_global=True)
        sms_backend._id = sms_backend.name
        sms_backend.save()

        config = ILSGatewayConfig()
        config.domain = TEST_DOMAIN
        config.enabled = True
        config.password = '******'
        config.username = '******'
        config.url = 'http://test-api.com/'
        config.save()
        for product in Product.by_domain(TEST_DOMAIN):
            product.delete()
Exemplo n.º 6
0
    def setUp(self):
        self.endpoint = MockEndpoint('http://test-api.com/', 'dummy', 'dummy')
        self.stock_api_object = MockILSStockDataSynchronization(
            TEST_DOMAIN, self.endpoint)
        self.datapath = os.path.join(os.path.dirname(__file__), 'data')
        initial_bootstrap(TEST_DOMAIN)
        self.api_object = ILSGatewayAPI(TEST_DOMAIN, self.endpoint)
        self.api_object.prepare_commtrack_config()
        config = ILSGatewayConfig()
        config.domain = TEST_DOMAIN
        config.enabled = True
        config.all_stock_data = True
        config.password = '******'
        config.username = '******'
        config.url = 'http://test-api.com/'
        config.save()
        l1 = Location(name='Test location 1',
                      external_id='3445',
                      location_type='FACILITY',
                      domain=TEST_DOMAIN)

        l2 = Location(name='Test location 2',
                      external_id='4407',
                      location_type='FACILITY',
                      domain=TEST_DOMAIN)

        l1.save()
        l2.save()

        SupplyPointCase.create_from_location(TEST_DOMAIN, l1)
        SupplyPointCase.create_from_location(TEST_DOMAIN, l2)

        with open(os.path.join(self.datapath, 'sample_products.json')) as f:
            for product_json in json.loads(f.read()):
                self.api_object.product_sync(Product(product_json))

        StockTransaction.objects.all().delete()