Skip to content

Commit

Permalink
Fixes random connection guid generation in test_packages.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Aryamanz29 committed Dec 27, 2023
1 parent 66a0f23 commit 0632150
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
{
"name": "connection",
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/confluent-kafka/123456\", \"name\": \"test-conf-kafka-direct-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"confluent-kafka\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"eventbus\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://cdn.confluent.io/wp-content/uploads/apache-kafka-icon-2021-e1638496305992.jpg\"}, \"guid\": \"-123456123456\"}"
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/confluent-kafka/123456\", \"name\": \"test-conf-kafka-direct-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"confluent-kafka\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"eventbus\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://cdn.confluent.io/wp-content/uploads/apache-kafka-icon-2021-e1638496305992.jpg\"}, \"guid\": \"-1234567890000000000000000\"}"
},
{
"name": "publish-mode",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/package_requests/dbt_cloud.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
},
{
"name": "connection",
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/dbt/123456\", \"name\": \"test-dbt-cloud-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"dbt\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"elt\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://assets.atlan.com/assets/dbt-new.svg\"}, \"guid\": \"-123456123456\"}"
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/dbt/123456\", \"name\": \"test-dbt-cloud-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"dbt\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"elt\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://assets.atlan.com/assets/dbt-new.svg\"}, \"guid\": \"-1234567890000000000000000\"}"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/package_requests/dbt_core.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
},
{
"name": "connection",
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/dbt/123456\", \"name\": \"test-dbt-core-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"dbt\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"elt\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://assets.atlan.com/assets/dbt-new.svg\"}, \"guid\": \"-123456123456\"}"
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/dbt/123456\", \"name\": \"test-dbt-core-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"dbt\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"elt\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://assets.atlan.com/assets/dbt-new.svg\"}, \"guid\": \"-1234567890000000000000000\"}"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/package_requests/glue_iam_user.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
{
"name": "connection",
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/glue/123456\", \"name\": \"test-glue-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"glue\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"lake\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://atlan-public.s3.eu-west-1.amazonaws.com/atlan/logos/aws-glue.png\"}, \"guid\": \"-123456123456\"}"
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/glue/123456\", \"name\": \"test-glue-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"glue\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"lake\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://atlan-public.s3.eu-west-1.amazonaws.com/atlan/logos/aws-glue.png\"}, \"guid\": \"-1234567890000000000000000\"}"
},
{
"name": "publish-mode",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
{
"name": "connection",
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/powerbi/123456\", \"name\": \"test-powerbi-du-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"powerbi\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"bi\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://powerbi.microsoft.com/pictures/application-logos/svg/powerbi.svg\"}, \"guid\": \"-123456123456\"}"
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/powerbi/123456\", \"name\": \"test-powerbi-du-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"powerbi\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"bi\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://powerbi.microsoft.com/pictures/application-logos/svg/powerbi.svg\"}, \"guid\": \"-1234567890000000000000000\"}"
},
{
"name": "atlas-auth-type",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
{
"name": "connection",
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/powerbi/123456\", \"name\": \"test-powerbi-sp-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"powerbi\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"bi\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://powerbi.microsoft.com/pictures/application-logos/svg/powerbi.svg\"}, \"guid\": \"-123456123456\"}"
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/powerbi/123456\", \"name\": \"test-powerbi-sp-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"powerbi\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"bi\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://powerbi.microsoft.com/pictures/application-logos/svg/powerbi.svg\"}, \"guid\": \"-1234567890000000000000000\"}"
},
{
"name": "atlas-auth-type",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/package_requests/snowflake_basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
{
"name": "connection",
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/snowflake/123456\", \"name\": \"test-snowflake-basic-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"snowflake\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"warehouse\", \"allowQuery\": true, \"allowQueryPreview\": true, \"rowLimit\": 10000, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://1amiydhcmj36tz3733v94f15-wpengine.netdna-ssl.com/wp-content/themes/snowflake/assets/img/logo-blue.svg\"}, \"guid\": \"-123456123456\"}"
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/snowflake/123456\", \"name\": \"test-snowflake-basic-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"snowflake\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"warehouse\", \"allowQuery\": true, \"allowQueryPreview\": true, \"rowLimit\": 10000, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://1amiydhcmj36tz3733v94f15-wpengine.netdna-ssl.com/wp-content/themes/snowflake/assets/img/logo-blue.svg\"}, \"guid\": \"-1234567890000000000000000\"}"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/package_requests/snowflake_keypair.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
{
"name": "connection",
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/snowflake/123456\", \"name\": \"test-snowflake-keypair-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"snowflake\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"warehouse\", \"allowQuery\": true, \"allowQueryPreview\": true, \"rowLimit\": 10000, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://1amiydhcmj36tz3733v94f15-wpengine.netdna-ssl.com/wp-content/themes/snowflake/assets/img/logo-blue.svg\"}, \"guid\": \"-123456123456\"}"
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/snowflake/123456\", \"name\": \"test-snowflake-keypair-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"snowflake\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"warehouse\", \"allowQuery\": true, \"allowQueryPreview\": true, \"rowLimit\": 10000, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://1amiydhcmj36tz3733v94f15-wpengine.netdna-ssl.com/wp-content/themes/snowflake/assets/img/logo-blue.svg\"}, \"guid\": \"-1234567890000000000000000\"}"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/package_requests/tableau_access_token.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
},
{
"name": "connection",
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/tableau/123456\", \"name\": \"test-tableau-access-token-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"tableau\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"bi\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://img.icons8.com/color/480/000000/tableau-software.png\"}, \"guid\": \"-123456123456\"}"
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/tableau/123456\", \"name\": \"test-tableau-access-token-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"tableau\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"bi\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://img.icons8.com/color/480/000000/tableau-software.png\"}, \"guid\": \"-1234567890000000000000000\"}"
},
{
"name": "atlas-auth-type",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/package_requests/tableau_basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
},
{
"name": "connection",
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/tableau/123456\", \"name\": \"test-tableau-basic-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"tableau\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"bi\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://img.icons8.com/color/480/000000/tableau-software.png\"}, \"guid\": \"-123456123456\"}"
"value": "{\"typeName\": \"Connection\", \"attributes\": {\"qualifiedName\": \"default/tableau/123456\", \"name\": \"test-tableau-basic-conn\", \"adminUsers\": [], \"adminGroups\": [], \"connectorName\": \"tableau\", \"isDiscoverable\": true, \"isEditable\": false, \"adminRoles\": [\"admin-guid-1234\"], \"category\": \"bi\", \"allowQuery\": false, \"allowQueryPreview\": false, \"rowLimit\": 0, \"defaultCredentialGuid\": \"{{credentialGuid}}\", \"sourceLogo\": \"https://img.icons8.com/color/480/000000/tableau-software.png\"}, \"guid\": \"-1234567890000000000000000\"}"
},
{
"name": "atlas-auth-type",
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,18 @@ def mock_get_epoch_timestamp():
yield mock_datetime


@pytest.fixture()
def mock_connection_guid():
with patch("pyatlan.utils.random") as mock_random:
mock_random.random.return_value = 123456789
yield mock_random


def test_snowflake_package(
mock_role_cache,
mock_user_cache,
mock_group_cache,
mock_connection_guid,
mock_get_epoch_timestamp,
):
mock_role_cache.validate_idstrs
Expand Down Expand Up @@ -109,6 +117,7 @@ def test_glue_package(
mock_role_cache,
mock_user_cache,
mock_group_cache,
mock_connection_guid,
mock_get_epoch_timestamp,
):
mock_role_cache.validate_idstrs
Expand Down Expand Up @@ -138,6 +147,7 @@ def test_tableau_package(
mock_role_cache,
mock_user_cache,
mock_group_cache,
mock_connection_guid,
mock_get_epoch_timestamp,
):
mock_role_cache.validate_idstrs
Expand Down Expand Up @@ -193,6 +203,7 @@ def test_powerbi_package(
mock_role_cache,
mock_user_cache,
mock_group_cache,
mock_connection_guid,
mock_get_epoch_timestamp,
):
mock_role_cache.validate_idstrs
Expand Down Expand Up @@ -246,6 +257,7 @@ def test_confluent_kafka_package(
mock_role_cache,
mock_user_cache,
mock_group_cache,
mock_connection_guid,
mock_get_epoch_timestamp,
):
mock_role_cache.validate_idstrs
Expand Down Expand Up @@ -273,6 +285,7 @@ def test_dbt_package(
mock_role_cache,
mock_user_cache,
mock_group_cache,
mock_connection_guid,
mock_get_epoch_timestamp,
):
mock_role_cache.validate_idstrs
Expand Down

0 comments on commit 0632150

Please sign in to comment.