From 1cdbe5416e15e7f3ebae4e09ca32afa522becc8a Mon Sep 17 00:00:00 2001 From: lucaslinhares Date: Tue, 14 Nov 2023 12:17:16 -0300 Subject: [PATCH] Add has_vtex in flows get_features --- temba/flows/tests.py | 24 +++++++++++++++++------- temba/flows/views.py | 2 ++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/temba/flows/tests.py b/temba/flows/tests.py index d96f6b71d41..78f084bc9f9 100644 --- a/temba/flows/tests.py +++ b/temba/flows/tests.py @@ -363,7 +363,7 @@ def test_editor(self): def test_editor_feature_filters(self): flow = self.create_flow() - + self.org.config["has_vtex"] = True self.login(self.admin) def assert_features(features: set): @@ -380,20 +380,20 @@ def assert_features(features: set): # add a DT One integration DTOneType().connect(flow.org, self.admin, "login", "token") - assert_features({"airtime", "classifier", "resthook"}) + assert_features({"airtime", "classifier", "resthook", "has_vtex"}) # change our channel to use a whatsapp scheme self.channel.schemes = [URN.WHATSAPP_SCHEME] self.channel.save() - assert_features({"whatsapp", "airtime", "classifier", "resthook"}) + assert_features({"whatsapp", "airtime", "classifier", "resthook", "has_vtex"}) # change our channel to use a facebook scheme self.channel.schemes = [URN.FACEBOOK_SCHEME] self.channel.save() - assert_features({"facebook", "airtime", "classifier", "resthook"}) + assert_features({"facebook", "airtime", "classifier", "resthook", "has_vtex"}) Ticketer.create(self.org, self.user, "mailgun", "Email (bob@acme.com)", {}) - assert_features({"facebook", "airtime", "classifier", "resthook", "ticketer"}) + assert_features({"facebook", "airtime", "classifier", "resthook", "ticketer", "has_vtex"}) ExternalService.objects.create( uuid=uuid.uuid4(), @@ -404,7 +404,7 @@ def assert_features(features: set): created_by=self.user, modified_by=self.user, ) - assert_features({"facebook", "airtime", "classifier", "resthook", "ticketer", "external_service"}) + assert_features({"facebook", "airtime", "classifier", "resthook", "ticketer", "external_service", "has_vtex"}) channel = self.channel channel.get_type().code = "WAC" @@ -425,7 +425,16 @@ def assert_features(features: set): ) assert_features( - {"facebook", "airtime", "classifier", "resthook", "ticketer", "external_service", "whatsapp_catalog"} + { + "facebook", + "airtime", + "classifier", + "resthook", + "ticketer", + "external_service", + "whatsapp_catalog", + "has_vtex", + } ) self.setUpLocations() @@ -439,6 +448,7 @@ def assert_features(features: set): "ticketer", "external_service", "whatsapp_catalog", + "has_vtex", "locations", } ) diff --git a/temba/flows/views.py b/temba/flows/views.py index c9699d31c84..03a2c8e8677 100644 --- a/temba/flows/views.py +++ b/temba/flows/views.py @@ -1084,6 +1084,8 @@ def get_features(self, org) -> list: features.append("external_service") if org.catalogs.filter(is_active=True, products__isnull=False).exists(): features.append("whatsapp_catalog") + if org.config.get("has_vtex"): + features.append("has_vtex") return features