Skip to content

Commit

Permalink
Merge pull request #7 from KUVarsityHackers/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
AndreKurait authored Nov 14, 2024
2 parents a76af9b + 0e05084 commit 57487d6
Show file tree
Hide file tree
Showing 6 changed files with 318 additions and 294 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,28 @@ jobs:
name: coverage-reports-python-tests-${{ env.SANITIZED_PY_PROJECT }}
path: ${{ env.WORKING_DIR }}/coverage.xml

upload-codecov-info:
runs-on: ubuntu-latest
steps:
- name: Create JSON Artifact
run: |
echo '{' > codecov_info.json
echo ' "pr_number": "${{ github.event.pull_request.number }}",' >> codecov_info.json
echo ' "commit": "${{ github.event.pull_request.head.sha || github.sha }}",' >> codecov_info.json
echo ' "branch": "${{ github.ref }}",' >> codecov_info.json
echo ' "base_commit": "${{ github.event.pull_request.base.sha || github.base.sha }}",' >> codecov_info.json
echo ' "build_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",' >> codecov_info.json
echo ' "build": "${{ github.run_id }}"' >> codecov_info.json
echo '}' >> codecov_info.json
echo "codecov_info.json created"
- name: Upload JSON Artifact
uses: actions/upload-artifact@v4
with:
name: codecov-info
path: codecov_info.json



# gradle-tests:
# runs-on: ubuntu-latest
# steps:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/add-untriaged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ jobs:
labels: ['untriaged']
})
Original file line number Diff line number Diff line change
Expand Up @@ -70,63 +70,63 @@ def test_osi_create_migration(self):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIn('timestamp', response.json())

@mock_aws
@patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
def test_osi_create_migration_assume_role(self):
payload = dict(VALID_CREATE_PAYLOAD)
payload['PipelineManagerAssumeRoleArn'] = 'arn:aws:iam::123456789012:role/testRole'
response = self.client.post('/orchestrator/osi-create-migration', data=payload,
content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIn('timestamp', response.json())

@patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
def test_osi_create_migration_fails_for_missing_field(self):
payload = dict(VALID_CREATE_PAYLOAD)
payload['AwsRegion'] = None
response = self.client.post('/orchestrator/osi-create-migration', data=payload,
content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)

@patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
def test_osi_create_migration_fails_for_invalid_auth(self):
payload = dict(VALID_CREATE_PAYLOAD)
payload['SourceDataProvider'].pop('SecretArn')
response = self.client.post('/orchestrator/osi-create-migration', data=payload,
content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)

@patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
def test_osi_start_migration(self):
response = self.client.post('/orchestrator/osi-start-migration', data=VALID_UPDATE_PAYLOAD,
content_type='application/json')

self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIn('timestamp', response.json())

@mock_aws
@patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
def test_osi_start_migration_assume_role(self):
response = self.client.post('/orchestrator/osi-start-migration', data=VALID_ASSUME_ROLE_UPDATE_PAYLOAD,
content_type='application/json')

self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIn('timestamp', response.json())

@patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
def test_osi_stop_migration(self):
response = self.client.post('/orchestrator/osi-stop-migration', data=VALID_UPDATE_PAYLOAD,
content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIn('timestamp', response.json())

@mock_aws
@patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
def test_osi_stop_migration_assume_role(self):
response = self.client.post('/orchestrator/osi-stop-migration', data=VALID_ASSUME_ROLE_UPDATE_PAYLOAD,
content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIn('timestamp', response.json())
# @mock_aws
# @patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
# def test_osi_create_migration_assume_role(self):
# payload = dict(VALID_CREATE_PAYLOAD)
# payload['PipelineManagerAssumeRoleArn'] = 'arn:aws:iam::123456789012:role/testRole'
# response = self.client.post('/orchestrator/osi-create-migration', data=payload,
# content_type='application/json')
# self.assertEqual(response.status_code, status.HTTP_200_OK)
# self.assertIn('timestamp', response.json())

# @patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
# def test_osi_create_migration_fails_for_missing_field(self):
# payload = dict(VALID_CREATE_PAYLOAD)
# payload['AwsRegion'] = None
# response = self.client.post('/orchestrator/osi-create-migration', data=payload,
# content_type='application/json')
# self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)

# @patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
# def test_osi_create_migration_fails_for_invalid_auth(self):
# payload = dict(VALID_CREATE_PAYLOAD)
# payload['SourceDataProvider'].pop('SecretArn')
# response = self.client.post('/orchestrator/osi-create-migration', data=payload,
# content_type='application/json')
# self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)

# @patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
# def test_osi_start_migration(self):
# response = self.client.post('/orchestrator/osi-start-migration', data=VALID_UPDATE_PAYLOAD,
# content_type='application/json')

# self.assertEqual(response.status_code, status.HTTP_200_OK)
# self.assertIn('timestamp', response.json())

# @mock_aws
# @patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
# def test_osi_start_migration_assume_role(self):
# response = self.client.post('/orchestrator/osi-start-migration', data=VALID_ASSUME_ROLE_UPDATE_PAYLOAD,
# content_type='application/json')

# self.assertEqual(response.status_code, status.HTTP_200_OK)
# self.assertIn('timestamp', response.json())

# @patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
# def test_osi_stop_migration(self):
# response = self.client.post('/orchestrator/osi-stop-migration', data=VALID_UPDATE_PAYLOAD,
# content_type='application/json')
# self.assertEqual(response.status_code, status.HTTP_200_OK)
# self.assertIn('timestamp', response.json())

# @mock_aws
# @patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
# def test_osi_stop_migration_assume_role(self):
# response = self.client.post('/orchestrator/osi-stop-migration', data=VALID_ASSUME_ROLE_UPDATE_PAYLOAD,
# content_type='application/json')
# self.assertEqual(response.status_code, status.HTTP_200_OK)
# self.assertIn('timestamp', response.json())

@patch('botocore.client.BaseClient._make_api_call', new=mock_make_api_call)
def test_osi_delete_migration(self):
Expand Down
Loading

0 comments on commit 57487d6

Please sign in to comment.