Ejemplo n.º 1
0
    def test_count_json(self, get_json_func):
        expected_url = 'https://pypi.python.org/pypi/fake-package/json'
        count = vanity.count_downloads('fake-package',
                                       json=True)

        get_json_func.assert_called_with(expected_url)
        self.assertEqual(count, 6)
Ejemplo n.º 2
0
    def test_not_verbose_no_debug(self, get_release_func):
        self.mock_logger = mock.Mock()

        count = vanity.count_downloads('fake-package', verbose=False)

        self.assertEqual(count, 1)
        self.mock_logger.debug.assert_not_called()
Ejemplo n.º 3
0
    def test_not_verbose_no_debug(self, get_release_func):
        self.mock_logger = mock.Mock()

        count = vanity.count_downloads('fake-package',
                                       verbose=False)

        self.assertEqual(count, 1)
        self.mock_logger.debug.assert_not_called()
Ejemplo n.º 4
0
    def test_verbose_calls_debug(self, get_release_func):

        count = vanity.count_downloads('fake-package')

        self.assertEqual(count, 1)
        self.mock_logger.debug.assert_any_call(Any(str))
Ejemplo n.º 5
0
    def test_good_pattern(self, get_release_func):
        count = vanity.count_downloads('fake-package',
                                       pattern='[Ff]ake')

        self.assertEqual(count, 1)
Ejemplo n.º 6
0
    def test_bad_pattern(self, get_release_func):
        count = vanity.count_downloads('fake-package',
                                       pattern='real')

        self.assertEqual(count, 0)
Ejemplo n.º 7
0
    def test_count_version(self, get_release_func):
        count = vanity.count_downloads('fake-package',
                                       version='1.1')

        self.assertEqual(count, 0)
Ejemplo n.º 8
0
    def test_count_multiple(self, get_release_func):
        count = vanity.count_downloads('fake-package')

        self.assertEqual(count, 3)
Ejemplo n.º 9
0
    def test_count_multiple(self, get_release_func):
        count = vanity.count_downloads('fake-package')

        self.assertEqual(count, 3)
Ejemplo n.º 10
0
from vanity import count_downloads
from time import sleep
while True:
	f = open('statistics_vanity.txt','w')
	f.write(str(count_downloads('ProDy', verbose=False)) + "\n")
	f.close()
	sleep(5)


Ejemplo n.º 11
0
    def test_verbose_calls_debug(self, get_release_func):

        count = vanity.count_downloads('fake-package')

        self.assertEqual(count, 1)
        self.mock_logger.debug.assert_any_call(Any(str))
Ejemplo n.º 12
0
    def test_good_pattern(self, get_release_func):
        count = vanity.count_downloads('fake-package', pattern='[Ff]ake')

        self.assertEqual(count, 1)
Ejemplo n.º 13
0
    def test_bad_pattern(self, get_release_func):
        count = vanity.count_downloads('fake-package', pattern='real')

        self.assertEqual(count, 0)
Ejemplo n.º 14
0
    def test_count_version(self, get_release_func):
        count = vanity.count_downloads('fake-package', version='1.1')

        self.assertEqual(count, 0)
Ejemplo n.º 15
0
    def test_count_json(self, get_json_func):
        expected_url = 'https://pypi.python.org/pypi/fake-package/json'
        count = vanity.count_downloads('fake-package', json=True)

        get_json_func.assert_called_with(expected_url)
        self.assertEqual(count, 6)
Ejemplo n.º 16
0
    def test_count_empty(self, get_release_func):
        count = vanity.count_downloads(None)

        self.assertEqual(count, 0)
Ejemplo n.º 17
0
from vanity import count_downloads
from time import sleep
while True:
    f = open('statistics.txt', 'w')
    f.write(str(count_downloads('ProDy', verbose=False)) + "\n")
    f.close()
    sleep(60)
Ejemplo n.º 18
0
    def test_count_empty(self, get_release_func):
        count = vanity.count_downloads(None)

        self.assertEqual(count, 0)