Code Duplication    Length = 25-26 lines in 2 locations

tests/test_webdav.py 2 locations

@@ 125-150 (lines=26) @@
122
123
@unittest.skipIf(sys.version_info >= (3, 6), "easywebdav doesn't support python 3.6")
124
class TestWebDavNeedAuth(unittest.TestCase):
125
    @classmethod
126
    def setUpClass(self):
127
        import easywebdav
128
129
        shutil.rmtree('./data/tests', ignore_errors=True)
130
        os.makedirs('./data/tests')
131
132
        ctx = run.cli.make_context('test', [
133
            '--taskdb', 'sqlite+taskdb:///data/tests/task.db',
134
            '--projectdb', 'sqlite+projectdb:///data/tests/projectdb.db',
135
            '--resultdb', 'sqlite+resultdb:///data/tests/resultdb.db',
136
        ], None, obj=utils.ObjectDict(testing_mode=True))
137
        self.ctx = run.cli.invoke(ctx)
138
139
        ctx = run.webui.make_context('webui', [
140
            '--username', 'binux',
141
            '--password', '4321',
142
            '--need-auth',
143
        ], self.ctx)
144
        self.app = run.webui.invoke(ctx)
145
        self.app_thread = utils.run_in_thread(self.app.run)
146
        time.sleep(5)
147
148
        self.webdav = easywebdav.connect('localhost', port=5000, path='dav')
149
        self.webdav_up = easywebdav.connect('localhost', port=5000, path='dav',
150
                                            username='binux', password='4321')
151
152
    @classmethod
153
    def tearDownClass(self):
@@ 23-47 (lines=25) @@
20
21
@unittest.skipIf(sys.version_info >= (3, 6), "easywebdav doesn't support python 3.6")
22
class TestWebDav(unittest.TestCase):
23
    @classmethod
24
    def setUpClass(self):
25
        import easywebdav
26
27
        shutil.rmtree('./data/tests', ignore_errors=True)
28
        os.makedirs('./data/tests')
29
30
        ctx = run.cli.make_context('test', [
31
            '--taskdb', 'sqlite+taskdb:///data/tests/task.db',
32
            '--projectdb', 'sqlite+projectdb:///data/tests/projectdb.db',
33
            '--resultdb', 'sqlite+resultdb:///data/tests/resultdb.db',
34
        ], None, obj=utils.ObjectDict(testing_mode=True))
35
        self.ctx = run.cli.invoke(ctx)
36
37
        ctx = run.webui.make_context('webui', [
38
            '--username', 'binux',
39
            '--password', '4321',
40
        ], self.ctx)
41
        self.app = run.webui.invoke(ctx)
42
        self.app_thread = utils.run_in_thread(self.app.run)
43
        time.sleep(5)
44
45
        self.webdav = easywebdav.connect('localhost', port=5000, path='dav')
46
        self.webdav_up = easywebdav.connect('localhost', port=5000, path='dav',
47
                                            username='binux', password='4321')
48
49
    @classmethod
50
    def tearDownClass(self):