예제 #1
0
    def test_urls_unchanged_empty(self):
        for (initial_status, end_status) in [
            (ModFile.S_UNKNOWN, ModFile.S_UNKNOWN),
            (ModFile.S_CACHED, ModFile.S_CACHED),
            (ModFile.S_NEW, ModFile.S_NEW),
            (ModFile.S_UPDATED, ModFile.S_UPDATED),
        ]:
            with self.subTest(initial_status=initial_status):
                modfile = ModFile(0, initial_status=initial_status)
                self.assertFalse(modfile.seen)
                self.assertIsNone(modfile.nexus_link)
                self.assertEqual(list(modfile.screenshots), [])
                self.assertEqual(modfile.status, initial_status)

                modfile.set_urls([])

                self.assertTrue(modfile.seen)
                self.assertIsNone(modfile.nexus_link)
                self.assertEqual(list(modfile.screenshots), [])
                self.assertEqual(modfile.status, end_status)
예제 #2
0
    def test_urls_updated_screenshot(self):
        screen_url = 'https://imgur.com/whatever'
        for (initial_status, end_status) in [
            (ModFile.S_UNKNOWN, ModFile.S_UPDATED),
            (ModFile.S_CACHED, ModFile.S_UPDATED),
            (ModFile.S_NEW, ModFile.S_NEW),
            (ModFile.S_UPDATED, ModFile.S_UPDATED),
        ]:
            with self.subTest(initial_status=initial_status):
                modfile = ModFile(0, initial_status=initial_status)
                self.assertFalse(modfile.seen)
                self.assertIsNone(modfile.nexus_link)
                self.assertEqual(list(modfile.screenshots), [])
                self.assertEqual(modfile.status, initial_status)

                modfile.set_urls([screen_url])

                self.assertTrue(modfile.seen)
                self.assertIsNone(modfile.nexus_link)
                self.assertEqual(list(modfile.screenshots), [screen_url])
                self.assertEqual(modfile.status, end_status)
예제 #3
0
    def test_urls_unchanged_nexus(self):
        nexus_url = 'https://nexusmods.com/borderlands/whatever'
        for (initial_status, end_status) in [
            (ModFile.S_UNKNOWN, ModFile.S_UNKNOWN),
            (ModFile.S_CACHED, ModFile.S_CACHED),
            (ModFile.S_NEW, ModFile.S_NEW),
            (ModFile.S_UPDATED, ModFile.S_UPDATED),
        ]:
            with self.subTest(initial_status=initial_status):
                modfile = ModFile(0, initial_status=initial_status)
                modfile.nexus_link = nexus_url
                self.assertFalse(modfile.seen)
                self.assertEqual(modfile.nexus_link, nexus_url)
                self.assertEqual(list(modfile.screenshots), [])
                self.assertEqual(modfile.status, initial_status)

                modfile.set_urls([nexus_url])

                self.assertTrue(modfile.seen)
                self.assertEqual(modfile.nexus_link, nexus_url)
                self.assertEqual(list(modfile.screenshots), [])
                self.assertEqual(modfile.status, end_status)