Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: Non-mocked test of PySafetyBear #2113

Merged
merged 1 commit into from Apr 6, 2018

Conversation

5 participants
@RaiVaibhav
Copy link
Member

commented Nov 4, 2017

Created PySafetyBearWithoutMockTest.py to run
test for PySafetyBear without using mock.

Closes #2102

@jayvdb
Copy link
Member

left a comment

The commit message is "Add: Non-mocked test to PySafetyBearTest" , but that isnt what your PR does.

And please rebase before pushing your updates to a pull request; if it isnt rebased, you shouldnt be requesting it to be merged ("pulled").

self.check_invalidity(self.uut, ['bottle<0.12.10', 'bottle==0.10.1'])

def test_with_cve_vulnerability(self):
self.check_invalidity(self.uut, ['bottle==0.1.10', '-e .'])

This comment has been minimized.

Copy link
@jayvdb

jayvdb Nov 9, 2017

Member

which of 'bottle==0.1.10' and '-e .' causes the vulnerability?
why have two?

This comment has been minimized.

Copy link
@RaiVaibhav

RaiVaibhav Nov 9, 2017

Author Member

Thats are two typo here 😞 first only testing using bottle==0.10.1 not any bottle=0.1.10 and second in heading of commit its of not to, PySafetyBearTest to PySafetyBear

self.uut = PySafetyBear(Section('name'), Queue())

def test_without_vulnerability(self):
self.check_validity(self.uut, ['# whee', 'foo==1.0', '# whee'])

This comment has been minimized.

Copy link
@jayvdb

jayvdb Nov 9, 2017

Member

foo doesnt have version 1.0, so that is erroneous input.

And you are testing comments here. That should be done in a separate test method. One test method per type of possible error. The name of the method then says what broke.

This comment has been minimized.

Copy link
@RaiVaibhav

RaiVaibhav Nov 9, 2017

Author Member

No not testing comment here , I will make changes accordingly

@gitmate-bot

This comment has been minimized.

Copy link
Collaborator

commented Nov 9, 2017

Comment on 754e8f3.

Shortlog of the HEAD commit contains 57 character(s). This is 7 character(s) longer than the limit (57 > 50).

Origin: GitCommitBear, Section: commit.

@RaiVaibhav RaiVaibhav force-pushed the RaiVaibhav:branch1 branch from 754e8f3 to 56d1358 Nov 9, 2017

@RaiVaibhav RaiVaibhav force-pushed the RaiVaibhav:branch1 branch from 56d1358 to 31237a9 Nov 10, 2017

@RaiVaibhav RaiVaibhav force-pushed the RaiVaibhav:branch1 branch 2 times, most recently from a4ae225 to 3a5cc45 Nov 10, 2017

@RaiVaibhav RaiVaibhav changed the title Add: Non-mocked test to PySafetyBearTest Add: Non-mocked test of PySafetyBear Nov 10, 2017

@RaiVaibhav

This comment has been minimized.

Copy link
Member Author

commented Nov 10, 2017

Changes done 👍

@co-robo co-robo removed the process/wip label Nov 11, 2017

@RaiVaibhav RaiVaibhav force-pushed the RaiVaibhav:branch1 branch 2 times, most recently from 8ff67de to 56636d0 Nov 11, 2017

self.check_validity(self.uut, ['lxml==3.6.0'])

def test_with_vulnerability(self):
self.check_invalidity(self.uut, ['bottle<0.12.10', 'bottle==0.10.1'])

This comment has been minimized.

Copy link
@jayvdb

jayvdb Nov 13, 2017

Member

