def setUpClass(cls, *args, **kwargs):
        super(TestAuthApiKey, cls).setUpClass(*args, **kwargs)

        serv_config.add_section("api_key_good")
        serv_config.set("api_key_good", "user", "demo")
        serv_config.set("api_key_good", "key", "api_right_key")
        serv_config.add_section("api_key_bad")
        serv_config.set("api_key_bad", "user", "not_demo")
        serv_config.set("api_key_bad", "key", "api_wrong_key")
Beispiel #2
0
 def setUp(self):
     super(CommonMixin, self).setUp()
     self.env = self.env(context={"lang": "en_US"})
     self.backend = self.env.ref("shopinvader.backend_1")
     self.backend.bind_all_product()
     self.shopinvader_session = {}
     self.api_key = "myApiKey"
     self.auth_api_key_name = self.AUTH_API_KEY_NAME
     if self.auth_api_key_name not in serv_config.sections():
         serv_config.add_section(self.auth_api_key_name)
         serv_config.set(self.auth_api_key_name, "user", "admin")
         serv_config.set(self.auth_api_key_name, "key", self.api_key)
     self.backend.auth_api_key_name = self.auth_api_key_name
Beispiel #3
0
 def setUpClass(cls):
     super(CommonCase, cls).setUpClass()
     cls.setUpComponent()
     cls.env = cls.env(context={"lang": "en_US"})
     cls.backend = cls.env.ref("shopinvader.backend_1")
     cls.backend.bind_all_product()
     cls.shopinvader_session = {}
     cls.api_key = "myApiKey"
     cls.auth_api_key_name = cls.AUTH_API_KEY_NAME
     if cls.auth_api_key_name not in serv_config.sections():
         serv_config.add_section(cls.auth_api_key_name)
         serv_config.set(cls.auth_api_key_name, "user", "admin")
         serv_config.set(cls.auth_api_key_name, "key", cls.api_key)
     cls.backend.auth_api_key_name = cls.auth_api_key_name
Beispiel #4
0
 def setUpClass(cls, *args, **kwargs):
     super().setUpClass(*args, **kwargs)
     cls.AuthApiKey = cls.env["auth.api.key"]
     cls.demo_user = cls.env.ref("base.user_demo")
     cls.api_key_from_env = cls.AuthApiKey.create({
         "name":
         "from_env",
         "key":
         "dummy",
         "user_id":
         cls.demo_user.id
     })
     cls.api_key_from_env.refresh()
     serv_config.add_section("api_key_from_env")
     serv_config.set("api_key_from_env", "key", "api_key_from_env")
Beispiel #5
0
 def setUp(self, *args, **kwargs):
     super(ShopinvaderRestCase, self).setUp(*args, **kwargs)
     self.backend = self.env.ref("shopinvader.backend_1")
     # To ensure multi-backend works correctly, we just have to create
     # a new one on the same company.
     self.backend_copy = self.env.ref("shopinvader.backend_2")
     self.api_key = "myApiKey"
     self.api_key2 = "myApiKey2"
     self.auth_api_key_name = self.AUTH_API_KEY_NAME
     self.auth_api_key_name2 = self.AUTH_API_KEY_NAME2
     if self.auth_api_key_name not in serv_config.sections():
         serv_config.add_section(self.auth_api_key_name)
         serv_config.set(self.auth_api_key_name, "user", "admin")
         serv_config.set(self.auth_api_key_name, "key", self.api_key)
     if self.auth_api_key_name2 not in serv_config.sections():
         serv_config.add_section(self.auth_api_key_name2)
         serv_config.set(self.auth_api_key_name2, "user", "admin")
         serv_config.set(self.auth_api_key_name2, "key", self.api_key2)
     self.backend.auth_api_key_name = self.auth_api_key_name2
Beispiel #6
0
 def setUp(self):
     super(StockCommonCase, self).setUp()
     ref = self.env.ref
     self.shopinvader_backend = ref("shopinvader.backend_1")
     self.warehouse_1 = ref("stock.warehouse0")
     self.loc_1 = self.warehouse_1.lot_stock_id
     self.warehouse_2 = ref("stock.stock_warehouse_shop0")
     self.loc_2 = self.warehouse_2.lot_stock_id
     self.product = ref("product.product_product_4")
     self.shopinvader_backend.bind_all_product()
     self.index = self.env["se.index"].create({
         "name":
         "test-product-index",
         "backend_id":
         self.backend_specific.se_backend_id.id,
         "exporter_id":
         ref("shopinvader.ir_exp_shopinvader_variant").id,
         "lang_id":
         ref("base.lang_en").id,
         "model_id":
         ref("shopinvader.model_shopinvader_variant").id,
     })
     self.shopinvader_backend.write({
         "se_backend_id":
         self.backend_specific.se_backend_id.id,
         "warehouse_ids": [(6, 0, self.warehouse_1.ids)],
         "product_stock_field_id":
         ref("stock.field_product_product_qty_available").id,
     })
     self.loc_supplier = self.env.ref("stock.stock_location_suppliers")
     self.picking_type_in = self.env.ref("stock.picking_type_in")
     self.auth_api_key_name = self.AUTH_API_KEY_NAME
     self.api_key = "myApiKey"
     if self.auth_api_key_name not in serv_config.sections():
         serv_config.add_section(self.auth_api_key_name)
         serv_config.set(self.auth_api_key_name, "user", "admin")
         serv_config.set(self.auth_api_key_name, "key", self.api_key)
     self.shopinvader_backend.auth_api_key_name = self.auth_api_key_name