Esempio n. 1
0
    def test_admin(self, login_func):
        """ Test the admin function. """
        login_func.return_value = None

        user = tests.FakeFasUser()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.app.get('/admin/')
            self.assertEqual(output.status_code, 200)
            self.assertTrue('<title>Home - Admin</title>' in output.data)
            self.assertFalse(
                '<a href="/admin/archview/">Arch</a>' in output.data)
            self.assertFalse(
                '<a href="/admin/categoryview/">Category</a>' in output.data)

        user = tests.FakeFasUserAdmin()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.app.get('/admin/')
            self.assertEqual(output.status_code, 200)
            self.assertTrue('<title>Home - Admin</title>' in output.data)
            self.assertTrue(
                re.search('<a href="/admin/arch(view)?/">Arch</a>',
                          output.data))
            self.assertTrue(
                re.search('<a href="/admin/category(view)?/">Category</a>',
                          output.data))
Esempio n. 2
0
    def test_admin_arch(self, login_func):
        """ Test the admin Arch view. """
        login_func.return_value = None

        user = tests.FakeFasUserAdmin()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.app.get('/admin/archview/')
            self.assertEqual(output.status_code, 200)
            self.assertTrue('<title>Arch - Admin</title>' in output.data)
            self.assertTrue(
                '<a href="/admin/archview/">Arch</a>' in output.data)
            self.assertTrue(
                '<a href="/admin/categoryview/">Category</a>' in output.data)
            self.assertTrue('<a href="/admin/archview/?sort=0" '
                            'title="Sort by Name">Name</a>' in output.data)
            self.assertTrue(
                '<a href="javascript:void(0)">List (4)</a>' in output.data)
Esempio n. 3
0
    def test_admin_hostlocationview(self, login_func):
        """ Test the admin Host Location view. """
        login_func.return_value = None

        user = tests.FakeFasUserAdmin()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.app.get('/admin/hostlocationview/')
            self.assertEqual(output.status_code, 200)
            self.assertTrue('<title>Host - Host Location - Admin'
                            '</title>' in output.data)
            self.assertTrue(
                '<a href="/admin/archview/">Arch</a>' in output.data)
            self.assertTrue(
                '<a href="/admin/categoryview/">Category</a>' in output.data)
            self.assertEqual(output.data.count('<th class="column-header">'),
                             2)
            self.assertTrue(
                '<a href="javascript:void(0)">List (0)</a>' in output.data)
Esempio n. 4
0
    def test_admin_hostcategorydirview(self, login_func):
        """ Test the admin Host Category Dir view. """
        login_func.return_value = None

        user = tests.FakeFasUserAdmin()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.app.get('/admin/hostcategorydirview/')
            self.assertEqual(output.status_code, 200)
            self.assertTrue('<title>Host - Host Category Dir - Admin'
                            '</title>' in output.data)
            self.assertTrue(
                '<a href="/admin/archview/">Arch</a>' in output.data)
            self.assertTrue(
                '<a href="/admin/categoryview/">Category</a>' in output.data)
            self.assertTrue('<a href="/admin/hostcategorydirview/?sort=2" '
                            'title="Sort by Path">Path</a>' in output.data)
            self.assertTrue(
                '<a href="javascript:void(0)">List (2)</a>' in output.data)
Esempio n. 5
0
    def test_admin_hostcountryview(self, login_func):
        """ Test the admin Host Country view. """
        login_func.return_value = None

        user = tests.FakeFasUserAdmin()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.handle_flask_admin_urls('/admin/hostcountry/')
            self.assertEqual(output.status_code, 200)
            data = output.get_data(as_text=True)
            self.assertTrue('<title>Host - Host Country - Admin'
                            '</title>' in data)
            self.assertTrue(
                re.search('<a href="/admin/arch(view)?/">Arch</a>', data))
            self.assertTrue(
                re.search('<a href="/admin/category(view)?/">Category</a>',
                          data))
            self.assertEqual(data.count('<th class="column-header">'), 2)
            self.assertTrue(
                '<a href="javascript:void(0)">List (0)</a>' in data)
Esempio n. 6
0
    def test_admin_repositoryredirectview(self, login_func):
        """ Test the admin Repository Redirect view. """
        login_func.return_value = None

        user = tests.FakeFasUserAdmin()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.app.get('/admin/repositoryredirectview/')
            self.assertEqual(output.status_code, 200)
            self.assertTrue('<title>Repository - Repository Redirect - Admin'
                            '</title>' in output.data)
            self.assertTrue(
                '<a href="/admin/archview/">Arch</a>' in output.data)
            self.assertTrue(
                '<a href="/admin/categoryview/">Category</a>' in output.data)
            self.assertTrue(
                '<a href="/admin/repositoryredirectview/?sort=0" '
                'title="Sort by To Repo">To Repo</a>' in output.data)
            self.assertTrue(
                '<a href="javascript:void(0)">List (3)</a>' in output.data)