Why two here?
(c.f. #2113 (comment) )

This comment has been minimized.

Copy link
@RaiVaibhav

RaiVaibhav Nov 13, 2017

Author Member
>>> bottle = package('bottle', '0.10.1')
>>> x = [bottle]
>>> check(x)
[Vulnerability(name='bottle', spec='<0.12.10', version='0.10.1', 
data={'id': 'pyup.io-25642', 'specs': ['<0.12.10'], 'v': '<0.12.10', 'cve': 'CVE-2016-9964',
 'advisory': 'redirect() in bottle.py in bottle 0.12.10 doesn\'t filter a "\\r\\n" sequence, which leads to a CRLF attack, as demonstrated by a redirect("233\\r\\nSet-Cookie: name=salt") call.'
} ) ]

One is spec and second is its version the version on which i am testing i.e 0.10.1 , It's not two different package

This comment has been minimized.

Copy link
@jayvdb

jayvdb Nov 14, 2017

Member

That explains what you are doing, but it is wrong. Please understand what check_invalidity is doing.

This comment has been minimized.

Copy link
@RaiVaibhav

RaiVaibhav Nov 14, 2017

Author Member

I will make some tests in which I consider good and bad files to check things , I will change it totally

self.check_invalidity(self.uut, ['bottle<0.12.10', 'bottle==0.10.1'])

def test_with_cve_vulnerability(self):
self.check_invalidity(self.uut, ['bottle==0.10.1', '-e .'])

This comment has been minimized.

Copy link
@jayvdb

jayvdb Nov 13, 2017

Member

Why two here?
(c.f. #2113 (comment) )

@RaiVaibhav RaiVaibhav force-pushed the RaiVaibhav:branch1 branch from ee812fc to 2d02e0b Mar 3, 2018

@RaiVaibhav

This comment has been minimized.

Copy link
Member Author

commented Mar 18, 2018

please add label block @jayvdb

@RaiVaibhav RaiVaibhav force-pushed the RaiVaibhav:branch1 branch from 2d02e0b to 294b1da Mar 27, 2018

@gitmate-bot gitmate-bot added size/XS and removed size/S labels Mar 27, 2018

@RaiVaibhav RaiVaibhav force-pushed the RaiVaibhav:branch1 branch 2 times, most recently from cccf538 to e53b065 Mar 27, 2018

@jayvdb jayvdb removed the status/blocked label Apr 6, 2018

@jayvdb
Copy link
Member

left a comment

minor things; otherwise looks good

file_name = 'requirement.txt'
file_contents = load_testfile(file_name)
file_contents = [file_contents[0]]
print(file_contents)

This comment has been minimized.

Copy link
@jayvdb

jayvdb Apr 6, 2018

Member

we dont need this?

This comment has been minimized.

Copy link
@RaiVaibhav

RaiVaibhav Apr 6, 2018

Author Member

NO 😆 👍

file_name = 'requirement.txt'
file_contents = load_testfile(file_name)
file_contents = [file_contents[1]]
self.maxDiff = None

This comment has been minimized.

Copy link
@jayvdb

jayvdb Apr 6, 2018

Member

not needed?

This comment has been minimized.

Copy link
@RaiVaibhav

RaiVaibhav Apr 6, 2018

Author Member

Nope

Add: Non-mocked test of PySafetyBear
Created ``PySafetyBearWithoutMockTest.py`` to run
test for ``PySafetyBear`` without using mock.

Closes #2102
@jayvdb

This comment has been minimized.

Copy link
Member

commented Apr 6, 2018

ack 262e430

@jayvdb

jayvdb approved these changes Apr 6, 2018

@jayvdb

jayvdb approved these changes Apr 6, 2018

@jayvdb

This comment has been minimized.

Copy link
Member

commented Apr 6, 2018

@gitmate-bot

This comment has been minimized.

Copy link
Collaborator

commented Apr 6, 2018

Hey! I'm GitMate.io! This pull request is being fastforwarded automatically. Please DO NOT push while fastforward is in progress or your changes would be lost permanently ⚠️

@gitmate-bot

This comment has been minimized.

Copy link
Collaborator

commented Apr 6, 2018

Automated fastforward with GitMate.io was successful! 🎉

@gitmate-bot gitmate-bot merged commit 262e430 into coala:master Apr 6, 2018

7 of 10 checks passed

ci/circleci Your tests are queued behind your running builds
Details
continuous-integration/appveyor/branch Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
codecov/project 100% (target 100%)
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
review/gitmate/commit This commit has no issues. :)
Details
review/gitmate/manual This commit was acknowledged. :)
Details
review/gitmate/manual/pr This PR is reviewed. :)
Details
review/gitmate/pr This PR has no issues. :)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.