File: test_proper_data_installation.py

package info (click to toggle)
python-vulndb 0.1.3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,032 kB
  • sloc: python: 446; sh: 196; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 713 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import subprocess
import unittest


class TestDataIsInstalled(unittest.TestCase):
    TEST_CMD = "python -c 'from vulndb import DBVuln; DBVuln.from_id(1)'"

    def test_data_is_installed_in_virtualenv(self):
        # When we run this in the current CMD it will load the python class
        # and db files from this directory (because of python's PATH)
        subprocess.check_output(self.TEST_CMD, shell=True)

        # Install
        subprocess.check_output('python setup.py install', shell=True)

        # Now we run it in /tmp , where there is no vulndb in current PATH
        # so it will try to find it inside the site-packages
        subprocess.check_output(self.TEST_CMD, shell=True, cwd='/tmp/')