Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLOWS-313] - Add has_vtex in flows get_features #193

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions temba/flows/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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 ([email protected])", {})
assert_features({"facebook", "airtime", "classifier", "resthook", "ticketer"})
assert_features({"facebook", "airtime", "classifier", "resthook", "ticketer", "has_vtex"})

ExternalService.objects.create(
uuid=uuid.uuid4(),
Expand All @@ -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"
Expand All @@ -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()
Expand All @@ -439,6 +448,7 @@ def assert_features(features: set):
"ticketer",
"external_service",
"whatsapp_catalog",
"has_vtex",
"locations",
}
)
Expand Down
2 changes: 2 additions & 0 deletions temba/flows/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading