def test_ensure_licenses_some_missing(self): NodeLicense.objects.get(license_id='LGPL3').delete() with assert_raises(NodeLicense.DoesNotExist): NodeLicense.objects.get(license_id='LGPL3') ensure_licenses() found = NodeLicense.objects.get(license_id='LGPL3') assert_is_not_none(found)
def test_ensure_licenses_no_licenses(self): before_count = NodeLicense.objects.all().count() NodeLicense.objects.all().delete() assert_false(NodeLicense.objects.all().count()) ensure_licenses() assert_equal(before_count, NodeLicense.objects.all().count())
def test_ensure_licenses_no_licenses(self): before_count = NodeLicense.objects.all().count() NodeLicense.objects.all().delete() assert_false(NodeLicense.objects.all().count()) ensure_licenses() assert_equal(before_count, NodeLicense.objects.all().count())
def test_ensure_licenses_some_missing(self): NodeLicense.objects.get(license_id='LGPL3').delete() with assert_raises(NodeLicense.DoesNotExist): NodeLicense.objects.get(license_id='LGPL3') ensure_licenses() found = NodeLicense.objects.get(license_id='LGPL3') assert_is_not_none(found)
def test_ensure_licenses_updates_existing(self): with mock.patch.object(builtins, 'open', mock.mock_open(read_data=LICENSE_TEXT)): ensure_licenses() MIT = NodeLicense.objects.get(license_id='MIT') assert_equal(MIT.name, CHANGED_NAME) assert_equal(MIT.text, CHANGED_TEXT) assert_equal(MIT.properties, CHANGED_PROPERTIES)
def test_ensure_licenses_updates_existing(self): with mock.patch.object(builtins, 'open', mock.mock_open(read_data=LICENSE_TEXT)): ensure_licenses() MIT = NodeLicense.objects.get(license_id='MIT') assert_equal(MIT.name, CHANGED_NAME) assert_equal(MIT.text, CHANGED_TEXT) assert_equal(MIT.properties, CHANGED_PROPERTIES)
def test_ensure_licenses_no_licenses(self): before_count = NodeLicense.find().count() NodeLicense.remove() assert_false(NodeLicense.find().count()) ensure_licenses() assert_equal(before_count, NodeLicense.find().count())
def test_ensure_licenses_some_missing(self): NodeLicense.remove_one( NodeLicense.find_one(Q('license_id', 'eq', 'LGPL3')) ) with assert_raises(NoResultsFound): NodeLicense.find_one( Q('license_id', 'eq', 'LGPL3') ) ensure_licenses() found = NodeLicense.find_one( Q('license_id', 'eq', 'LGPL3') ) assert_is_not_none(found)
def test_ensure_licenses_updates_existing_licenses(self): assert_equal(ensure_licenses(), (0, 18))
def test_ensure_licenses_updates_existing_licenses(self): assert_equal(ensure_licenses(), (0, 18))