Esempio n. 7
0
    def test_admin_versionview(self, login_func):
        """ Test the admin Version view. """
        login_func.return_value = None

        user = tests.FakeFasUserAdmin()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.handle_flask_admin_urls('/admin/version/')
            self.assertEqual(output.status_code, 200)
            self.assertTrue('<title>Version - Admin' '</title>' in output.data)
            self.assertTrue(
                re.search('<a href="/admin/arch(view)?/">Arch</a>',
                          output.data))
            self.assertTrue(
                re.search('<a href="/admin/category(view)?/">Category</a>',
                          output.data))
            self.assertTrue(
                re.search(
                    '<a href="/admin/version(view)?/\?sort=[01]" '
                    'title="Sort by Name">Name</a>', output.data))
            self.assertTrue(
                '<a href="javascript:void(0)">List (6)</a>' in output.data)
Esempio n. 8
0
    def test_admin_filedetailfilegroupview(self, login_func):
        """ Test the admin FileDetailFileGroup view. """
        login_func.return_value = None

        user = tests.FakeFasUserAdmin()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.handle_flask_admin_urls(
                '/admin/filedetailfilegroup/')
            self.assertEqual(output.status_code, 200)
            self.assertTrue('<title>File - File Detail File Group - Admin'
                            '</title>' in output.data)
            self.assertTrue(
                re.search('<a href="/admin/arch(view)?/">Arch</a>',
                          output.data))
            self.assertTrue(
                re.search('<a href="/admin/category(view)?/">Category</a>',
                          output.data))
            self.assertEqual(output.data.count('<th class="column-header">'),
                             0)
            self.assertTrue(
                '<a href="javascript:void(0)">List (0)</a>' in output.data)
Esempio n. 9
0
    def test_admin_arch(self, login_func):
        """ Test the admin Arch view. """
        login_func.return_value = None

        user = tests.FakeFasUserAdmin()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.handle_flask_admin_urls('/admin/arch/')
            self.assertEqual(output.status_code, 200)
            data = output.get_data(as_text=True)
            self.assertTrue('<title>Arch - Admin</title>' in data)
            self.assertTrue(
                re.search('<a href="/admin/arch(view)?/">Arch</a>', data))
            self.assertTrue(
                re.search('<a href="/admin/category(view)?/">Category</a>',
                          data))
            self.assertTrue(
                re.search(
                    '<a href="/admin/arch(view)?/\?sort=0" '
                    'title="Sort by Name">Name</a>', data))
            self.assertTrue(
                '<a href="javascript:void(0)">List (4)</a>' in data)
Esempio n. 10
0
    def test_admin_directoryexclusivehostview(self, login_func):
        """ Test the admin DirectoryExclusiveHost view. """
        login_func.return_value = None

        user = tests.FakeFasUserAdmin()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.handle_flask_admin_urls(
                '/admin/directoryexclusivehost/')
            self.assertEqual(output.status_code, 200)
            self.assertTrue(
                '<title>Directory - Directory Exclusive Host - Admin'
                '</title>' in output.data)
            self.assertTrue(
                re.search('<a href="/admin/arch(view)?/">Arch</a>',
                          output.data))
            self.assertTrue(
                re.search('<a href="/admin/category(view)?/">Category</a>',
                          output.data))
            self.assertEqual(output.data.count('<th class="column-header">'),
                             3)
            self.assertTrue(
                '<a href="javascript:void(0)">List (0)</a>' in output.data)
Esempio n. 11
0
    def test_admin_hostcategorydirview(self, login_func):
        """ Test the admin Host Category Dir view. """
        login_func.return_value = None

        user = tests.FakeFasUserAdmin()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.handle_flask_admin_urls('/admin/hostcategorydir/')
            self.assertEqual(output.status_code, 200)
            data = output.get_data(as_text=True)
            self.assertTrue('<title>Host - Host Category Dir - Admin'
                            '</title>' in data)
            self.assertTrue(
                re.search('<a href="/admin/arch(view)?/">Arch</a>', data))
            self.assertTrue(
                re.search('<a href="/admin/category(view)?/">Category</a>',
                          data))
            self.assertTrue(
                re.search(
                    '<a href="/admin/hostcategorydir(view)?/\?sort=[02]" '
                    'title="Sort by Path">Path</a>', data))
            self.assertTrue(
                '<a href="javascript:void(0)">List (2)</a>' in data)
Esempio n. 12
0
    def test_admin_embargoedcountryview(self, login_func):
        """ Test the admin EmbargoedCountry view. """
        login_func.return_value = None

        user = tests.FakeFasUserAdmin()
        with tests.user_set(mirrormanager2.app.APP, user):
            output = self.handle_flask_admin_urls('/admin/embargoedcountry/')
            self.assertEqual(output.status_code, 200)
            self.assertTrue('<title>Country - Embargoed Country - Admin'
                            '</title>' in output.data)
            self.assertTrue(
                re.search('<a href="/admin/arch(view)?/">Arch</a>',
                          output.data))
            self.assertTrue(
                re.search('<a href="/admin/category(view)?/">Category</a>',
                          output.data))
            self.assertTrue(
                re.search(
                    '<a href="/admin/embargoedcountry(view)?/\?sort=0" '
                    'title="Sort by Country Code">Country Code</a>',
                    output.data))
            self.assertTrue(
                '<a href="javascript:void(0)">List (0)</a>' in output.data)