Skip to content

[WIP] Added test case for Chat sessstion View, Contest Form#182

Merged
tapaswenipathak merged 2 commits into
OpenSourceHelpCommunity:predevfrom
vaibhavsingh97:Patch5/addTestCase
Dec 16, 2018
Merged

[WIP] Added test case for Chat sessstion View, Contest Form#182
tapaswenipathak merged 2 commits into
OpenSourceHelpCommunity:predevfrom
vaibhavsingh97:Patch5/addTestCase

Conversation

@vaibhavsingh97

Copy link
Copy Markdown
Member

Checklist

  • My branch is up-to-date with the upstream develop branch.
  • I have added necessary documentation (if appropriate).

Which issue does this PR fix?: fixes #179

Comment thread oshc/main/tests.py Outdated
# self.assertTrue(form.is_valid())

# def test_ContestForm_invalid(self):
# form = Contest(data={'name': '112', 'link': 'google.com/', 'description': 'This is a sample description', 'start_date': '9999-99-99', 'end_date': 'csdd-dd-dd', 'approved': 'True'})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (190 > 79 characters)

Comment thread oshc/main/tests.py Outdated
# class ContestFormTest(TestCase):

# def test_ContestForm_valid(self):
# form = Contest(data = {'name': 'oshc', 'link': 'http://google.com/', 'description': 'This is a sample description', 'start_date': '2014-04-03', 'end_date': '2014-04-04', 'approved': 'True'})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (200 > 79 characters)

Comment thread oshc/main/tests.py
class ContestCreateValidation(TestCase):
def test_contest_create(self):
c = Client()
response = c.post('/contest_new/', {'name': 'oshc', 'link': 'http://google.com/', 'description': 'This is a sample description', 'start_date': '2014-04-03', 'end_date': '2014-04-04', 'approved': 'True'})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (211 > 79 characters)

Comment thread oshc/main/tests.py
class ContestCreateTestCase(TestCase):
def setUp(self):
Contest.objects.create(name="oshc", link="http://google.com/", description="This is a sample description",
start_date="2014-04-03", end_date="2014-04-04", approved=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (93 > 79 characters)

Comment thread oshc/main/tests.py

class ContestCreateTestCase(TestCase):
def setUp(self):
Contest.objects.create(name="oshc", link="http://google.com/", description="This is a sample description",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (114 > 79 characters)

Comment thread oshc/main/tests.py Outdated

# def test_start_date(self):
# timestamp =datetime.date.today()
# ContestStartDate = chatSession.objects.get(start_date=datetime.datetime.fromtimestamp(timestamp, timezone.utc))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (121 > 79 characters)

Comment thread oshc/main/tests.py Outdated
def setUp(self):
timestamp = datetime.date.today()
chatSession.objects.create(title="oshc-session", profile_name="test_name", profile_url="http://google.com/", description="This is a sample description",
start_date=datetime.date.today(), end_date=datetime.date.today() + datetime.timedelta(days=1), register_url="http://google.com/")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (164 > 79 characters)

Comment thread oshc/main/tests.py
class ChatSessionCreateTestCase(TestCase):
def setUp(self):
timestamp = datetime.date.today()
chatSession.objects.create(title="oshc-session", profile_name="test_name", profile_url="http://google.com/", description="This is a sample description",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (160 > 79 characters)

Comment thread oshc/main/tests.py Outdated

class ChatSessionCreateTestCase(TestCase):
def setUp(self):
timestamp = datetime.date.today()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

local variable 'timestamp' is assigned to but never used

Comment thread oshc/main/tests.py
from django.urls import reverse
from main.models import Contest, chatSession
import datetime
from django.utils import timezone

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

'django.utils.timezone' imported but unused

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+15.06%) to 82.684% when pulling 383291d on vaibhavsingh97:Patch5/addTestCase into f01f550 on OpenSourceHelpCommunity:predev.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+10.5%) to 78.146% when pulling b181723 on vaibhavsingh97:Patch5/addTestCase into f01f550 on OpenSourceHelpCommunity:predev.

@tapaswenipathak tapaswenipathak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great!

  • README update to run test

I cleaned up few things on this. When I say python3 oshc/manage.py test, it doesn't run the test. If I say python3 manage.py test after cd into oshc, it works! also if I say python3 oshc/manage.py test <app_name> it works. 🤔 Did you try this out, do you have a good read for this?

cc @jarifibrahim.

@vaibhavsingh97

Copy link
Copy Markdown
Member Author

@tapasweni-pathak This PR still has issues so please leave it for a moment

@tapaswenipathak

Copy link
Copy Markdown
Member

What issues? 🤔 I am in the process of fixing this coverage part and not specifying all apps.

@vaibhavsingh97

Copy link
Copy Markdown
Member Author

@tapasweni-pathak issue with ChatSessionCreateTestCase

Comment thread oshc/main/tests.py
self.start_date = timezone.make_aware(datetime.datetime(2017, 11, 6, 12, 10, 5))
self.end_date = timezone.make_aware(datetime.datetime(2017, 12, 15, 22, 45, 50))
chatSession.objects.create(title="oshc-session", profile_name="test_name", profile_url="http://google.com/", description="This is a sample description",
start_date=self.start_date, end_date=self.end_date, register_url="http://google.com/")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (121 > 79 characters)

Comment thread oshc/main/tests.py
def setUp(self):
self.start_date = timezone.make_aware(datetime.datetime(2017, 11, 6, 12, 10, 5))
self.end_date = timezone.make_aware(datetime.datetime(2017, 12, 15, 22, 45, 50))
chatSession.objects.create(title="oshc-session", profile_name="test_name", profile_url="http://google.com/", description="This is a sample description",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (160 > 79 characters)

Comment thread oshc/main/tests.py
class ChatSessionCreateTestCase(TestCase):
def setUp(self):
self.start_date = timezone.make_aware(datetime.datetime(2017, 11, 6, 12, 10, 5))
self.end_date = timezone.make_aware(datetime.datetime(2017, 12, 15, 22, 45, 50))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (88 > 79 characters)

Comment thread oshc/main/tests.py

class ChatSessionCreateTestCase(TestCase):
def setUp(self):
self.start_date = timezone.make_aware(datetime.datetime(2017, 11, 6, 12, 10, 5))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

line too long (88 > 79 characters)

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+14.9%) to 82.558% when pulling a1a4586 on vaibhavsingh97:Patch5/addTestCase into f01f550 on OpenSourceHelpCommunity:predev.

@tapaswenipathak tapaswenipathak merged commit ee7a4ad into OpenSourceHelpCommunity:predev Dec 16, 2018
@vaibhavsingh97 vaibhavsingh97 deleted the Patch5/addTestCase branch December 17, 2018 09:01
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.

Add test cases

4 participants