From 9b25c3b17f4871a37975ae2e8d4c5877306a8015 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 8 Nov 2018 10:41:33 -0500 Subject: [PATCH 1/3] Update factory to use random service branch This will give us more interesting test data. --- tests/factories.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/factories.py b/tests/factories.py index 3e9da0dc..179fc02d 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -25,6 +25,10 @@ from atst.domain.workspaces import Workspaces from atst.domain.invitations import Invitations +def random_service_branch(): + return random.choice([k for k, v in SERVICE_BRANCHES if k]) + + class Base(factory.alchemy.SQLAlchemyModelFactory): @classmethod def dictionary(cls, **attrs): @@ -54,9 +58,7 @@ class UserFactory(Base): phone_number = factory.LazyFunction( lambda: "".join(random.choices(string.digits, k=10)) ) - service_branch = factory.LazyFunction( - lambda: random.choices([k for k, v in SERVICE_BRANCHES if k is not None])[0] - ) + service_branch = factory.LazyFunction(random_service_branch) citizenship = "United States" designation = "military" date_latest_training = factory.LazyFunction( @@ -147,7 +149,7 @@ class RequestFactory(Base): start_date=datetime.date(2050, 1, 1), cloud_native="yes", dollar_value=dollar_value, - dod_component=SERVICE_BRANCHES[2][1], + dod_component=random_service_branch(), data_transfers="Less than 100GB", expected_completion_date="Less than 1 month", jedi_migration="yes", @@ -167,7 +169,7 @@ class RequestFactory(Base): email_request=user.email, fname_request=user.first_name, lname_request=user.last_name, - service_branch=SERVICE_BRANCHES[1][1], + service_branch=random_service_branch(), date_latest_training=datetime.date(2018, 8, 6), ) From dbdbbc4e9bdc23812b8338676876aacbb886e52f Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 8 Nov 2018 10:46:00 -0500 Subject: [PATCH 2/3] Add empty state when search matches no requests --- templates/requests/index.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/templates/requests/index.html b/templates/requests/index.html index c024abd6..4dd78682 100644 --- a/templates/requests/index.html +++ b/templates/requests/index.html @@ -117,7 +117,7 @@ {% endif %}
- +
@@ -157,6 +157,15 @@
+
+ {{ EmptyState( + 'No requests found.', + action_label=None, + action_href=None, + sub_message='Please try a different search.', + icon=None + ) }} +
{% endif %} From 269824b7440156034552761a578a711e3163e849 Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Thu, 8 Nov 2018 13:06:34 -0500 Subject: [PATCH 3/3] Always show requests if there any to show --- templates/requests/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/requests/index.html b/templates/requests/index.html index 4dd78682..c5257c7e 100644 --- a/templates/requests/index.html +++ b/templates/requests/index.html @@ -117,7 +117,7 @@ {% endif %}
- +