-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15048 from netbox-community/develop
Release v3.7.2
- Loading branch information
Showing
73 changed files
with
30,082 additions
and
2,466 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,12 +86,16 @@ intake policy](https://github.com/netbox-community/netbox/wiki/Issue-Intake-Poli | |
|
||
* In most cases, it is not necessary to add a changelog entry: A maintainer will take care of this when the PR is merged. (This helps avoid merge conflicts resulting from multiple PRs being submitted simultaneously.) | ||
|
||
* All code submissions should meet the following criteria (CI will enforce these checks): | ||
* All code submissions must meet the following criteria (CI will enforce these checks where feasible): | ||
* Consist entirely of original work | ||
* Python syntax is valid | ||
* All tests pass when run with `./manage.py test` | ||
* PEP 8 compliance is enforced, with the exception that lines may be | ||
greater than 80 characters in length | ||
|
||
> [!CAUTION] | ||
> Any contributions which include AI-generated or reproduced content will be rejected. | ||
* Some other tips to keep in mind: | ||
* If you'd like to volunteer for someone else's issue, please post a comment on that issue letting us know. (This will allow the maintainers to assign it to you.) | ||
* Check out our [developer docs](https://docs.netbox.dev/en/stable/development/getting-started/) for tips on setting up your development environment. | ||
|
@@ -117,8 +121,6 @@ We're always looking for motivated individuals to join the maintainers team and | |
|
||
We generally ask that maintainers dedicate around four hours of work to the project each week on average, which includes both hands-on development and project management tasks such as issue triage. Maintainers are also encouraged (but not required) to attend our bi-weekly Zoom call to catch up on recent items. | ||
|
||
Many maintainers petition their employer to grant some of their paid time to work on NetBox. In doing so, your employer becomes eligible to be featured as a [NetBox sponsor](https://github.com/netbox-community/netbox/wiki/Sponsorship). | ||
|
||
Interested? You can contact our lead maintainer, Jeremy Stretch, at [email protected] or on the [NetDev Community Slack](https://netdev.chat/). We'd love to have you on the team! | ||
|
||
## :heart: Other Ways to Contribute | ||
|
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
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
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
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,122 @@ | ||
from django.test import TestCase | ||
|
||
from core.models import DataSource | ||
from extras.choices import ObjectChangeActionChoices | ||
from netbox.constants import CENSOR_TOKEN, CENSOR_TOKEN_CHANGED | ||
|
||
|
||
class DataSourceChangeLoggingTestCase(TestCase): | ||
|
||
def test_password_added_on_create(self): | ||
datasource = DataSource.objects.create( | ||
name='Data Source 1', | ||
type='git', | ||
source_url='http://localhost/', | ||
parameters={ | ||
'username': 'jeff', | ||
'password': 'foobar123', | ||
} | ||
) | ||
|
||
objectchange = datasource.to_objectchange(ObjectChangeActionChoices.ACTION_CREATE) | ||
self.assertIsNone(objectchange.prechange_data) | ||
self.assertEqual(objectchange.postchange_data['parameters']['username'], 'jeff') | ||
self.assertEqual(objectchange.postchange_data['parameters']['password'], CENSOR_TOKEN_CHANGED) | ||
|
||
def test_password_added_on_update(self): | ||
datasource = DataSource.objects.create( | ||
name='Data Source 1', | ||
type='git', | ||
source_url='http://localhost/' | ||
) | ||
datasource.snapshot() | ||
|
||
# Add a blank password | ||
datasource.parameters = { | ||
'username': 'jeff', | ||
'password': '', | ||
} | ||
|
||
objectchange = datasource.to_objectchange(ObjectChangeActionChoices.ACTION_UPDATE) | ||
self.assertIsNone(objectchange.prechange_data['parameters']) | ||
self.assertEqual(objectchange.postchange_data['parameters']['username'], 'jeff') | ||
self.assertEqual(objectchange.postchange_data['parameters']['password'], '') | ||
|
||
# Add a password | ||
datasource.parameters = { | ||
'username': 'jeff', | ||
'password': 'foobar123', | ||
} | ||
|
||
objectchange = datasource.to_objectchange(ObjectChangeActionChoices.ACTION_UPDATE) | ||
self.assertEqual(objectchange.postchange_data['parameters']['username'], 'jeff') | ||
self.assertEqual(objectchange.postchange_data['parameters']['password'], CENSOR_TOKEN_CHANGED) | ||
|
||
def test_password_changed(self): | ||
datasource = DataSource.objects.create( | ||
name='Data Source 1', | ||
type='git', | ||
source_url='http://localhost/', | ||
parameters={ | ||
'username': 'jeff', | ||
'password': 'password1', | ||
} | ||
) | ||
datasource.snapshot() | ||
|
||
# Change the password | ||
datasource.parameters['password'] = 'password2' | ||
|
||
objectchange = datasource.to_objectchange(ObjectChangeActionChoices.ACTION_UPDATE) | ||
self.assertEqual(objectchange.prechange_data['parameters']['username'], 'jeff') | ||
self.assertEqual(objectchange.prechange_data['parameters']['password'], CENSOR_TOKEN) | ||
self.assertEqual(objectchange.postchange_data['parameters']['username'], 'jeff') | ||
self.assertEqual(objectchange.postchange_data['parameters']['password'], CENSOR_TOKEN_CHANGED) | ||
|
||
def test_password_removed_on_update(self): | ||
datasource = DataSource.objects.create( | ||
name='Data Source 1', | ||
type='git', | ||
source_url='http://localhost/', | ||
parameters={ | ||
'username': 'jeff', | ||
'password': 'foobar123', | ||
} | ||
) | ||
datasource.snapshot() | ||
|
||
objectchange = datasource.to_objectchange(ObjectChangeActionChoices.ACTION_UPDATE) | ||
self.assertEqual(objectchange.prechange_data['parameters']['username'], 'jeff') | ||
self.assertEqual(objectchange.prechange_data['parameters']['password'], CENSOR_TOKEN) | ||
self.assertEqual(objectchange.postchange_data['parameters']['username'], 'jeff') | ||
self.assertEqual(objectchange.postchange_data['parameters']['password'], CENSOR_TOKEN) | ||
|
||
# Remove the password | ||
datasource.parameters['password'] = '' | ||
|
||
objectchange = datasource.to_objectchange(ObjectChangeActionChoices.ACTION_UPDATE) | ||
self.assertEqual(objectchange.prechange_data['parameters']['username'], 'jeff') | ||
self.assertEqual(objectchange.prechange_data['parameters']['password'], CENSOR_TOKEN) | ||
self.assertEqual(objectchange.postchange_data['parameters']['username'], 'jeff') | ||
self.assertEqual(objectchange.postchange_data['parameters']['password'], '') | ||
|
||
def test_password_not_modified(self): | ||
datasource = DataSource.objects.create( | ||
name='Data Source 1', | ||
type='git', | ||
source_url='http://localhost/', | ||
parameters={ | ||
'username': 'username1', | ||
'password': 'foobar123', | ||
} | ||
) | ||
datasource.snapshot() | ||
|
||
# Remove the password | ||
datasource.parameters['username'] = 'username2' | ||
|
||
objectchange = datasource.to_objectchange(ObjectChangeActionChoices.ACTION_UPDATE) | ||
self.assertEqual(objectchange.prechange_data['parameters']['username'], 'username1') | ||
self.assertEqual(objectchange.prechange_data['parameters']['password'], CENSOR_TOKEN) | ||
self.assertEqual(objectchange.postchange_data['parameters']['username'], 'username2') | ||
self.assertEqual(objectchange.postchange_data['parameters']['password'], CENSOR_TOKEN) |
Oops, something went wrong.