Add another sf test.
[jelmer/bts-link.git] / remote / tests / test_sourceforge.py
1 # vim:set encoding=utf-8:
2 ###############################################################################
3 # Copyright:
4 #   © 2008 Jelmer Vernooij <jelmer@samba.org>
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 #    notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 #    notice, this list of conditions and the following disclaimer in the
13 #    documentation and/or other materials provided with the distribution.
14 # 3. The names of its contributors may not be used to endorse or promote
15 #    products derived from this software without specific prior written
16 #    permission.
17
18 # THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
19 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
21 # EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 ###############################################################################
29
30 from cStringIO import StringIO
31 from remote.sourceforge import RemoteSourceForge
32 from remote import *
33 from unittest import TestCase
34
35
36 class TestRemoteSourceForge(TestCase):
37     def setUp(self):
38         self.sf = RemoteSourceForge(None)
39
40     def test_getUri(self):
41         self.assertEquals("http://sourceforge.net/tracker/?func=detail&atid=42&aid=4&group_id=1337",
42                           self.sf._getUri({"atid": "42", "aid": "4", "group_id": "1337"}))
43
44     def test_extractBugid(self):
45         self.assertEquals({"atid": "42", "aid": "4", "group_id": "1337"}, 
46            self.sf.extractBugid("http://sourceforge.net/tracker/?func=detail&atid=42&aid=4&group_id=1337"))