Esempio n. 1
0
 def test_can_update_without_xpi(self, api_client, storage):
     xpi = WebExtensionFileFactory()
     e = ExtensionFactory(xpi__from_func=xpi.open)
     res = api_client.patch(f"/api/v3/extension/{e.id}/", {"name": "new name"})
     assert res.status_code == 200
     e.refresh_from_db()
     assert e.name == "new name"
Esempio n. 2
0
 def test_can_update_without_xpi(self, api_client, storage):
     xpi = WebExtensionFileFactory()
     e = ExtensionFactory(xpi__from_func=xpi.open)
     res = api_client.patch(f"/api/v3/extension/{e.id}/", {"name": "new name"})
     assert res.status_code == 200
     e.refresh_from_db()
     assert e.name == "new name"
Esempio n. 3
0
 def test_can_update_without_xpi(self, api_client, storage):
     e = ExtensionFactory(
         xpi__from_path=self.data_path("webext-signed.xpi"))
     res = api_client.patch(f"/api/v3/extension/{e.id}/",
                            {"name": "new name"})
     assert res.status_code == 200
     e.refresh_from_db()
     assert e.name == "new name"
Esempio n. 4
0
 def test_can_update_xpi(self, api_client, storage):
     e = ExtensionFactory(
         xpi__from_path=self.data_path("legacy-signed.xpi"))
     path = self.data_path("webext-signed.xpi")
     res = self._update_extension(api_client, e.id, path)
     assert res.status_code == 200
     e.refresh_from_db()
     assert e.xpi.name.endswith("webext-signed.xpi")
Esempio n. 5
0
 def test_can_update_xpi(self, api_client, storage):
     legacy = LegacyAddonFileFactory()
     e = ExtensionFactory(xpi__from_func=legacy.open)
     webext = WebExtensionFileFactory()
     _, filename = os.path.split(webext.path)
     res = self._update_extension(api_client, e.id, webext.path)
     assert res.status_code == 200
     e.refresh_from_db()
     assert e.xpi.name.endswith(filename)
Esempio n. 6
0
 def test_can_update_xpi(self, api_client, storage):
     legacy = LegacyAddonFileFactory()
     e = ExtensionFactory(xpi__from_func=legacy.open)
     webext = WebExtensionFileFactory()
     _, filename = os.path.split(webext.path)
     res = self._update_extension(api_client, e.id, webext.path)
     assert res.status_code == 200
     e.refresh_from_db()
     assert e.xpi.name.endswith(filename)
Esempio n. 7
0
 def test_cannot_update_in_use_extension(self, api_client, storage):
     xpi = WebExtensionFileFactory()
     e = ExtensionFactory(xpi__from_func=xpi.open)
     a = ActionFactory(name="opt-out-study")
     RecipeFactory(action=a, arguments={"extensionId": e.id})
     res = api_client.patch(f"/api/v3/extension/{e.id}/", {"name": "new name"})
     assert res.status_code == 400
     assert res.data == ["Extension cannot be updated while in use by a recipe."]
     e.refresh_from_db()
     assert e.name != "new name"
 def test_cannot_update_in_use_extension(self, api_client, storage):
     xpi = WebExtensionFileFactory()
     e = ExtensionFactory(xpi__from_func=xpi.open)
     a = ActionFactory(name="opt-out-study")
     RecipeFactory(action=a, arguments={"extensionId": e.id})
     res = api_client.patch(f"/api/v3/extension/{e.id}/", {"name": "new name"})
     assert res.status_code == 400
     assert res.data == ["Extension cannot be updated while in use by a recipe."]
     e.refresh_from_db()
     assert e.name != "new name"