mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-13 22:45:05 +02:00
Update workflow
This commit is contained in:
parent
98aa1c11c8
commit
5b49602684
2 changed files with 11 additions and 7 deletions
8
.github/workflows/daily-csv-upload.yaml
vendored
8
.github/workflows/daily-csv-upload.yaml
vendored
|
@ -66,20 +66,20 @@ jobs:
|
||||||
CF_PASSWORD: CF_{{ needs.variables.outputs.environment }}_PASSWORD
|
CF_PASSWORD: CF_{{ needs.variables.outputs.environment }}_PASSWORD
|
||||||
steps:
|
steps:
|
||||||
- name: Generate current-federal.csv
|
- name: Generate current-federal.csv
|
||||||
uses: 18f/cg-deploy-action@main
|
uses: cloud-gov/cg-cli-tools@main
|
||||||
with:
|
with:
|
||||||
cf_username: ${{ secrets[env.CF_USERNAME] }}
|
cf_username: ${{ secrets[env.CF_USERNAME] }}
|
||||||
cf_password: ${{ secrets[env.CF_PASSWORD] }}
|
cf_password: ${{ secrets[env.CF_PASSWORD] }}
|
||||||
cf_org: cisa-dotgov
|
cf_org: cisa-dotgov
|
||||||
cf_space: ${{ needs.variables.outputs.environment }}
|
cf_space: ${{ needs.variables.outputs.environment }}
|
||||||
full_command: "cf run-task getgov-${{ needs.variables.outputs.environment }} --command 'python manage.py generate_current_federal_report' --name federal"
|
cf_command: "run-task getgov-${{ needs.variables.outputs.environment }} --command 'python manage.py generate_current_federal_report' --name federal"
|
||||||
|
|
||||||
- name: Generate current-full.csv
|
- name: Generate current-full.csv
|
||||||
uses: 18f/cg-deploy-action@main
|
uses: cloud-gov/cg-cli-tools@main
|
||||||
with:
|
with:
|
||||||
cf_username: ${{ secrets[env.CF_USERNAME] }}
|
cf_username: ${{ secrets[env.CF_USERNAME] }}
|
||||||
cf_password: ${{ secrets[env.CF_PASSWORD] }}
|
cf_password: ${{ secrets[env.CF_PASSWORD] }}
|
||||||
cf_org: cisa-dotgov
|
cf_org: cisa-dotgov
|
||||||
cf_space: ${{ needs.variables.outputs.environment }}
|
cf_space: ${{ needs.variables.outputs.environment }}
|
||||||
full_command: "cf run-task getgov-${{ needs.variables.outputs.environment }} --command 'python manage.py generate_current_full_report' --name full"
|
cf_command: "run-task getgov-${{ needs.variables.outputs.environment }} --command 'python manage.py generate_current_full_report' --name full"
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ from registrar.utility.csv_export import export_domains_to_writer
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from unittest.mock import call, mock_open, patch
|
from unittest.mock import call, mock_open, patch
|
||||||
from api.views import get_current_federal, get_current_full
|
from api.views import get_current_federal, get_current_full
|
||||||
|
import boto3_mocking # type: ignore
|
||||||
|
|
||||||
class CsvReportsTest(TestCase):
|
class CsvReportsTest(TestCase):
|
||||||
"""Tests to determine if we are uploading our reports correctly"""
|
"""Tests to determine if we are uploading our reports correctly"""
|
||||||
|
@ -84,6 +84,7 @@ class CsvReportsTest(TestCase):
|
||||||
error = err.exception
|
error = err.exception
|
||||||
self.assertEqual(str(error), "Could not find newly created file at 'migrationdata/current-full.csv'")
|
self.assertEqual(str(error), "Could not find newly created file at 'migrationdata/current-full.csv'")
|
||||||
|
|
||||||
|
@boto3_mocking.patching
|
||||||
def test_generate_federal_report(self):
|
def test_generate_federal_report(self):
|
||||||
"""Ensures that we correctly generate current-federal.csv"""
|
"""Ensures that we correctly generate current-federal.csv"""
|
||||||
expected_file_content = [
|
expected_file_content = [
|
||||||
|
@ -100,6 +101,7 @@ class CsvReportsTest(TestCase):
|
||||||
# Now you can make assertions about how you expect 'file' to be used.
|
# Now you can make assertions about how you expect 'file' to be used.
|
||||||
content.write.assert_has_calls(expected_file_content)
|
content.write.assert_has_calls(expected_file_content)
|
||||||
|
|
||||||
|
@boto3_mocking.patching
|
||||||
def test_generate_full_report(self):
|
def test_generate_full_report(self):
|
||||||
"""Ensures that we correctly generate current-full.csv"""
|
"""Ensures that we correctly generate current-full.csv"""
|
||||||
expected_file_content = [
|
expected_file_content = [
|
||||||
|
@ -116,7 +118,7 @@ class CsvReportsTest(TestCase):
|
||||||
content = fake_open()
|
content = fake_open()
|
||||||
# Now you can make assertions about how you expect 'file' to be used.
|
# Now you can make assertions about how you expect 'file' to be used.
|
||||||
content.write.assert_has_calls(expected_file_content)
|
content.write.assert_has_calls(expected_file_content)
|
||||||
|
|
||||||
def test_not_found_full_report(self):
|
def test_not_found_full_report(self):
|
||||||
"""Ensures that we get a not found when the report doesn't exist"""
|
"""Ensures that we get a not found when the report doesn't exist"""
|
||||||
response = self.client.get("/api/v1/get-report/current-full")
|
response = self.client.get("/api/v1/get-report/current-full")
|
||||||
|
@ -134,7 +136,8 @@ class CsvReportsTest(TestCase):
|
||||||
self.assertEqual(response.status_code, 404)
|
self.assertEqual(response.status_code, 404)
|
||||||
# Check that the response body contains "File not found"
|
# Check that the response body contains "File not found"
|
||||||
self.assertEqual(response.content.decode(), "File not found")
|
self.assertEqual(response.content.decode(), "File not found")
|
||||||
|
|
||||||
|
@boto3_mocking.patching
|
||||||
def test_load_federal_report(self):
|
def test_load_federal_report(self):
|
||||||
"""Tests the current-federal api link"""
|
"""Tests the current-federal api link"""
|
||||||
request = self.factory.get("/fake-path")
|
request = self.factory.get("/fake-path")
|
||||||
|
@ -152,6 +155,7 @@ class CsvReportsTest(TestCase):
|
||||||
|
|
||||||
self.assertEqual(file_content, expected_file_content)
|
self.assertEqual(file_content, expected_file_content)
|
||||||
|
|
||||||
|
@boto3_mocking.patching
|
||||||
def test_load_full_report(self):
|
def test_load_full_report(self):
|
||||||
"""Tests the current-federal api link"""
|
"""Tests the current-federal api link"""
|
||||||
request = self.factory.get("/fake-path")
|
request = self.factory.get("/fake-path")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue