-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disabling SF-SAC download button when unavailable (#4139)
* Handling disabling SF-SAC download button * Lint * Using tooltip instead of title * Fixing button styling * Lint * Fixing unit tests * Lint * Lint * Adding unit test * Lint * Lint * Adding noreferrer * Using real FAQ link
- Loading branch information
1 parent
5f89fd8
commit 074cf7b
Showing
6 changed files
with
130 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import os | ||
from django.db import connection | ||
from django.test import TestCase | ||
|
||
# Use this TestMaterializedViewBuilder class as a base class for TestCases that | ||
# make use of a materialized view. | ||
|
||
|
||
class TestMaterializedViewBuilder(TestCase): | ||
def setUp(self): | ||
super().setUp() | ||
self.execute_sql_file("dissemination/sql/create_materialized_views.sql") | ||
|
||
def tearDown(self): | ||
self.execute_sql_file("dissemination/sql/drop_materialized_views.sql") | ||
super().tearDown() | ||
|
||
def execute_sql_file(self, relative_path): | ||
"""Execute the SQL commands in the file at the given path.""" | ||
full_path = os.path.join(os.getcwd(), relative_path) | ||
try: | ||
with open(full_path, "r") as file: | ||
sql_commands = file.read() | ||
with connection.cursor() as cursor: | ||
cursor.execute(sql_commands) | ||
except Exception as e: | ||
print(f"Error executing SQL command: {e}") | ||
|
||
def refresh_materialized_view(self): | ||
"""Refresh the materialized view""" | ||
self.execute_sql_file("dissemination/sql/refresh_materialized_views.sql") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters