Skip to content

add test case for settings#24

Open
ShoAn1 wants to merge 1 commit intolntdev:Shouryafrom
ShoAn1:unit_testing
Open

add test case for settings#24
ShoAn1 wants to merge 1 commit intolntdev:Shouryafrom
ShoAn1:unit_testing

Conversation

@ShoAn1
Copy link
Copy Markdown
Collaborator

@ShoAn1 ShoAn1 commented Apr 26, 2018

created test file for config.py/settings in settings family

Signed-off-by: shourya anand anand.shourya.01@gmail.com

Copy link
Copy Markdown
Collaborator

@kulkarniamol kulkarniamol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add copyright and clean up the comments all through the file.

@@ -0,0 +1,118 @@
import os
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add copyright statement here.

class TestSettings(TransactionProcessorTestCase):

def test_load_toml_settings_config(self):
""" the test case will create the toml file at a per the environment
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basic grammar check: Start a sentence with an uppercase letter. There should be no space BEFORE a comma. There should always be a space AFTER a comma. The second line onwards should always be aligned with the starting " of the comment. End the comment with a '.' (period)


def test_load_toml_settings_config(self):
""" the test case will create the toml file at a per the environment
and the path set,open the file ,write the content in the file and the
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'...and then instantiate...'

def test_load_default_settings_config(self):
"""Tests the default configuration.
connect = "tcp://localhost:4004" """
settings = load_default_settings_config()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ending """ needs to be on a new line. The second line needs to be aligned properly.

a toml file configured with requiremnts is to made available at a
path.
this test will test the condition when the toml is not present
at th path provided"""
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spell check, grammar check etc. Pls be advised that this code will be read by the entire Sawtooth community. We want to make sure we present our best foot forward :)

directory = tempfile.mkdtemp(prefix="test-path-config-")

try:
os.environ['SAWTOOTH_HOME'] = directory
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you not need to restore the original environment settings in this test?

Signed-off-by: shourya anand <anand.shourya.01@gmail.com>
@kulkarniamol
Copy link
Copy Markdown
Collaborator

Looks good. Pls raise PR to HL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants