示例#1
0
文件: tests.py 项目: atdt/afraid
    def test_get_dyndns_record(self):
        self.http.prime(self.api_response)
        records = afraid.get_dyndns_records('wintermute', 'secret')
        self.assertEquals(len(records), 2)

        # validate that the right url was queried
        args, kwargs = self.http.requests.pop()
        self.assertEquals(args, ('http://freedns.afraid.org/api/',))
        self.assertEquals(kwargs, {
            'params': {
                'action': 'getdyndns', 
                'sha': afraid.get_auth_key('wintermute', 'secret'),
            }
        })

        records = {record.hostname: record for record in records}

        for hostname, ip, update_url in self.dummy_records:
            record = records.get(hostname)
            self.assertIsNotNone(record)
            self.assertEquals(record.ip, ip)
            self.assertEquals(record.update_url, update_url)
示例#2
0
    def test_get_dyndns_record(self):
        self.http.prime(self.api_response)
        records = afraid.get_dyndns_records('wintermute', 'secret')
        self.assertEquals(len(records), 2)

        # validate that the right url was queried
        args, kwargs = self.http.requests.pop()
        self.assertEquals(args, ('http://freedns.afraid.org/api/', ))
        self.assertEquals(
            kwargs, {
                'params': {
                    'action': 'getdyndns',
                    'sha': afraid.get_auth_key('wintermute', 'secret'),
                }
            })

        records = {record.hostname: record for record in records}

        for hostname, ip, update_url in self.dummy_records:
            record = records.get(hostname)
            self.assertIsNotNone(record)
            self.assertEquals(record.ip, ip)
            self.assertEquals(record.update_url, update_url)
示例#3
0
文件: tests.py 项目: atdt/afraid
 def test_get_auth_key(self):
     key = afraid.get_auth_key('root', 'l33t')
     self.assertEquals(key, '756c1a986a6ab3da4872189510dde23e639b4d1b')
示例#4
0
 def test_get_auth_key(self):
     key = afraid.get_auth_key('root', 'l33t')
     self.assertEquals(key, '756c1a986a6ab3da4872189510dde23e639b4d1b')